[Debian-ha-commits] [ocfs2-tools] 21/58: debugfs.ocfs2: encode 'M' lockname with generation only for sysfile

Valentin Vidic vvidic-guest at moszumanska.debian.org
Tue Jun 20 13:40:41 UTC 2017


This is an automated email from the git hooks/post-receive script.

vvidic-guest pushed a commit to branch upstream
in repository ocfs2-tools.

commit 6b21f2d74f527e3a2321ea745eeccd63864ffc61
Author: piaojun <piaojun at huawei.com>
Date:   Fri Sep 9 15:23:02 2016 +0800

    debugfs.ocfs2: encode 'M' lockname with generation only for sysfile
    
    I got the wrong lockname 'M000000000000000001a90276b7f60a' by encoding
    the inode of a regular file. So I could not resolve lockres info by
    'dlm_locks' command of debugfs.ocfs2. The right lockname should be
    'M000000000000000001a90200000000' with no generation at tail. We need
    encode 'M' lockname with generation only for sysfile.
    
    Signed-off-by: Jun Piao <piaojun at huawei.com>
    Reviewed-by: Joseph Qi <joseph.qi at huawei.com>
---
 debugfs.ocfs2/commands.c | 4 +++-
 libocfs2/lockid.c        | 4 ----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/debugfs.ocfs2/commands.c b/debugfs.ocfs2/commands.c
index 3d5518a..4e4ea7f 100644
--- a/debugfs.ocfs2/commands.c
+++ b/debugfs.ocfs2/commands.c
@@ -1673,7 +1673,9 @@ static void do_encode_lockres(char **args)
 				blkno);
 			return;
 		}
-		gen = inode->i_generation;
+
+		if (inode->i_flags & OCFS2_SYSTEM_FL)
+			gen = inode->i_generation;
 	}
 
 	ret = ocfs2_encode_lockres(type, blkno, gen, 0, lock);
diff --git a/libocfs2/lockid.c b/libocfs2/lockid.c
index d46e24e..ddc93b2 100644
--- a/libocfs2/lockid.c
+++ b/libocfs2/lockid.c
@@ -65,10 +65,6 @@ errcode_t ocfs2_encode_lockres(enum ocfs2_lock_type type, uint64_t blkno,
 	if (type >= OCFS2_NUM_LOCK_TYPES)
 		return OCFS2_ET_INVALID_LOCKRES;
 
-	blkno = (type == OCFS2_LOCK_TYPE_RENAME) ? 0 : blkno;
-	generation = ((type == OCFS2_LOCK_TYPE_SUPER) ||
-		      (type == OCFS2_LOCK_TYPE_RENAME)) ? 0 : generation;
-
 	if (type != OCFS2_LOCK_TYPE_DENTRY) {
 		snprintf(lockres, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016"PRIx64"%08x",
 			 ocfs2_lock_type_char(type), OCFS2_LOCK_ID_PAD,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/ocfs2-tools.git



More information about the Debian-HA-Commits mailing list