Skip to contentSkip to conversation

ocfs2/dlm: copy lvb from lksb only when it's meaningful

PATCH New Wengang Wang 2 participants 2 messages Aug 26, 2010 – Sep 10, 2010 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 ocfs2/dlm: copy lvb from lksb only when it's meaningful

Copies lvb from lksb only when it's meaningful(not NULL).

---
 fs/ocfs2/dlm/dlmrecovery.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +2 -1
index fa6e5ae..6d2e3ca 100644
@@ -1184,7 +1184,8 @@ static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock,
 		return;
 
 	if (dlm_lvb_is_empty(mres->lvb)) {
-		memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+		if (lock->lksb->lvb)
+			memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
 		return;
 	}
 
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 4/5 ocfs2/dlm: copy lvb from lksb only when it's meaningful

Quoted 13 lines · Wengang Wang

Copies lvb from lksb only when it's meaningful(not NULL).

---
  fs/ocfs2/dlm/dlmrecovery.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)
fs/ocfs2/dlm/dlmrecovery.c +0 -0
index fa6e5ae..6d2e3ca 100644

fs/ocfs2/dlm/dlmrecovery.c static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock, · line 1191

Quoted 9 lines
fs/ocfs2/dlm/dlmrecovery.c +2 -1
@@ -1184,7 +1184,8 @@ static void dlm_prepare_lvb_for_migration(struct dlm_lock *lock,
  		return;
 
  	if (dlm_lvb_is_empty(mres->lvb)) {
-		memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+		if (lock->lksb->lvb)
+			memcpy(mres->lvb, lock->lksb->lvb, DLM_LVB_LEN);
  		return;
  	}
 

Patches 3 and 4 can be merged.

Also, in prepare_lvb_for_migration, we should use the name to determine whether the locks should have lvb or not. If not, then just exit. If they do,
then BUG.