[LU-2935] layout swap on open unlinked file appears to succeed at first but does not Created: 08/Mar/13  Updated: 15/Oct/13  Resolved: 15/Oct/13

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0
Fix Version/s: Lustre 2.5.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: patch

Severity: 3
Rank (Obsolete): 7052

 Description   

Layout swap in which one file is unlinked after open appears to succeed, but the data in the remaining file will be unreadable after cache invalidation.

fd0 = open("f0", O_RDWR|O_CREAT, 0666);
fd1 = open("f1", O_RDWR|O_CREAT, 0666);
unlink("f1");
swap_layouts(fd0, fd1);
close(fd0);
close(fd1);
umount
mount
fd0 = open("f0", O_RDWR|O_CREAT, 0666);
read(fd0, buf, size); returns -ENOENT.
# llmount.sh
# cd /mnt/lustre
# echo 000 > f0
# echo 111 > f1
# exec 7<>f1
# rm f1
# lfs swap_layouts f0 /proc/self/fd/7
# exec 7>&-
# cat f0
111
# cat f0
111
# cat f0
111
# cat f1
cat: f1: No such file or directory
# cat f0
cat: f0: No such file or directory
# ls
f0
# stat f0
  File: `f0'
  Size: 4         	Blocks: 8          IO Block: 4194304 regular file
Device: 2c54f966h/743766374d	Inode: 144115205255725073  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-03-08 14:32:29.000000000 -0600
Modify: 2013-03-08 14:32:29.000000000 -0600
Change: 2013-03-08 14:32:29.000000000 -0600
# cat f0
cat: f0: No such file or directory
# strace cat f0
execve("/bin/cat", ["cat", "f0"], [/* 36 vars */]) = 0
...
open("f0", O_RDONLY)                    = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
...
read(3, 0x7f4ef153f000, 4194304)        = -1 ENOENT (No such file or directory)
...


 Comments   
Comment by Swapnil Pimpale (Inactive) [ 09/Aug/13 ]

Hi John,

I am not able to reproduce this with the given steps on latest master.
Is this issue fixed?

Comment by Swapnil Pimpale (Inactive) [ 09/Aug/13 ]

Hi,

The following is the console output:

# llmount.sh
# cd /mnt/lustre
# echo 000 > f0
# echo 111 > f1
# exec 7<>f1
# rm f1
# lfs swap_layouts f0 /proc/self/fd/7
# exec 7>&-
# cat f0
111
# cat f0
111
# cat f0
111
# cat f1
cat: f1: No such file or directory
# cat f0
111
# cat f0
111
# cat f0
111
# echo 3 > /proc/sys/vm/drop_caches
# cat f0
111
# umount
# mount
# cd /mnt/lustre
# cat f0
111
Comment by John Hammond [ 09/Aug/13 ]

Hi Swapnil, thanks for investigating.

I concur. This issue was probably resolved by Lai's work on LU-3125.

Would you like to add a regression test to sanity.sh?

Comment by Swapnil Pimpale (Inactive) [ 09/Aug/13 ]

Sure. I will do that.

Comment by Swapnil Pimpale (Inactive) [ 12/Aug/13 ]

Hi John,

I have added a regression test to sanity.sh
The patch is here (http://review.whamcloud.com/#/c/7301)

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