summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJ. Bruce Fields2011-09-21 16:58:13 +0200
committerroot2011-10-28 14:59:00 +0200
commitf3c7691e8d30d88899b514675c7c86d19057b5fd (patch)
tree0065bcc05b19a99d8785ce523f992a48fe573e79 /fs/namei.c
parentnfs: drop unnecessary locking in llseek (diff)
downloadkernel-qcow2-linux-f3c7691e8d30d88899b514675c7c86d19057b5fd.tar.gz
kernel-qcow2-linux-f3c7691e8d30d88899b514675c7c86d19057b5fd.tar.xz
kernel-qcow2-linux-f3c7691e8d30d88899b514675c7c86d19057b5fd.zip
leases: fix write-open/read-lease race
In setlease, we use i_writecount to decide whether we can give out a read lease. In open, we break leases before incrementing i_writecount. There is therefore a window between the break lease and the i_writecount increment when setlease could add a new read lease. This would leave us with a simultaneous write open and read lease, which shouldn't happen. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 9061157e39d6..7657be4352bf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2035,10 +2035,7 @@ static int may_open(struct path *path, int acc_mode, int flag)
if (flag & O_NOATIME && !inode_owner_or_capable(inode))
return -EPERM;
- /*
- * Ensure there are no outstanding leases on the file.
- */
- return break_lease(inode, flag);
+ return 0;
}
static int handle_truncate(struct file *filp)