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

Unlink does not set properly CLF_UNLINK_LAST changelog flag

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.17.0
    • None
    • 3
    • 9223372036854775807

    Description

      Lustre should emit a CL_UNLINK changelog with CLF_UNLINK_LAST flag if the last link of a file is removed. But if the file is open on a client, this is not happening.
      This confuses the robinhood changelog reader: it does not remove the inode entry in the database for that case.

      Working case

      [root@dev lustre]# lfs changelog_clear lustre-MDT0000 cl1 0
      [root@dev lustre]# lfs changelog lustre-MDT0000                                                                        
      [root@dev lustre]# 
      [root@dev lustre]# touch test
      [root@dev lustre]# ln test link
      [root@dev lustre]# unlink test
      [root@dev lustre]# unlink link
      

      Changelog:

      16 01CREAT 22:40:29.374818949 2025.03.27 0x0 t=[0x200000402:0xa:0x0] j=touch.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] test
      17 11CLOSE 22:40:29.378415970 2025.03.27 0x42 t=[0x200000402:0xa:0x0] j=touch.0 ef=0xf u=0:0 nid=0@lo
      18 03HLINK 22:40:38.076554006 2025.03.27 0x0 t=[0x200000402:0xa:0x0] j=ln.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] link
      19 06UNLNK 22:40:58.921224020 2025.03.27 0x0 t=[0x200000402:0xa:0x0] j=unlink.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] test
      20 06UNLNK 22:41:04.842415511 2025.03.27 0x1 t=[0x200000402:0xa:0x0] j=unlink.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] link
      

      The flag CLF_UNLINK_LAST (0x1) is set for the last unlink

      Reproducer

      [root@dev lustre]# touch test
      [root@dev lustre]# ln test link
      [root@dev lustre]# tail -f test &
      [3] 20213
      [root@dev lustre]# unlink test
      [root@dev lustre]# unlink link
      [root@dev lustre]# fg
      tail -f test
      ^C
      

      Changelog:

      21 01CREAT 22:46:47.067992987 2025.03.27 0x0 t=[0x200000402:0xb:0x0] j=touch.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] test
      22 11CLOSE 22:46:47.073296359 2025.03.27 0x42 t=[0x200000402:0xb:0x0] j=touch.0 ef=0xf u=0:0 nid=0@lo
      23 03HLINK 22:46:50.963344725 2025.03.27 0x0 t=[0x200000402:0xb:0x0] j=ln.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] link
      24 06UNLNK 22:47:25.655733670 2025.03.27 0x0 t=[0x200000402:0xb:0x0] j=unlink.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] test
      25 06UNLNK 22:47:30.061160556 2025.03.27 0x0 t=[0x200000402:0xb:0x0] j=unlink.0 ef=0xf u=0:0 nid=0@lo p=[0x200000007:0x1:0x0] link
      

      The flag CLF_UNLINK_LAST (0x1) is not set for the last unlink.

      Attachments

        Activity

          [LU-18860] Unlink does not set properly CLF_UNLINK_LAST changelog flag

          "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/59274
          Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink
          Project: fs/lustre-release
          Branch: b2_15
          Current Patch Set: 1
          Commit: 0235ed70d8256275e8fac7b29cac69bf615da222

          gerrit Gerrit Updater added a comment - "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/59274 Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink Project: fs/lustre-release Branch: b2_15 Current Patch Set: 1 Commit: 0235ed70d8256275e8fac7b29cac69bf615da222
          pjones Peter Jones added a comment -

          Merged for 2.17

          pjones Peter Jones added a comment - Merged for 2.17

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/58578/
          Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: 67c0c58800d6ca2fc71578c9be415b4d0a774c5a

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/58578/ Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink Project: fs/lustre-release Branch: master Current Patch Set: Commit: 67c0c58800d6ca2fc71578c9be415b4d0a774c5a

          "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/58578
          Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: ddfd9f420619130f3f9fcfd55c09c81674830a4a

          gerrit Gerrit Updater added a comment - "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/58578 Subject: LU-18860 mdd: fix CLF_UNLINK_LAST on open file unlink Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: ddfd9f420619130f3f9fcfd55c09c81674830a4a

          People

            eaujames Etienne Aujames
            eaujames Etienne Aujames
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: