diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2010-03-13 09:03:55 -0600 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2010-03-13 09:05:37 -0600 |
commit | f78233dd44a110c574fe760ad6f9c1e8741a0d00 (patch) | |
tree | 5b38b76a9f7133cd6e86cecb66673b53fa93d85a /fs/9p | |
parent | fc0f296126433e61600539325975b6c30681c07e (diff) | |
download | kernel_samsung_smdk4412-f78233dd44a110c574fe760ad6f9c1e8741a0d00.zip kernel_samsung_smdk4412-f78233dd44a110c574fe760ad6f9c1e8741a0d00.tar.gz kernel_samsung_smdk4412-f78233dd44a110c574fe760ad6f9c1e8741a0d00.tar.bz2 |
9p: Skip check for mandatory locks when unlocking
While investigating a bug, I came across a possible bug in v9fs. The
problem is similar to the one reported for NFS by ASANO Masahiro in
http://lkml.org/lkml/2005/12/21/334.
v9fs_file_lock() will skip locks on file which has mode set to 02666.
This is a problem in cases where the mode of the file is changed after
a process has obtained a lock on the file. Such a lock will be skipped
during unlock and the machine will end up with a BUG in
locks_remove_flock().
v9fs_file_lock() should skip the check for mandatory locks when
unlocking a file.
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/vfs_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 019f1cd..df52d48 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -114,7 +114,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl) P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl); /* No mandatory locks */ - if (__mandatory_lock(inode)) + if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK) return -ENOLCK; if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { |