[LU-5155] Need a way to map ZFS OSD objects to Lustre filenames Created: 06/Jun/14  Updated: 17/Mar/15  Resolved: 17/Mar/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.8.0

Type: Improvement Priority: Major
Reporter: Christopher Morrone Assignee: Alex Zhuravlev
Resolution: Fixed Votes: 0
Labels: zfs

Rank (Obsolete): 14223

 Description   

We would like a way to map object numbers in ZFS back to filenames in the Lustre filesystem.

This will be useful in a number of cases, but a common one will be when ZFS detects corrupt files, and we need to figure out which Lustre file is effected.



 Comments   
Comment by Peter Jones [ 06/Jun/14 ]

Hi Alex

Could you please advise on this one?

Thanks

Peter

Comment by Andreas Dilger [ 07/Jun/14 ]

This should hopefully be pretty easy. Each OST object holds the parent MDT inode FID in the "fid" xattr and then "lfs fid2path /mount $(parent FID)" can be used to generate the pathname on the on any client.

On ldiskfs it is possible to access the "fid" xattr on a mounted OST via:

debugfs -c -R 'stat /O/$seq/d$((oid % 32))/$oid' /dev/ostdev

or on the ldiskfs-mounted OST filesystem via the ll_decode_filter_fid utility.

On ZFS it is possible that ll_decode_filter_fid may work, but it isn't possible to mount the OST concurrently between Lustre and ZPL to access the fid xattr on an object.

It might be possible to extend the "FID2PATH" ioctl interface to do the OST FID to MDT parent FID mapping directly from the client and have it continue to generate the full path, but I wouldn't want to commit to that without first looking at the code in detail.

Another less complex option would be to extend l_decode_filter_fid to do an ioctl locally on the OST to look up the MDT parent FID so that it can be used by fid2path.

Comment by Christopher Morrone [ 26/Jun/14 ]

Thanks, I was able to get the fid from the xattr using zdb. I made a little python script to call zdb and convert the string into standard Lustre FID text form. It is here for reference:

https://raw.githubusercontent.com/chaos/lustre-tools-llnl/1.8/scripts/zfsobj2fid

Comment by Gerrit Updater [ 10/Feb/15 ]

Isaac Huang (he.huang@intel.com) uploaded a new patch: http://review.whamcloud.com/13721
Subject: LU-5155 scripts: added contrib/scripts/zfsobj2fid.py
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: e27d0ae3328fbccf5a250bee0ad26dc2c9fc4621

Comment by Andreas Dilger [ 10/Feb/15 ]

A better long-term solution would be to extend the fid2path code to accept an OST object FID directly, have it fetch the trusted.fid xattr from the OST object (possibly at the MDS via OUT RPC as LFSCK does), extract the parent inode FID, and proceed with normal fid2path processing (maybe returning -EREMOTE to the client if the inode FID is on a different MDT and continuing on a different MDT).

Comment by Gerrit Updater [ 11/Mar/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/13721/
Subject: LU-5155 scripts: added lustre/scripts/zfsobj2fid
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 2ccda307213e93439fb3e182eb2618f8dac21419

Comment by Peter Jones [ 17/Mar/15 ]

Landed for 2.8

Generated at Sat Feb 10 01:49:00 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.