[Ocfs2-tools-devel] [PATCH] debugfs.ocfs2: encode lockname with generation only for 'W' and 'F' lock

piaojun piaojun at huawei.com
Tue Sep 6 18:24:25 PDT 2016


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
make lockname corresponding to the kernel code.

Signed-off-by: Jun Piao <piaojun at huawei.com>
---
 libocfs2/lockid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libocfs2/lockid.c b/libocfs2/lockid.c
index d46e24e..28fe50e 100644
--- a/libocfs2/lockid.c
+++ b/libocfs2/lockid.c
@@ -66,8 +66,8 @@ errcode_t ocfs2_encode_lockres(enum ocfs2_lock_type type, uint64_t blkno,
 		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;
+	generation = ((type == OCFS2_LOCK_TYPE_RW) ||
+		      (type == OCFS2_LOCK_TYPE_FLOCK)) ? generation : 0;
 
 	if (type != OCFS2_LOCK_TYPE_DENTRY) {
 		snprintf(lockres, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016"PRIx64"%08x",
-- 
1.8.4.3




More information about the Ocfs2-tools-devel mailing list