[LU-4689] mds returns EINVAL for hsm commands if fsname is 8-byte aligned Created: 28/Feb/14  Updated: 11/Mar/14  Resolved: 10/Mar/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.0, Lustre 2.6.0
Fix Version/s: Lustre 2.6.0, Lustre 2.5.1

Type: Bug Priority: Critical
Reporter: Peng Tao Assignee: James Nunez (Inactive)
Resolution: Fixed Votes: 0
Labels: HSM, mn4, patch
Environment:

b2_5 and master have the same issue.


Severity: 3
Rank (Obsolete): 12885

 Description   

If a filesystem name is 8-byte aligned, all HSM commands will get -EINVALID. The root cause is in following code:

/* Return pointer to first hai in action list */
static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal)
{
        return (struct hsm_action_item *)(hal->hal_fsname +
                                          cfs_size_round(strlen(hal-> \
                                                                hal_fsname)));
}

hal_fsname is a string terminated with NULL. If strlen(hal->hal_fsname) is 8 aligned, hai_first() ends up eating the terminating NULL character.

Now when the caller first time call hai_first() and set proper value to the returning first hsm_action_item, it ends up appending some non-NULL characters at the address of hal_fsname + strlen(hal_fsname). The side effect is that the next time someone calls hal_first(), strlen(hal->hal_fsname) is larger than the first time. That would result in misplacement of hsm_action_item and causes hal_is_sane() check to fail.



 Comments   
Comment by Peng Tao [ 28/Feb/14 ]

patch tracking at http://review.whamcloud.com/9431

Comment by Peter Jones [ 28/Feb/14 ]

James

Could you please look after this one?

Thanks

Peter

Comment by Peng Tao [ 04/Mar/14 ]

The patch for master has been landed. I ported it to b2_5 that has the same issue. Please see http://review.whamcloud.com/9468

Comment by Jodi Levi (Inactive) [ 10/Mar/14 ]

Patch landed to Master and will be landed to b2_5

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