[LU-3825] mdt_hsm_release() clobbers ma_valid Created: 22/Aug/13  Updated: 21/Oct/13  Resolved: 21/Oct/13

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: John Hammond
Resolution: Duplicate Votes: 0
Labels: HSM

Issue Links:
Duplicate
is duplicated by LU-3811 non-root users cannot archive files, ... Closed
Severity: 3
Rank (Obsolete): 9871

 Description   

In mdt_hsm_release() we have:

        ma->ma_need = MA_HSM | MA_LOV;
        rc = mdt_attr_get_complex(info, o, ma);
        if (rc != 0)
                GOTO(out_unlock, rc);

        ...

        ma->ma_valid = MA_INODE;
        ma->ma_attr.la_valid &= LA_SIZE | LA_MTIME | LA_ATIME;
        rc = mo_attr_set(info->mti_env, mdt_object_child(o), ma);
        if (rc < 0)
                GOTO(out_unlock, rc);

        if (!(ma->ma_valid & MA_LOV)) {
                /* Even empty file are released */
                memset(ma->ma_lmm, 0, sizeof(*ma->ma_lmm));
                ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V1_DEF);
                ma->ma_lmm->lmm_pattern = cpu_to_le32(LOV_PATTERN_RAID0);
		ma->ma_lmm->lmm_stripe_size = cpu_to_le32(LOV_MIN_STRIPE_SIZE);
                ma->ma_valid |= MA_LOV;
        } else {
                /* Magic must be LOV_MAGIC_Vx_DEF otherwise LOD will interpret            
                 * ma_lmm as lov_user_md, then it will be confused by union of            
                 * layout_gen and stripe_offset. */
                if (le32_to_cpu(ma->ma_lmm->lmm_magic) == LOV_MAGIC_V1)
                        ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V1_DEF);
		else if (le32_to_cpu(ma->ma_lmm->lmm_magic) == LOV_MAGIC_V3)
                        ma->ma_lmm->lmm_magic = cpu_to_le32(LOV_MAGIC_V3_DEF);
                else
                        GOTO(out_unlock, rc = -EINVAL);
        }


 Comments   
Comment by Andreas Dilger [ 23/Aug/13 ]

Alex, Di, can you please comment on this?

Comment by John Hammond [ 27/Aug/13 ]

This is addressed in http://review.whamcloud.com/7461.

Comment by jacques-charles lafoucriere [ 27/Aug/13 ]

7461 is for another ticket. Do you confirm you merge the 2 tickets?

Comment by John Hammond [ 27/Aug/13 ]

Yes.

Comment by Jodi Levi (Inactive) [ 07/Oct/13 ]

Patch has landed to Master.

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