[LU-14489] "lfs find --mdt-count +1" fails with "Operation not permitted" Created: 05/Mar/21  Updated: 17/Sep/21  Resolved: 22/Jun/21

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

Type: Bug Priority: Major
Reporter: Andreas Dilger Assignee: Lai Siyao
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by LU-14574 lfs find --mdt-count doesn't work on ... Closed
Related
is related to LU-14507 'lfs getdirstripe -D' prints stripe c... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

It appears that "lfs find $MOUNT -type d --mdt-count +1" aborts when it hits non-striped directories rather than ignoring the error and continuing to search the directory tree:

# lfs find /mnt/testfs -type d --mdt-count +1
lfs: failed for '/mnt/testfs': Operation not permitted
# lfs mkdir -c 2 /mnt/testfs/dne
# lfs find /mnt/testfs/dne -type d --mdt-count +1
/mnt/testfs/dne
# mkdir /mnt/testfs/dne/nondne
# lfs find /mnt/testfs/dne -type d --mdt-count +1
/mnt/testfs/dne
lfs: failed for '/mnt/testfs/dne': Operation not permitted

Running strace on the find shows that it is returning -61 = ENODATA:

open("/mnt/testfs/dne", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
open("/mnt/testfs/dne", O_RDONLY|O_NONBLOCK|O_NOFOLLOW) = 4
close(3)                                = 0
ioctl(4, LL_IOC_LMV_GETSTRIPE, 0x1751170) = 0
ioctl(4, LL_IOC_MDC_GETINFO_V2, 0x1741040) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 4), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5
write(1, "/mnt/testfs/dne\n", 16)       = 16
/mnt/testfs/dne
fstat(4, {st_mode=S_IFDIR|0755, st_size=8192, ...}) = 0
fcntl(4, F_GETFL)                       = 0x28800 (flags O_RDONLY|O_NONBLOCK|O_L
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
getdents(4, /* 3 entries */, 32768)     = 80
open("/mnt/testfs/dne/nondne", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 3
open("/mnt/testfs/dne/nondne", O_RDONLY|O_NONBLOCK|O_NOFOLLOW) = 5
close(3)                                = 0
ioctl(5, LL_IOC_LMV_GETSTRIPE, 0x1751170) = -1 ENODATA
close(5)                                = 0
getdents(4, /* 0 entries */, 32768)     = 0
close(4)                                = 0
write(2, "lfs: failed for '/mnt/testfs/dne"..., 59) = 59
lfs: failed for '/mnt/testfs/dne


 Comments   
Comment by Andreas Dilger [ 05/Mar/21 ]

I suspect that this just needs a simple fix to "lfs find" to handle the -ENODATA properly.

Comment by Peter Jones [ 05/Mar/21 ]

Lai

Could you please advise on this one?

Thanks

Peter

Comment by Gerrit Updater [ 28/May/21 ]

Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/43866
Subject: LU-14489 utils: fix 'lfs find --mdt-count'
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 3bd3e6dc6691e42742074878046d6abaa12d3772

Comment by Gerrit Updater [ 21/Jun/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/43866/
Subject: LU-14489 utils: fix 'lfs find --mdt-count'
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: baba1fd07a977a62295482919e9218f877c0535a

Comment by Peter Jones [ 22/Jun/21 ]

Landed for 2.15

Generated at Sat Feb 10 03:10:12 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.