[LU-10462] lfs setstripe --component-add fails to recognize -c -1 as all targets Created: 05/Jan/18  Updated: 02/Feb/18  Resolved: 25/Jan/18

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

Type: Bug Priority: Minor
Reporter: Giuseppe Di Natale (Inactive) Assignee: Zhenyu Xu
Resolution: Fixed Votes: 0
Labels: llnl, patch

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

 Description   

Performing a 'lfs setstripe --component-add -E <val> -c -1 <file>' on a file with an existing layout yields a new component that is striped with the default stripe count and not a stripe across all targets. Output below.

[root@silverrock8:lustre]# lfs setstripe -E 2M -c 1 /p/lglossy/root/dne2/dinatale/testfile13
[root@silverrock8:lustre]# lfs getstripe /p/lglossy/root/dne2/dinatale/testfile13
/p/lglossy/root/dne2/dinatale/testfile13
  lcm_layout_gen:  1
  lcm_entry_count: 1
    lcme_id:             1
    lcme_flags:          init
    lcme_extent.e_start: 0
    lcme_extent.e_end:   2097152
      lmm_stripe_count:  1
      lmm_stripe_size:   1048576
      lmm_pattern:       1
      lmm_layout_gen:    0
      lmm_stripe_offset: 1
      lmm_objects:
      - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x53242:0x0] }

[root@silverrock8:lustre]# lfs setstripe --component-add -E 4M -c -1 /p/lglossy/root/dne2/dinatale/testfile13
[root@silverrock8:lustre]# lfs getstripe /p/lglossy/root/dne2/dinatale/testfile13
/p/lglossy/root/dne2/dinatale/testfile13
  lcm_layout_gen:  2
  lcm_entry_count: 2
    lcme_id:             1
    lcme_flags:          init
    lcme_extent.e_start: 0
    lcme_extent.e_end:   2097152
      lmm_stripe_count:  1
      lmm_stripe_size:   1048576
      lmm_pattern:       1
      lmm_layout_gen:    0
      lmm_stripe_offset: 1
      lmm_objects:
      - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x53242:0x0] }

    lcme_id:             2
    lcme_flags:          0
    lcme_extent.e_start: 2097152
    lcme_extent.e_end:   4194304
      lmm_stripe_count:  1
      lmm_stripe_size:   1048576
      lmm_pattern:       1
      lmm_layout_gen:    65535
      lmm_stripe_offset: -1

In the above output, you'll notice the second component has a lmm_stripe_count of 1, our test file system has 4 OSTs.

I believe I tracked down the issue to 'lod_declare_layout_add' and how it's setting stripe count for each new component. A similar fix may need to happen to 'lod_striping_from_default' for regular files as well. If the below patch seems adequate, I can open a new patch. I can also update the patch with 'lod_striping_from_default' changes if it seems necessary.

diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c
index 34f4f2c..5fe2f72 100644
--- a/lustre/lod/lod_object.c
+++ b/lustre/lod/lod_object.c
@@ -2267,9 +2267,10 @@ static int lod_declare_layout_add(const struct lu_env *env,
                lod_comp->llc_stripe_offset = v1->lmm_stripe_offset;
 
                lod_comp->llc_stripenr = v1->lmm_stripe_count;
-               if (!lod_comp->llc_stripenr ||
-                   lod_comp->llc_stripenr == (__u16)-1)
+               if (!lod_comp->llc_stripenr)
                        lod_comp->llc_stripenr = desc->ld_default_stripe_count;
+               else if (lod_comp->llc_stripenr == (__u16)-1)
+                       lod_comp->llc_stripenr = desc->ld_tgt_count;
                lod_comp->llc_stripe_size = v1->lmm_stripe_size;
                if (!lod_comp->llc_stripe_size)
                        lod_comp->llc_stripe_size =

 


 Comments   
Comment by Peter Jones [ 05/Jan/18 ]

Bobijam

Can you please look into this one?

Thanks

Peter

Comment by Zhenyu Xu [ 06/Jan/18 ]

yes, I think the patch is the fix, and lod_striping_from_default() also needs it.

Comment by Peter Jones [ 06/Jan/18 ]

So, dinatale2 will you push a patch into Gerrit for this fix or would you prefer that Bobijam handles it?

Comment by Giuseppe Di Natale (Inactive) [ 06/Jan/18 ]

Peter, I will post a patch on Monday.

Comment by Gerrit Updater [ 09/Jan/18 ]

Giuseppe Di Natale (dinatale2@llnl.gov) uploaded a new patch: https://review.whamcloud.com/30790
Subject: LU-10462 lod: Correct lfs --component-add striping
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: be53389806e9717227a45f9c468936bfb0963511

Comment by Gerrit Updater [ 25/Jan/18 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/30790/
Subject: LU-10462 lod: Correct lfs --component-add striping
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b7285d387c78fbd11579c577230593ba1b0be84e

Comment by Peter Jones [ 25/Jan/18 ]

Landed for 2.11

Comment by Gerrit Updater [ 26/Jan/18 ]

Minh Diep (minh.diep@intel.com) uploaded a new patch: https://review.whamcloud.com/31048
Subject: LU-10462 lod: Correct lfs --component-add striping
Project: fs/lustre-release
Branch: b2_10
Current Patch Set: 1
Commit: 7ecef66cdf67999beb26b680c7bb73fb1c63c52b

Comment by Gerrit Updater [ 02/Feb/18 ]

John L. Hammond (john.hammond@intel.com) merged in patch https://review.whamcloud.com/31048/
Subject: LU-10462 lod: Correct lfs --component-add striping
Project: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: 50021977720a419f6df809ee43cdf687bc9f0877

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