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

Joseph Qi joseph.qi at huawei.com
Thu Sep 8 19:13:50 PDT 2016


Hi Jun,
Currently ocfs2_encode_lockres can only support meta and super lockres.
And for meta lockres, we have to distinguish whether it is sysfile or
user file. For sysfile, generation should be applied in lockres name.

Thanks,
Joseph

On 2016/9/7 9:24, piaojun wrote:
> 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",
> 





More information about the Ocfs2-tools-devel mailing list