summaryrefslogtreecommitdiff
path: root/fs/nfsd/filecache.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2020-01-06 21:40:30 +0300
committerJ. Bruce Fields <bfields@redhat.com>2020-01-23 00:25:40 +0300
commit5011af4c698a95b4dc4e374b1ce3acd122a9170f (patch)
tree963befb8ca298ac85242f9916fc808de07c33420 /fs/nfsd/filecache.c
parent16f8f894108270fd99667f06bae6ebcdd0f4e4bf (diff)
downloadlinux-5011af4c698a95b4dc4e374b1ce3acd122a9170f.tar.xz
nfsd: Fix stable writes
Strictly speaking, a stable write error needs to reflect the write + the commit of that write (and only that write). To ensure that we don't pick up the write errors from other writebacks, add a rw_semaphore to provide exclusion. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/filecache.c')
-rw-r--r--fs/nfsd/filecache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index f275c11c4e28..2fadf080ac42 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -195,6 +195,7 @@ nfsd_file_alloc(struct inode *inode, unsigned int may, unsigned int hashval,
__set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags);
}
nf->nf_mark = NULL;
+ init_rwsem(&nf->nf_rwsem);
trace_nfsd_file_alloc(nf);
}
return nf;