Details
-
Bug
-
Resolution: Fixed
-
Minor
-
Lustre 2.10.0
-
3
-
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 =