[PATCH] fix posix lock on NFS

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>
This commit is contained in:
ASANO Masahiro 2005-12-22 13:24:54 +09:00 committed by Linus Torvalds
parent d6f029130f
commit 0800c5f7a4
1 changed files with 2 additions and 1 deletions

View File

@ -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))