aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields2013-03-28 19:37:14 -0500
committerGreg Kroah-Hartman2013-05-07 22:08:23 -0500
commit73b12d302d65782ea3f072a230c939233f2ab4ec (patch)
treeab4ee2a60e9ee0d3b2b0289e8a218fe67cb7050f /fs/nfsd/nfs4state.c
parent082265bbb37927de80da50c22bf24993c0b9ca75 (diff)
downloadkernel-omap-73b12d302d65782ea3f072a230c939233f2ab4ec.tar.gz
kernel-omap-73b12d302d65782ea3f072a230c939233f2ab4ec.tar.xz
kernel-omap-73b12d302d65782ea3f072a230c939233f2ab4ec.zip
nfsd4: don't close read-write opens too soon
commit 0c7c3e67ab91ec6caa44bdf1fc89a48012ceb0c5 upstream. Don't actually close any opens until we don't need them at all. This means being left with write access when it's not really necessary, but that's better than putting a file that might still have posix locks held on it, as we have been. Reported-by: Toralf Förster <toralf.foerster@gmx.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a8309c688f07..53a7c643f227 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -210,13 +210,7 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
210{ 210{
211 if (atomic_dec_and_test(&fp->fi_access[oflag])) { 211 if (atomic_dec_and_test(&fp->fi_access[oflag])) {
212 nfs4_file_put_fd(fp, oflag); 212 nfs4_file_put_fd(fp, oflag);
213 /* 213 if (atomic_read(&fp->fi_access[1 - oflag]) == 0)
214 * It's also safe to get rid of the RDWR open *if*
215 * we no longer have need of the other kind of access
216 * or if we already have the other kind of open:
217 */
218 if (fp->fi_fds[1-oflag]
219 || atomic_read(&fp->fi_access[1 - oflag]) == 0)
220 nfs4_file_put_fd(fp, O_RDWR); 214 nfs4_file_put_fd(fp, O_RDWR);
221 } 215 }
222} 216}