Commit 8a2b952d authored by William A. Adamson's avatar William A. Adamson Committed by Linus Torvalds

[PATCH] nfs4 lease: use the inode i_writecount

Use the inode i_writecount to test for handing out a F_RDLCK lease.
Signed-off-by: default avatarAndy Adamson <andros@citi.umich.edu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fe7ccfe8
...@@ -1280,10 +1280,9 @@ int __setlease(struct file *filp, long arg, struct file_lock **flp) ...@@ -1280,10 +1280,9 @@ int __setlease(struct file *filp, long arg, struct file_lock **flp)
if (!flp || !(*flp) || !(*flp)->fl_lmops || !(*flp)->fl_lmops->fl_break) if (!flp || !(*flp) || !(*flp)->fl_lmops || !(*flp)->fl_lmops->fl_break)
goto out; goto out;
/*
* FIXME: What about F_RDLCK and files open for writing?
*/
error = -EAGAIN; error = -EAGAIN;
if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0))
goto out;
if ((arg == F_WRLCK) if ((arg == F_WRLCK)
&& ((atomic_read(&dentry->d_count) > 1) && ((atomic_read(&dentry->d_count) > 1)
|| (atomic_read(&inode->i_count) > 1))) || (atomic_read(&inode->i_count) > 1)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment