[LU-9369] lfs find can't work correctly Created: 20/Apr/17  Updated: 09/May/17  Resolved: 09/May/17

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

Type: Bug Priority: Minor
Reporter: Emoly Liu Assignee: Emoly Liu
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

This issue can be reproduced by the following steps:

mkdir /mnt/lustre/dir1
mkdir /mnt/lustre/dir2
lfs setstripe -c 3 /mnt/lustre/dir1/file
lfs setstripe -c 3 /mnt/lustre/dir2/file
lfs find /mnt/lustre -c 3

Then, you will see the output is

/mnt/lustre/dir1/file
/mnt/lustre/dir2
/mnt/lustre/dir2/file

I will create a fix.



 Comments   
Comment by Emoly Liu [ 28/Apr/17 ]

This issue is related to the PFL patch https://review.whamcloud.com/#/c/26391

Comment by Niu Yawei (Inactive) [ 28/Apr/17 ]

I think it could be an old bug, cb_find_init() mistakenly used previous file's lum for the next dir, because the dir doesn't have default layout. Old code happen to zeroed the stripe count every time, that's probably why 'lfs find -c' works for old code. I think other options such as 'lfs find -S' would fail on old code too. Could you verify this?

diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c
index 23691fb..42da570 100644
--- a/lustre/utils/liblustreapi.c
+++ b/lustre/utils/liblustreapi.c
@@ -3338,6 +3338,8 @@ static int cb_find_init(char *path, DIR *parent, DIR **dirp,
                        if (ret != 0)
                                return ret;
                }
+
+               param->fp_lmd->lmd_lmm.lmm_magic = 0;
                ret = get_lmd_info(path, parent, dir, param->fp_lmd,
                                   param->fp_lum_size);
                if (ret == 0 && param->fp_lmd->lmd_lmm.lmm_magic == 0 &&

I think above patch can fix the problem.

Comment by Emoly Liu [ 02/May/17 ]

Niu, thanks for your patch! It does fix this issue.

Comment by Gerrit Updater [ 02/May/17 ]

Emoly Liu (emoly.liu@intel.com) uploaded a new patch: https://review.whamcloud.com/26914
Subject: LU-9369 lfs: make lfs find work correctly
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 01ee10671587faab7a30284e78022f1a16a9e800

Comment by Gerrit Updater [ 09/May/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/26914/
Subject: LU-9369 lfs: make lfs find work correctly
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b0404c136240a578655554d37689b47b47ef5920

Comment by Peter Jones [ 09/May/17 ]

Landed for 2.10

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