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

allow "lfs fid2path" on open-unlinked files

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • None
    • None
    • None
    • 9223372036854775807

    Description

      Running "lfs fid2path" on an open-unlinked file returns an error:

      # sleep 1000 < /mnt/testfs/hosts &
      # lctl get_param mdt.*.exports.*.open_files
      [0x200000401:0x4:0x0]
      # lfs fid2path /mnt/testfs [0x200000401:0x4:0x0]
      /mnt/testfs/hosts
      # rm /mnt/testfs/hosts
      # lfs fid2path /mnt/testfs [0x200000401:0x4:0x0]
      lfs fid2path: cannot find '0x200000401:0x4:0x0': No such file or directory
      

      This is not very useful if trying to find what file is consuming space.

      It would be more useful to return something different for open-unlinked files. The kernel prints the pathname followed by "(deleted)" at the end. All open files are linked to the client exports and once the FID is mapped to the inode we could determine which NID has the file open. It would be possible to print e.g. "NID (deleted)" or similar and that it is possible to go to that client to find the file in question:

      # lsof /mnt/testfs | grep "(deleted)"
      sleep   22669 root    0r   REG 526,308960      158 144115205272502276 /mnt/testfs/hosts (deleted)
      

      A more sophisticated approach would be to request the full pathname from the client, but that may not be practical.

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: