Details
-
Bug
-
Resolution: Fixed
-
Minor
-
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.
"Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/59274
Subject:
LU-18860mdd: fix CLF_UNLINK_LAST on open file unlinkProject: fs/lustre-release
Branch: b2_15
Current Patch Set: 1
Commit: 0235ed70d8256275e8fac7b29cac69bf615da222