gfs2: fix flock panic issue
authorJunxiao Bi <junxiao.bi@oracle.com>
Tue, 22 Dec 2015 14:06:08 +0000 (08:06 -0600)
committerBob Peterson <rpeterso@redhat.com>
Tue, 22 Dec 2015 14:06:08 +0000 (08:06 -0600)
Commit 4f6563677ae8 ("Move locks API users to locks_lock_inode_wait()")
moved flock/posix lock identify 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()")
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
fs/gfs2/file.c

index 860408053c95a9d9d0a2d08a1900d9cc690bfe34..7412863cda1e52736552ef0deea6aa84ff8c844f 100644 (file)
@@ -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 {