summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorWengang Wang <wen.gang.wang@oracle.com>2010-03-24 22:40:44 +0800
committerJoel Becker <joel.becker@oracle.com>2010-03-30 12:55:55 -0700
commit428257f8870f0e72e85ce782d091fa1f366de7df (patch)
treeb705c3aa023b88595adb4d18a455e0c67c18a7f2 /fs
parenta03ab788d070c256eff1ac24cf0e3bc2ca148096 (diff)
downloadblackbird-op-linux-428257f8870f0e72e85ce782d091fa1f366de7df.tar.gz
blackbird-op-linux-428257f8870f0e72e85ce782d091fa1f366de7df.zip
ocfs2: Check the owner of a lockres inside the spinlock
The checking of lockres owner in dlm_update_lvb() is not inside spinlock protection. I don't see problem in current call path of dlm_update_lvb(). But just for code robustness. Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/dlm/dlmast.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
index dccc439fa087..b7a25ef18e2a 100644
--- a/fs/ocfs2/dlm/dlmast.c
+++ b/fs/ocfs2/dlm/dlmast.c
@@ -185,9 +185,8 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
BUG_ON(!lksb);
/* only updates if this node masters the lockres */
+ spin_lock(&res->spinlock);
if (res->owner == dlm->node_num) {
-
- spin_lock(&res->spinlock);
/* check the lksb flags for the direction */
if (lksb->flags & DLM_LKSB_GET_LVB) {
mlog(0, "getting lvb from lockres for %s node\n",
@@ -202,8 +201,8 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
* here. In the future we might want to clear it at the time
* the put is actually done.
*/
- spin_unlock(&res->spinlock);
}
+ spin_unlock(&res->spinlock);
/* reset any lvb flags on the lksb */
lksb->flags &= ~(DLM_LKSB_PUT_LVB|DLM_LKSB_GET_LVB);
OpenPOWER on IntegriCloud