[LU-6297] Move rename is_subdir check from MDD to MDT Created: 26/Feb/15  Updated: 18/Oct/22

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Di Wang Assignee: Lai Siyao
Resolution: Unresolved Votes: 0
Labels: dne2, dne3

Issue Links:
Related
is related to LU-11104 rename under striped directory may ca... Resolved
is related to LU-3534 async update cross-MDTs Resolved
is related to LU-6831 The ticket for tracking all DNE2 bugs Reopened
Severity: 3
Rank (Obsolete): 17632

 Description   

Move rename is_subdir check (mdo_is_subdir) from MDD to MDT to avoid duplicate lu object find for the same fid, which might cause lu_obect_find() hang.



 Comments   
Comment by Alex Zhuravlev [ 26/Feb/15 ]

can you please describe the exact sequence?

Comment by Di Wang [ 26/Feb/15 ]

oh, mostly this is because mdt_is_subdir is being called multiple times during rename, which can be avoided if we move subdir check to MDT. And also

   mnew = mdt_object_find(info->mti_env, info->mti_mdt, new_fid);
                if (IS_ERR(mnew))
                        GOTO(out_put_old, rc = PTR_ERR(mnew));

                /* Before locking the target dir, check we do not replace
                 * a dir with a non-dir, otherwise it may deadlock with
                 * link op which tries to create a link in this dir
                 * back to this non-dir. */
                if (S_ISDIR(lu_object_attr(&mnew->mot_obj)) &&
                    !S_ISDIR(lu_object_attr(&mold->mot_obj)))
                        GOTO(out_put_new, rc = -EISDIR);

                lh_oldp = &info->mti_lh[MDT_LH_OLD];
                mdt_lock_reg_init(lh_oldp, LCK_EX);
                rc = mdt_object_lock(info, mold, lh_oldp, MDS_INODELOCK_LOOKUP |
                                     MDS_INODELOCK_XATTR);
                if (rc != 0)
                        GOTO(out_put_new, rc);

                /* Check if @msrcdir is subdir of @mnew, before locking child
                 * to avoid reverse locking. */
                rc = mdt_is_subdir(info, msrcdir, new_fid);    <---- new obj might be found again here.
                if (rc)
                        GOTO(out_unlock_old, rc);
Comment by Di Wang [ 26/Feb/15 ]

hmm, seems for old fid as well

       mold = mdt_object_find(info->mti_env, info->mti_mdt, old_fid);
        if (IS_ERR(mold))
                GOTO(out_unlock_parents, rc = PTR_ERR(mold));

        /* Check if @mtgtdir is subdir of @mold, before locking child
         * to avoid reverse locking. */
        rc = mdt_is_subdir(info, mtgtdir, old_fid);
        if (rc)
                GOTO(out_put_old, rc);
Comment by Di Wang [ 10/Mar/15 ]

This is not urgent, but probably need it for final racer pass. Please only work on it if you have extra time. Thanks

Comment by Alex Zhuravlev [ 10/Mar/15 ]

well, if _is_subdir() is called with LDLM lock held and we checked the passed object does exists, then how deadlock is possible - all "parents" must exist by definition?

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