[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>

authored by ASANO Masahiro and committed by Linus Torvalds 0800c5f7 d6f02913

+2 -1
+2 -1
fs/nfs/file.c
··· 509 return -EINVAL; 510 511 /* No mandatory locks over NFS */ 512 - if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 513 return -ENOLCK; 514 515 if (IS_GETLK(cmd))
··· 509 return -EINVAL; 510 511 /* No mandatory locks over NFS */ 512 + if ((inode->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID && 513 + fl->fl_type != F_UNLCK) 514 return -ENOLCK; 515 516 if (IS_GETLK(cmd))