summaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-03-09 11:14:32 +0000
committerSteven Whitehouse <swhiteho@redhat.com>2011-03-09 11:14:32 +0000
commit0a33443b38746f35fc4acc8a5af6c7099e03ea40 (patch)
tree523d8bec4c49a3b04b46fe275e1c4ef3f18fba7a /fs/gfs2
parentfc0e38dae645f65424d1fb5d2a938aab8ce48a58 (diff)
downloadop-kernel-dev-0a33443b38746f35fc4acc8a5af6c7099e03ea40.zip
op-kernel-dev-0a33443b38746f35fc4acc8a5af6c7099e03ea40.tar.gz
GFS2: Remove potential race in flock code
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>
Diffstat (limited to 'fs/gfs2')
-rw-r--r--fs/gfs2/file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 216ad27..2878481 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -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);
}
OpenPOWER on IntegriCloud