Skip to contentSkip to conversation

RESEND lease interfaces for version 4 NFSD

PATCH New Andy Adamson 1 participant 1 message Sep 21, 2004

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

PATCH 1/1 RESEND lease interfaces for version 4 NFSD

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

---

 linux-2.6.9-rc2-andros/fs/locks.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
fs/locks.c renamed from fs/locks.c~setlease-fixme +2 -3
diff -puN fs/locks.c~setlease-fixme fs/locks.c
@@ -1278,10 +1278,9 @@ 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)))

_