GFS2: Allow flocks to use normal glock dq rather than dq_wait
authorBob Peterson <rpeterso@redhat.com>
Thu, 26 Jun 2014 14:46:25 +0000 (10:46 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 18 Jul 2014 10:13:56 +0000 (11:13 +0100)
This patch allows flock glocks to use a non-blocking dequeue rather
than dq_wait. It also reverts the previous patch I had posted regarding
dq_wait. The reverted patch isn't necessarily a bad idea, but I decided
this might avoid unforeseen side effects, and was therefore safer.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/file.c
fs/gfs2/glock.c

index 4fc3a3046174dc9a296c90a0d0ca6d53485e277b..491e8e023598cb398ba39d94b9ab1f9d019c4074 100644 (file)
@@ -991,7 +991,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
                        goto out;
                flock_lock_file_wait(file,
                                     &(struct file_lock){.fl_type = F_UNLCK});
-               gfs2_glock_dq_wait(fl_gh);
+               gfs2_glock_dq(fl_gh);
                gfs2_holder_reinit(state, flags, fl_gh);
        } else {
                error = gfs2_glock_get(GFS2_SB(&ip->i_inode), ip->i_no_addr,
index b703dcc91588fc8135e4179da19eabfe6ad82f27..ee4e04fe60fc5edcb9f5416e089a0ac440870ac5 100644 (file)
@@ -1128,9 +1128,7 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh)
        struct gfs2_glock *gl = gh->gh_gl;
        gfs2_glock_dq(gh);
        might_sleep();
-       if (!find_first_holder(gl))
-               wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait,
-                           TASK_UNINTERRUPTIBLE);
+       wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE);
 }
 
 /**