[LU-7874] Suspect locking cleanup issue in mdt_create() Created: 14/Mar/16  Updated: 14/Jan/18  Resolved: 14/Jan/18

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

Type: Bug Priority: Minor
Reporter: Oleg Drokin Assignee: Lai Siyao
Resolution: Not a Bug Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

In mdt_create():

                        if (!mdt_object_remote(parent)) {
                                mdt_object_unlock(info, parent, lh, 1);
                                mdt_lock_pdo_init(lh, LCK_PW, &rr->rr_name);
                                rc = mdt_reint_object_lock(info, parent, lh,
                                                           MDS_INODELOCK_UPDATE,
                                                           true);
                                if (rc)
                                        GOTO(put_child, rc);
                        }
...
put_child:
        mdt_object_put(info->mti_env, child);
unlock_parent:
        mdt_object_unlock(info, parent, lh, rc);
put_parent:
        mdt_object_put(info->mti_env, parent);
        RETURN(rc);

So if we cannot lock parent we jump to put child and then unlock parent? that sounds wrong.



 Comments   
Comment by Peter Jones [ 14/Dec/17 ]

Lai

Can you please look into this?

Peter

Comment by Lai Siyao [ 03/Jan/18 ]

this is not a bug IMO, mdt_object_unlock() is safe to call multiple times, because it will clear lock handle after unlock, so this GOTO is to make sure child is put, and it's written this way to simplify failure cleanup.

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