[LU-13424] unable to migrate mirrored files Created: 07/Apr/20  Updated: 14/Oct/22  Resolved: 23/Apr/20

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

Type: Bug Priority: Critical
Reporter: Andreas Dilger Assignee: Mikhail Pershin
Resolution: Fixed Votes: 0
Labels: dne3

Issue Links:
Related
is related to LU-13425 "run 'lfs migrate -m 1 -c 1 -H 3 dir1... Resolved
is related to LU-11025 DNE3: directory restripe Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

I created a subdirectory and put a mirrored file in it. When I tried to migrate the mirrored file to another MDT, it returned an error migrating the mirrored file that I didn't expect:

tests# lfs mkdir -i 0 /mnt/testfs/dir1
tests# cp /etc/hosts /mnt/testfs/dir1
tests# lfs mirror extend -N1 /mnt/testfs/dir1/hosts
tests# lfs migrate -m 1 /mnt/testfs/dir1
lfs migrate: /mnt/testfs/dir1/hosts migrate failed: Operation not supported (95)
tests# lfs getstripe -m /mnt/testfs/dir1
1
tests# lfs getstripe -m /mnt/testfs/dir1/hosts
0

So it seems like the directory was migrated, but the mirrored file was not. Is there some reason that the mirrored file could not be migrated? I don't think that should be any different than migrating some other composite file.



 Comments   
Comment by Emoly Liu [ 15/Apr/20 ]

This error is related to the following code in function mdt_reint_migrate():

        /* TODO: DoM migration is not supported yet */
        if (S_ISREG(lu_object_attr(&sobj->mot_obj))) {
                ma->ma_lmm = info->mti_big_lmm;
                ma->ma_lmm_size = info->mti_big_lmmsize;
                ma->ma_valid = 0;
                rc = mdt_stripe_get(info, sobj, ma, XATTR_NAME_LOV);
                if (rc)
                        GOTO(put_source, rc);

                if (ma->ma_valid & MA_LOV &&
                    mdt_lmm_dom_entry(ma->ma_lmm) != LMM_NO_DOM)
                        GOTO(put_source, rc = -EOPNOTSUPP);
        }
Comment by Andreas Dilger [ 15/Apr/20 ]

I verified that DoM was involved not involved in my test:

# lfs getstripe /mnt/testfs/dir1/hosts
/mnt/testfs/dir1/hosts
  lcm_layout_gen:    2
  lcm_mirror_count:  2
  lcm_entry_count:   2
    lcme_id:             65537
    lcme_mirror_id:      1
    lcme_flags:          init
    lcme_extent.e_start: 0
    lcme_extent.e_end:   EOF
      lmm_stripe_count:  1
      lmm_stripe_size:   1048576
      lmm_pattern:       raid0
      lmm_layout_gen:    0
      lmm_stripe_offset: 2
      lmm_objects:
      - 0: { l_ost_idx: 2, l_fid: [0x100020000:0x1f42:0x0] }

    lcme_id:             131073
    lcme_mirror_id:      2
    lcme_flags:          init
    lcme_extent.e_start: 0
    lcme_extent.e_end:   EOF
      lmm_stripe_count:  1
      lmm_stripe_size:   1048576
      lmm_pattern:       raid0
      lmm_layout_gen:    0
      lmm_stripe_offset: 3
      lmm_objects:
      - 0: { l_ost_idx: 3, l_fid: [0x100030000:0x1f82:0x0] }

so this check shouldn't have anything to do with the inode migration to another MDT. Maybe the check is broken?

Mike, could you please take a look at this.

Comment by Mikhail Pershin [ 16/Apr/20 ]

There is mistake in variable initialization:

static inline int mdt_lmm_dom_entry(struct lov_mds_md *lmm)
{
	struct lov_comp_md_v1 *comp_v1;
	struct lov_mds_md *v1;
	__u32 off;
	bool has_dom = true;
	               ^^^
 

Default value should be false, because at the end there is:

	return has_dom ? LMM_DOM_ONLY : LMM_NO_DOM

So even if DOM stripe wasn't found and has_dom is not set, it is still true by default

Comment by Mikhail Pershin [ 16/Apr/20 ]

Patch is simple, just initialize that has_dom with false and it should be fixed in older releases, but I am not sure about master because https://review.whamcloud.com/#/c/38152 fixes that already though in different manner.

Comment by Gerrit Updater [ 16/Apr/20 ]

Mike Pershin (mpershin@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/38257
Subject: LU-13424 mdt: fix DOM entry check
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: a5aa82d0908a3c3070d7b7ef58ddc2f1f84af533

Comment by Mikhail Pershin [ 16/Apr/20 ]

I've made patch for this issue just to avoid dependencies on alternative patch and to have the example for b2_12 and any other releases

Comment by Gerrit Updater [ 23/Apr/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/38257/
Subject: LU-13424 mdt: fix DOM entry check
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 8f6b0aacc0e905bad7aebddfd838cbd610f17483

Comment by Peter Jones [ 23/Apr/20 ]

Landed for 2.14

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