[LU-946] add lprocfs file on MDT to list open files in the filesystem Created: 20/Dec/11  Updated: 21/Feb/14  Resolved: 13/Jan/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.6.0, Lustre 2.5.1

Type: Improvement Priority: Minor
Reporter: Andreas Dilger Assignee: Emoly Liu
Resolution: Fixed Votes: 0
Labels: patch

Issue Links:
Related
is related to LU-3223 allow "lfs fid2path" to handle multip... Resolved
is related to LU-4429 clients leaking open handles/bad lock... Resolved
Story Points: 5
Rank (Obsolete): 7881

 Description   

Several customers have asked for the ability to list open files on the whole filesystem. Currently this is only possible to do on the clients by running "lsof" but is impractical to do.

This would likely be implemented by walking all of the client exports and then listing all of the objects in med_open_head as NID_FID pairs. Userspace could then sort/print the open files as desired using "lfs fid2path".



 Comments   
Comment by Andreas Dilger [ 25/Apr/13 ]

This would ideally be available on the MDS per-export in /proc/fs/lustre/mdt/$fsname-MDTnnnn/exports/$NID/open_files with just a FID list. Userspace could just do lctl get_param mdt.$fsname-MDTnnnn.exports.$NID.open_files and pipe that to lfs fid2path (with my patch in http://review.whamcloud.com/6160 in LU-3223 to handle multiple FIDs on the command-line).

Comment by Girish Shilamkar (Inactive) [ 03/May/13 ]

Hello,

I have started working on this ticket but don't have permissions to assign it to myself.

Regards,
Girish

Comment by Emoly Liu [ 07/May/13 ]

Girish, it says the user doesn't exist. Anyway, you can push your patch to gerrit and paste the link here.

If you don't mind, I'd like to assign to me and take care of the patch.

Comment by Girish Shilamkar (Inactive) [ 15/May/13 ]

Andreas,

med_open_head is list of mdt_file_data objects. And struct mdt_file_data is an internal structure to mdt. So we cannot walk med_open_head from obdclass(lprocfs_status.c) using this linked list. We could have had a function in mdt to return lu_object for a given mdt_file_data object but that would make odbclass module dependent on mdt. (mdt is already used by obdclass)
So the only option I see is to export list of open lu_objects/md_objects, structs which are known by obdclass. Please advise.

Other than this layering issue the patch is ready with a testcase.
Thanks,
Girish

Comment by Andreas Dilger [ 15/May/13 ]

Girish,
there is no requirement for the proc file handling to be in obdclass. That is just for common routines shared among multiple modules. Typically each module has its own "mdt_lproc.c" or similar, which has data specific to the module. In this case, the open_file setup should go into the per-export directory /proc/fs/lustre/mdt/*/exports/open_files, created under the mdt_export_stats_init() function.

Comment by Girish Shilamkar (Inactive) [ 19/May/13 ]

http://review.whamcloud.com/6386

Comment by Emoly Liu [ 13/Jan/14 ]

Patch landed for 2.6

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