Sfoglia il codice sorgente

GFS2: Skip check for mandatory locks when unlocking

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>
Sachin Prabhu 15 anni fa
parent
commit
720e774927
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      fs/gfs2/file.c

+ 1 - 1
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))
 	if (!(fl->fl_flags & FL_POSIX))
 		return -ENOLCK;
 		return -ENOLCK;
-	if (__mandatory_lock(&ip->i_inode))
+	if (__mandatory_lock(&ip->i_inode) && fl->fl_type != F_UNLCK)
 		return -ENOLCK;
 		return -ENOLCK;
 
 
 	if (cmd == F_CANCELLK) {
 	if (cmd == F_CANCELLK) {