Skip to contentSkip to conversation

gfs2: fix flock panic issue

PATCH New Junxiao Bi 2 participants 2 messages Dec 22, 2015 GFS2 file system

lore
Share & tools
lore

Junxiao Bi

author
#0 lore raw

PATCH 1/1 gfs2: fix flock panic issue

Commit 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()") move flock/posix lock indentify code to locks_lock_inode_wait(), but missed to set fl_flags to FL_FLOCK which will cause kernel panic in locks_lock_inode_wait().

Fixes 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()")
---
 fs/gfs2/file.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/gfs2/file.c +4 -1
index 860408053c95..62b85802af2c 100644
@@ -1027,7 +1027,10 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (fl_gh->gh_state == state)
 			goto out;
 		locks_lock_file_wait(file,
-				     &(struct file_lock){.fl_type = F_UNLCK});
+					&(struct file_lock) {
+						.fl_type = F_UNLCK,
+						.fl_flags = FL_FLOCK
+					});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
 	} else {
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 gfs2: fix flock panic issue

----- Original Message -----

Quoted 27 lines

Commit 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()") move flock/posix lock indentify code to locks_lock_inode_wait(), but missed to set fl_flags to FL_FLOCK which will cause kernel panic in locks_lock_inode_wait().

Fixes 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()")
---
 fs/gfs2/file.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/gfs2/file.c +4 -1
index 860408053c95..62b85802af2c 100644
@@ -1027,7 +1027,10 @@ static int do_flock(struct file *file, int cmd, struct
 file_lock *fl)
 		if (fl_gh->gh_state == state)
 			goto out;
 		locks_lock_file_wait(file,
-				     &(struct file_lock){.fl_type = F_UNLCK});
+					&(struct file_lock) {
+						.fl_type = F_UNLCK,
+						.fl_flags = FL_FLOCK
+					});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
Quoted 5 lines

} else {
--
1.7.9.5

Hi,

Thanks. This is now applied to the for-next branch of the linux-gfs2 tree:
https://git.kernel.org/cgit/linux/kernel/git/gfs2/linux-gfs2.git/commit/fs/gfs2?h=for-next&id=a93a99838248bdab49db2eaac00236847670bc7f

Regards,

Bob Peterson
Red Hat File Systems