mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
NFS add a simple sync nfs4_proc_commit after async COPY
A COPY with unstable write data needs a simple sync commit. Filehandle value is gotten as a part of the inner loop so in case of a reboot retry it should get the new value. Signed-off-by: Olga Kornievskaia <kolga@netapp.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
539f57b3e0
commit
6b8d84e2f1
3 changed files with 66 additions and 1 deletions
|
@ -185,6 +185,30 @@ out:
|
|||
return status;
|
||||
}
|
||||
|
||||
static int process_copy_commit(struct file *dst, loff_t pos_dst,
|
||||
struct nfs42_copy_res *res)
|
||||
{
|
||||
struct nfs_commitres cres;
|
||||
int status = -ENOMEM;
|
||||
|
||||
cres.verf = kzalloc(sizeof(struct nfs_writeverf), GFP_NOFS);
|
||||
if (!cres.verf)
|
||||
goto out;
|
||||
|
||||
status = nfs4_proc_commit(dst, pos_dst, res->write_res.count, &cres);
|
||||
if (status)
|
||||
goto out_free;
|
||||
if (nfs_write_verifier_cmp(&res->write_res.verifier.verifier,
|
||||
&cres.verf->verifier)) {
|
||||
dprintk("commit verf differs from copy verf\n");
|
||||
status = -EAGAIN;
|
||||
}
|
||||
out_free:
|
||||
kfree(cres.verf);
|
||||
out:
|
||||
return status;
|
||||
}
|
||||
|
||||
static ssize_t _nfs42_proc_copy(struct file *src,
|
||||
struct nfs_lock_context *src_lock,
|
||||
struct file *dst,
|
||||
|
@ -251,6 +275,13 @@ static ssize_t _nfs42_proc_copy(struct file *src,
|
|||
return status;
|
||||
}
|
||||
|
||||
if ((!res->synchronous || !args->sync) &&
|
||||
res->write_res.verifier.committed != NFS_FILE_SYNC) {
|
||||
status = process_copy_commit(dst, pos_dst, res);
|
||||
if (status)
|
||||
return status;
|
||||
}
|
||||
|
||||
truncate_pagecache_range(dst_inode, pos_dst,
|
||||
pos_dst + res->write_res.count);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue