[PATCH 3/3] GFS2: Skip check for mandatory locks when unlocking

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Steven Whitehouse
Date: Thursday, March 11, 2010 - 10:22 am

From: Sachin Prabhu <sprabhu@redhat.com>

gfs2_lock() will skip locks on file which have 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 and will result in a BUG in locks_remove_flock().

gfs2_lock() should skip the check for mandatory locks when unlocking a file.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index a6abbae..e6dd2ae 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -640,7 +640,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 
 	if (!(fl->fl_flags & FL_POSIX))
 		return -ENOLCK;
-	if (__mandatory_lock(&ip->i_inode))
+	if (__mandatory_lock(&ip->i_inode) && fl->fl_type != F_UNLCK)
 		return -ENOLCK;
 
 	if (cmd == F_CANCELLK) {
-- 
1.6.2.5

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
GFS2: Pre-pull patch posting, Steven Whitehouse, (Thu Mar 11, 10:21 am)
[PATCH 1/3] GFS2: do not select QUOTA, Steven Whitehouse, (Thu Mar 11, 10:21 am)
[PATCH 2/3] GFS2: Allow the number of committed revokes to ..., Steven Whitehouse, (Thu Mar 11, 10:22 am)
[PATCH 3/3] GFS2: Skip check for mandatory locks when unlo ..., Steven Whitehouse, (Thu Mar 11, 10:22 am)