Skip to content

Commit

Permalink
9p: Skip check for mandatory locks when unlocking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sachin Prabhu authored and Eric Van Hensbergen committed Mar 13, 2010
1 parent fc0f296 commit f78233d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/9p/vfs_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f78233d

Please sign in to comment.