From mboxrd@z Thu Jan 1 00:00:00 1970 From: "William A.(Andy) Adamson" Subject: PATCH [7/10] lease interfaces for version 4 NFSD Date: Mon, 20 Sep 2004 16:23:03 -0400 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20040920202303.53FD51BBAA@citi.umich.edu> Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_-2276643040" Cc: andros@citi.umich.edu Return-path: Received: from citi.umich.edu ([141.211.133.111]:23660 "EHLO citi.umich.edu") by vger.kernel.org with ESMTP id S267319AbUITUXG (ORCPT ); Mon, 20 Sep 2004 16:23:06 -0400 To: linux-fsdevel@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org This is a multipart MIME message. --==_Exmh_-2276643040 Content-Type: text/plain; charset=us-ascii VFS: use the inode i_writecount to test for handing out a F_RDLCK lease Signed-off-by: Andy Adamson --==_Exmh_-2276643040 Content-Type: text/plain ; name="linux-2.6.9-rc2-07-setlease-fixme.dif"; charset=us-ascii Content-Description: linux-2.6.9-rc2-07-setlease-fixme.dif Content-Disposition: attachment; filename="linux-2.6.9-rc2-07-setlease-fixme.dif" diff --recursive -puN old/fs/locks.c new/fs/locks.c --- old/fs/locks.c 2004-09-20 13:56:25.385316000 -0400 +++ new/fs/locks.c 2004-09-20 14:15:31.144266000 -0400 @@ -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))) --==_Exmh_-2276643040--