[LU-1546] stat returns link count 1 for unlinked but open files Created: 20/Jun/12  Updated: 18/Apr/13  Resolved: 18/Apr/13

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.3.0, Lustre 2.1.2
Fix Version/s: Lustre 2.4.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: Zhenyu Xu
Resolution: Fixed Votes: 0
Labels: patch
Environment:
  1. uname -r
    2.6.32-220.13.1.el6.l22.x86_64
  2. cat /proc/fs/lustre/version
    lustre: 2.2.55
    kernel: patchless_client
    build: 2.2.55-gef32640-CHANGED-2.6.32-220.13.1.el6.l22.x86_64

Severity: 3
Rank (Obsolete): 7792

 Description   

An open file with no links reports link count 1, even 1 hour after the unlink(). I believe the issue is that the PENDING link is being erroneously reported to the client.

# cd /mnt/lustre
# ls -a
.  ..  .lustre
# touch FILE
# stat FILE
  File: `FILE'
  Size: 0               Blocks: 0          IO Block: 2097152 regular empty file
Device: 2c54f966h/743766374d    Inode: 144115205255725057  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-06-20 12:51:48.000000000 -0500
Modify: 2012-06-20 12:51:48.000000000 -0500
Change: 2012-06-20 12:51:48.000000000 -0500
# exec 3<FILE
# stat -L /proc/self/fd/3
  File: `/proc/self/fd/3'
  Size: 0               Blocks: 0          IO Block: 2097152 regular empty file
Device: 2c54f966h/743766374d    Inode: 144115205255725057  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-06-20 12:51:48.000000000 -0500
Modify: 2012-06-20 12:51:48.000000000 -0500
Change: 2012-06-20 12:51:48.000000000 -0500
# rm FILE
# stat -L /proc/self/fd/3
  File: `/proc/self/fd/3'
  Size: 0               Blocks: 0          IO Block: 2097152 regular empty file
Device: 2c54f966h/743766374d    Inode: 144115205255725057  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-06-20 12:51:48.000000000 -0500
Modify: 2012-06-20 12:51:48.000000000 -0500
Change: 2012-06-20 12:52:33.000000000 -0500
# lsof /mnt/lustre
COMMAND   PID USER   FD   TYPE      DEVICE SIZE/OFF               NODE NAME
bash     5579 root  cwd    DIR 1273,181606     4096              25003 /mnt/lustre
bash     5579 root    3r   REG 1273,181606        0 144115205255725057 /mnt/lustre/FILE (deleted)
lsof    10806 root  cwd    DIR 1273,181606     4096              25003 /mnt/lustre
lsof    10807 root  cwd    DIR 1273,181606     4096              25003 /mnt/lustre
# sleep 3600
# stat -L /proc/self/fd/3
  File: `/proc/self/fd/3'
  Size: 0               Blocks: 0          IO Block: 2097152 regular empty file
Device: 2c54f966h/743766374d    Inode: 144115205255725057  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-06-20 12:51:48.000000000 -0500
Modify: 2012-06-20 12:51:48.000000000 -0500
Change: 2012-06-20 12:52:33.000000000 -0500


 Comments   
Comment by John Hammond [ 20/Jun/12 ]

Please see http://review.whamcloud.com/3154.

Comment by John Hammond [ 28/Feb/13 ]

Patch landed.

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