Skip to content

Commit

Permalink
[PATCH] fix posix lock on NFS
Browse files Browse the repository at this point in the history
NFS client prevents mandatory lock, but there is a flaw on it; Locks are
possibly left if the mode is changed while locking.

This permits unlocking even if the mandatory lock bits are set.

Signed-off-by: ASANO Masahiro <masano@tnes.nec.co.jp>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
ASANO Masahiro authored and Linus Torvalds committed Dec 22, 2005
1 parent d6f0291 commit 0800c5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
return -EINVAL;

/* No mandatory locks over NFS */
if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID &&
fl->fl_type != F_UNLCK)
return -ENOLCK;

if (IS_GETLK(cmd))
Expand Down

0 comments on commit 0800c5f

Please sign in to comment.