nfsd: Ensure sampling of the write verifier is atomic with the write

When doing an unstable write, we need to ensure that we sample the
write verifier before releasing the lock, and allowing a commit to
the same file to proceed.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
Trond Myklebust
2020-01-06 13:40:37 -05:00
committed by J. Bruce Fields
parent 524ff1af22
commit 19e0663ff9
7 changed files with 19 additions and 15 deletions

View File

@@ -747,17 +747,13 @@ int
nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p)
{
struct nfsd3_writeres *resp = rqstp->rq_resp;
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
__be32 verf[2];
p = encode_wcc_data(rqstp, p, &resp->fh);
if (resp->status == 0) {
*p++ = htonl(resp->count);
*p++ = htonl(resp->committed);
/* unique identifier, y2038 overflow can be ignored */
nfsd_copy_boot_verifier(verf, nn);
*p++ = verf[0];
*p++ = verf[1];
*p++ = resp->verf[0];
*p++ = resp->verf[1];
}
return xdr_ressize_check(rqstp, p);
}