[LU-3241] ll_update_inode uses body->fid1 before checking that OBD_MD_FLID is set Created: 29/Apr/13  Updated: 31/Jan/22

Status: Open
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.4.0, Lustre 2.15.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: WC Triage
Resolution: Unresolved Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 7963

 Description   

This is not a bug I currently see in practice but the logic should be fixed as explained below. Probably OBD_MD_FLID is always set.

In ll_update_inode() ino and generation are set up top

inode->i_ino = cl_fid_build_ino(&body->fid1, ll_need_32bit_api(sbi));
inode->i_generation = cl_fid_build_gen(&body->fid1);

and later we check OBD_MD_FLID

        if (body->valid & OBD_MD_FLID) {
                /* FID shouldn't be changed! */
		if (fid_is_sane(&lli->lli_fid)) {
                        LASSERTF(lu_fid_eq(&lli->lli_fid, &body->fid1),
                                 "Trying to change FID "DFID
                                 " to the "DFID", inode %lu/%u(%p)\n",
                                 PFID(&lli->lli_fid), PFID(&body->fid1),
                                 inode->i_ino, inode->i_generation, inode);
		} else
                        lli->lli_fid = body->fid1;
        }

So if the wrong fid is applied to the object (as in LU-2523) then the assertion prints the wrong ino and generation.


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