Skip to contentSkip to conversation

PATCH [7/10] lease interfaces for version 4 NFSD

PATCH William A.(Andy) Adamson 1 participant 1 message Sep 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

VFS: use the inode i_writecount to test for handing out a F_RDLCK lease

fs/locks.c +3 -3
diff --recursive -puN old/fs/locks.c new/fs/locks.c
@@ -1275,10 +1275,10 @@ int __setlease(struct file *filp, long a
 	if (!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)))