PATCH [7/10] lease interfaces for version 4 NFSD
Subsystems (2)
VFS: use the inode i_writecount to test for handing out a F_RDLCK lease
Signed-off-by Andy Adamson <[email protected]>
fs/locks.c +3 -3
@@ -1275,10 +1275,10 @@ int __setlease(struct file *filp, long aif (!flp || !(*flp) || !(*flp)->fl_lmops || !(*flp)->fl_lmops->fl_break) goto out; -/* -* FIXME: What about F_RDLCK and files open for writing? -*/ error = -EAGAIN ; +if ((arg ==F_RDLCK ) && (atomic_read (&inode->i_writecount) >0 )) + goto out; +if ((arg ==F_WRLCK ) && ((atomic_read (&dentry->d_count) >1 ) || (atomic_read (&inode->i_count) >1 )))