[LU-14422] lfs setstripe -c '' removes pool allocation Created: 11/Feb/21  Updated: 11/Jun/22  Resolved: 11/Jun/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.10.8, Lustre 2.12.6
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Minor
Reporter: Andrew Elwell Assignee: Zhenyu Xu
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

One of our user groups was setting lfs setstripe -c "$STRIPE_COUNT" in a script and not checking the variable existed. Therefore at some point they managed to run the equivalent of

lfs setstripe -c ""

Testcase (Client: cray-lustre-default-2.7.5.13_4.4.180-6.0.7.1_16.13__gddebdf5c6.x86_64, Server: 2.10.8)

whi550@galaxy-1 [2021-02-04 13:26] /askapbuffer/payne/whi550/testing> mkdir lfs_testing
whi550@galaxy-1 [2021-02-04 13:26] /askapbuffer/payne/whi550/testing> cd lfs_testing
whi550@galaxy-1 [2021-02-04 13:26] /askapbuffer/payne/whi550/testing/lfs_testing> lfs getstripe .
.
stripe_count:   1 stripe_size:    1048576 stripe_offset:  -1 pool:           processing
whi550@galaxy-1 [2021-02-04 13:26] /askapbuffer/payne/whi550/testing/lfs_testing> lfs setstripe -c "" .
whi550@galaxy-1 [2021-02-04 13:26] /askapbuffer/payne/whi550/testing/lfs_testing> lfs getstripe .
.
stripe_count:   1 stripe_size:    1048576 stripe_offset:  -1

testcase on 2.12. (lustre-client-2.12.5-1.x86_64, server lustre-2.12.6-1.el7.x86_64)

set up pools on server:

[root@pgfs-mds4 ~]# mount /dev/mapper/TEST_MGT
[root@pgfs-mds4 ~]# mount /dev/mapper/TEST_OST0000
[root@pgfs-mds4 ~]# mount /dev/mapper/TEST_OST0001
[root@pgfs-mds4 ~]# mount /dev/mapper/TEST_MDT0000
[root@pgfs-mds4 ~]# lctl pool_list testfs
Pools from testfs:
[root@pgfs-mds4 ~]# lctl pool_new testfs.ost0
Pool testfs.ost0 created
[root@pgfs-mds4 ~]# lctl pool_new testfs.ost1
Pool testfs.ost1 created
[root@pgfs-mds4 ~]# lctl pool_add testfs.ost0 testfs-OST0000
OST testfs-OST0000_UUID added to pool testfs.ost0
[root@pgfs-mds4 ~]# lctl pool_add testfs.ost1 testfs-OST0001
OST testfs-OST0001_UUID added to pool testfs.ost1
[root@pgfs-mds4 ~]# rpm -q lustre
lustre-2.12.6-1.el7.x86_64

and the client:

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$ lfs getstripe .
.
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$ lfs setstripe -c "" .
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$ lfs getstripe .
.
stripe_count:  1 stripe_size:   1048576 pattern:       0 stripe_offset: -1

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$


 Comments   
Comment by Andrew Elwell [ 11/Feb/21 ]

I tried to submit this with the original subject of
lfs setstripe -c "" removes pool allocation

.. but Jira wouldn't accept it.

Comment by Andreas Dilger [ 11/Feb/21 ]

Have you tried with a newer client? Essentially, "setstripe with totally empty layout" means "delete layout". However, there were improvements since 2.7 that allow partial layout inheritance from the parent directory, so it may be that this problem is already fixed.

Comment by Andrew Elwell [ 11/Feb/21 ]

Yes - the /testfs testcase was a 2.12.6 client against a 2.12.6 server - it doesn't iherit from parent

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell$ lfs setstripe -p ost0 dir1/
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell$ cd dir1
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$ lfs getstripe .
.
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1$ mkdir -p foo/bar
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$ cd foo/bar
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$ pwd
/testfs/pawsey0001/aelwell/dir1/foo/bar
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$ lfs getstripe . .. ../..
.
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

../..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$ lfs setstripe -c "" .
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$ lfs getstripe . .. ../..
.
stripe_count:  1 stripe_size:   1048576 pattern:       0 stripe_offset: -1

..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

../..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo/bar$

Comment by Andrew Elwell [ 11/Feb/21 ]

The good news is that it at least doesn't recursively remove pool info below - however newly created dirs inherit the now blank pool info

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$ lfs getstripe .. bar/
..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

../foo
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

bar/
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$ lfs setstripe -c "" .
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$ lfs getstripe .. bar/
..
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

../foo
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1

bar/
stripe_count:  1 stripe_size:   1048576 pattern:       raid0 stripe_offset: -1 pool:          ost0

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$ mkdir baz
aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$ lfs getstripe baz
baz
stripe_count:  1 stripe_size:   1048576 pattern:       0 stripe_offset: -1

aelwell@hpc-admin2:/testfs/pawsey0001/aelwell/dir1/foo$

I had seen LU-8264 when hunting for similar cases, but there was nothing else obvious

Comment by Gerrit Updater [ 01/Mar/21 ]

Bobi Jam (bobijam@hotmail.com) uploaded a new patch: https://review.whamcloud.com/41793
Subject: LU-14422 utils: check empty stripe count setting
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 6afe84900669bd1e4fe381bac20a783c09fae73d

Comment by Gerrit Updater [ 11/Jun/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/41793/
Subject: LU-14422 utils: check empty stripe-count/offset setting
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 50a7921471298fdc3a28107e7f026504db784aa5

Comment by Peter Jones [ 11/Jun/22 ]

Landed for 2.16

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