[LU-14180] "lfs setstripe -E" doesn't validate component end Created: 04/Dec/20  Updated: 04/Mar/21  Resolved: 26/Feb/21

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.10.8, Lustre 2.14.0, Lustre 2.12.5
Fix Version/s: Lustre 2.15.0

Type: Bug Priority: Major
Reporter: Andreas Dilger Assignee: Jian Yu
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
Related
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

The "lfs setstripe -E" option does not validate the component_end value, allowing files with invalid layouts to be created. For example:

$ lfs setstripe -E 128 -c 1 /mnt/testfs/badfile
lfs setstripe: cannot create composite file '/mnt/testfs/badfile': Invalid argument
$ ls -l /mnt/testfs
ls: cannot access /mnt/testfs/badfile: Invalid argument
? -?????????? ? ?            ?             ?     badfile

This also generates errors on the console reporting the invalid stripe count:

LustreError: 23302:0:(lov_ea.c:115:lsm_lmm_verify_v1v3()) lov: bad stripe size 128: rc = -22
Lustre: 23303:0:(lov_pack.c:58:lov_dump_lmm_common()) objid 0xc:5025, magic 0x0bd30bd0, pattern 0x1
Lustre: 23303:0:(lov_pack.c:62:lov_dump_lmm_common()) stripe_size 128, stripe_count 1, layout_gen 0
LustreError: 23303:0:(lcommon_cl.c:194:cl_file_inode_init()) testfs: failed to initialize cl_object [0x4000013a1:0xc:0x0]: rc = -22
LustreError: 23303:0:(llite_lib.c:2491:ll_prep_inode()) new_inode -fatal: rc -22

The setstripe command reported an error, but the file was actually created and is inaccessible and unremovable by normal unlink() operations. Using "lfs rmfid" allows the file to be unlinked from the filesystem:

$ rm /mnt/testfs/badfile
rm: cannot remove '/mnt/testfs/badfile': Invalid argument
$ unlink /mnt/testfs/badfile
unlink: cannot remove '/mnt/testfs/badfile': Invalid argument
$ lfs rmfid /mnt/testfs $(lfs getstripe -F /mnt/testfs/badfile)
$


 Comments   
Comment by Peter Jones [ 24/Dec/20 ]

Jian

Could you please assist with this one?

Thanks

Peter

Comment by Andreas Dilger [ 05/Jan/21 ]

I pushed an unfinished version of a patch that I was working on for this issue when I accidentally made an unrelated patch on the same branch.

It totally failed testing, but might be worthwhile for Jian to use as a starting point when she has time to look at this.

Comment by Gerrit Updater [ 16/Jan/21 ]

Jian Yu (yujian@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/41239
Subject: LU-14180 utils: verify setstripe comp_end is valid
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: e8b86175464e66eaa753b9ed853a84b1d8af894e

Comment by Gerrit Updater [ 26/Feb/21 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/41239/
Subject: LU-14180 utils: verify setstripe comp_end is valid
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 83e38bba6237f838c9a5d7d36b258cf6dd28bd13

Comment by Peter Jones [ 26/Feb/21 ]

Landed for 2.15

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