Skip to content

Commit

Permalink
GFS2: Remove potential race in flock code
Browse files Browse the repository at this point in the history
This patch ensures that we always wait for glock demotion when
dropping flocks on a file in order to prevent any race
conditions associated with further flock calls or closing
the file.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Mar 9, 2011
1 parent fc0e38d commit 0a33443
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,10 @@ static void do_unflock(struct file *file, struct file_lock *fl)

mutex_lock(&fp->f_fl_mutex);
flock_lock_file_wait(file, fl);
if (fl_gh->gh_gl)
gfs2_glock_dq_uninit(fl_gh);
if (fl_gh->gh_gl) {
gfs2_glock_dq_wait(fl_gh);
gfs2_holder_uninit(fl_gh);
}
mutex_unlock(&fp->f_fl_mutex);
}

Expand Down

0 comments on commit 0a33443

Please sign in to comment.