[LU-7058] Hit "No such file or directory" error when migrating a dir ends with slash Created: 28/Aug/15  Updated: 07/Apr/20  Resolved: 07/Apr/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Sarah Liu Assignee: Steve Guminski (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: dne3, easy
Environment:

lustre-master build # 3142 RHEL6.6


Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

Hit error if migrate a dir ends with "/", non-slash works well.

[root@onyx-27 lustre]# lfs migrate -m 1 /mnt/lustre/other-dir/
/mnt/lustre/other-dir migrate failed: No such file or directory (-2)
error: migrate: migrate file '/mnt/lustre/other-dir/' failed
[root@onyx-27 lustre]# lfs migrate -m 1 /mnt/lustre/other-dir
[root@onyx-27 lustre]# 


 Comments   
Comment by Andreas Dilger [ 31/Aug/15 ]

I guess that the shell will auto-complete the directory name to have a trailing '/' so this could be hit fairly easily. I haven't looked at the code yet, but running strace lfs migrate -c 2 bat/ on my 2.5.3 system generates:

open("bat", O_RDONLY)                   = 3
ioctl(3, IPMICTL_SEND_COMMAND_SETTIME, 0x1ab0030) = -1 ENOENT (No such file or directory)
close(3)                                = 0
mmap(NULL, 1056768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f68a701f000
open("bat/.\f\23\24\22:VOLATILE::", O_WRONLY|O_CREAT|O_NOCTTY|O_ASYNC|0x1000000, 0644) = 3
ioctl(3, 0x4008669a, 0x7ffffdf058f0)    = 0
open("bat/", O_RDWR|O_DIRECT)           = -1 EISDIR (Is a directory)
write(2, "cannot open bat/ (Is a directory"..., 34cannot open bat/ (Is a directory)
) = 34
close(3)                                = 0
munmap(0x7f68a701f000, 1056768)         = 0
write(2, "error: migrate: migrate stripe f"..., 50error: migrate: migrate stripe file 'bat/' failed

so it looks like it doesn't detect that this is a directory and try to migrate the contents. However, it also doesn't work with lfs migrate -c 2 bat:

open(".", O_RDONLY)                     = 3
ioctl(3, IPMICTL_SEND_COMMAND_SETTIME, 0xab8030) = 0
close(3)                                = 0
getcwd("/myth/tmp", 4096)               = 10
open("/myth/tmp/.\f\23\24\22:VOLATILE::", O_WRONLY|O_CREAT|O_NOCTTY|O_ASYNC|0x1000000, 0644) = 3
ioctl(3, 0x4008669a, 0x7fff4a7e85e0)    = 0
open("bat", O_RDWR|O_DIRECT)            = -1 EISDIR (Is a directory)
write(2, "cannot open bat (Is a directory)"..., 33cannot open bat (Is a directory)
) = 33
close(3)                                = 0
write(2, "error: migrate: migrate stripe f"..., 49error: migrate: migrate stripe file 'bat' failed
) = 49

Is this changed with newer versions of lfs?

Comment by Andreas Dilger [ 14/Feb/17 ]

Steve, do you have the cycles to look into this one? It might just be a quick fix (e.g. drop trailing '/' from pathname if it is present).

Comment by Steve Guminski (Inactive) [ 15/Feb/17 ]

Sure, I'm just finishing up with another ticket, so I'll take a look at this one next.

Comment by Andreas Dilger [ 01/Nov/17 ]

Steve, any chance you could make a patch for this?

Comment by Steve Guminski (Inactive) [ 01/Nov/17 ]

It looks like the latest lfs still has problems migrating directories regardless of whether there is a trailing slash or not, as you discovered.  I'm looking into this now.

Comment by Gerrit Updater [ 20/Nov/17 ]

Steve Guminski (stephenx.guminski@intel.com) uploaded a new patch: https://review.whamcloud.com/30177
Subject: LU-7058 utils: Allow lfs migrate to operate on directories
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 14673ec012bc48391af47b38e8a7b42c1cde22c1

Comment by Andreas Dilger [ 07/Apr/20 ]

This works fine on master, not sure when it was fixed.

Generated at Sat Feb 10 02:05:38 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.