Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-946

add lprocfs file on MDT to list open files in the filesystem

Details

    • 5
    • 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".

      Attachments

        Issue Links

          Activity

            [LU-946] add lprocfs file on MDT to list open files in the filesystem
            emoly.liu Emoly Liu added a comment -

            Patch landed for 2.6

            emoly.liu Emoly Liu added a comment - Patch landed for 2.6

            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.

            adilger Andreas Dilger added a comment - 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.

            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

            gshilamkar Girish Shilamkar (Inactive) added a comment - 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
            emoly.liu Emoly Liu added a comment -

            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.

            emoly.liu Emoly Liu added a comment - 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.

            Hello,

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

            Regards,
            Girish

            gshilamkar Girish Shilamkar (Inactive) added a comment - Hello, I have started working on this ticket but don't have permissions to assign it to myself. Regards, Girish
            adilger Andreas Dilger added a comment - - edited

            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).

            adilger Andreas Dilger added a comment - - edited 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).

            People

              emoly.liu Emoly Liu
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: