[LU-9702] mdt: Is mdt_attr_get_complex() behaving as expected? Created: 22/Jun/17  Updated: 05/Aug/20  Resolved: 05/Aug/20

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

Type: Question/Request Priority: Minor
Reporter: CEA Assignee: John Hammond
Resolution: Fixed Votes: 0
Labels: None

Rank (Obsolete): 9223372036854775807

 Description   

Here is a simplified version of mdt_attr_get_complex():

int mdt_attr_get_complex(struct mdt_attr *ma)
{
    int need = ma->ma_need;

    ma->ma_valid = 0;

    if (need & MA_<something>) {
        ma->ma_need = MA_<something>;
        mo_attr_get(ma);
    }

    return 0;
}

Is it normal/necessary for mdt_attr_get_complex() to initialize ma->ma_valid to 0 whenever it is called?

From what I understand, mdt_attr_get_complex() is used to update cached attributes. When an attribute is updated, the field ma_valid is modified to contain the corresponding MA_* flag (MA_INODE, MA_HSM, ...).

The problem I see with this, is that when mdt_attr_get_complex() is called to only update inode attributes, hsm attributes will automatically get invalidated, without re-checking them. Is this the correct behaviour? Shouldn't ma_valid be initialized to only clear the flags that the caller requested to re-check? Something like:

ma->ma_valid ~= ~need

This issue was raised in a discussion on this patch and might be the root cause of LU-9654.



 Comments   
Comment by Peter Jones [ 22/Jun/17 ]

John

Could you please advise?

Thanks

Peter

Comment by John Hammond [ 22/Jun/17 ]

Hi Quentin,

Yes, this is the expected behavior. Since this function is called in about 20 places it would take a lot of analysis to change it. I suggest that you try to work around this behavior.

Comment by John Hammond [ 09/Aug/17 ]

https://review.whamcloud.com/#/c/27564/ has landed so I think this can be closed. Quentin, please reopen if you think there's more to do here.

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