ocfs2: do LVB puts in place
authorMark Fasheh <mark.fasheh@oracle.com>
Fri, 28 Apr 2006 02:07:45 +0000 (19:07 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Mon, 26 Jun 2006 21:42:55 +0000 (14:42 -0700)
Don't wait until the AST will be fired to do the LVB copy into the lock
resource.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/ocfs2/dlm/dlmast.c
fs/ocfs2/dlm/dlmconvert.c

index 87ee29cad50b3426a4c8956a318f1d9f6cbfb4cd..42775e2bbe2c7fdda96936f1d056279af60f7de6 100644 (file)
@@ -197,12 +197,14 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
                                  lock->ml.node == dlm->node_num ? "master" :
                                  "remote");
                        memcpy(lksb->lvb, res->lvb, DLM_LVB_LEN);
-               } else if (lksb->flags & DLM_LKSB_PUT_LVB) {
-                       mlog(0, "setting lvb from lockres for %s node\n",
-                                 lock->ml.node == dlm->node_num ? "master" :
-                                 "remote");
-                       memcpy(res->lvb, lksb->lvb, DLM_LVB_LEN);
                }
+               /* Do nothing for lvb put requests - they should be done in
+                * place when the lock is downconverted - otherwise we risk
+                * racing gets and puts which could result in old lvb data
+                * being propagated. We leave the put flag set and clear it
+                * here. In the future we might want to clear it at the time
+                * the put is actually done.
+                */
                spin_unlock(&res->spinlock);
        }
 
index 70888b31e751cd73cfaf8e416be56dc9329d0fe7..90cbaaff33a7f57931b6f1d8a6dac51b1532bddc 100644 (file)
@@ -214,6 +214,9 @@ grant:
        if (lock->ml.node == dlm->node_num)
                mlog(0, "doing in-place convert for nonlocal lock\n");
        lock->ml.type = type;
+       if (lock->lksb->flags & DLM_LKSB_PUT_LVB)
+               memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+
        status = DLM_NORMAL;
        *call_ast = 1;
        goto unlock_exit;