[PATCH 1/2] ubifs: ubifs_jnl_write_inode: Only check once for the limitation of xattr count

Zhihao Cheng chengzhihao1 at huawei.com
Fri Nov 15 18:00:28 PST 2024


在 2024/11/16 6:03, Kees Bakker 写道:
> Op 10-07-2024 om 04:26 schreef Zhihao Cheng:
>> No need to check the limitation of xattr count every time in function
>> ubifs_jnl_write_inode(), because the 'ui->xattr_cnt' won't be modified
>> by others in the inode evicting process.
>>
>> Signed-off-by: Zhihao Cheng <chengzhihao1 at huawei.com>
>> ---
>>   fs/ubifs/journal.c | 14 ++++++++------
>>   1 file changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
>> index 4a35f9e8f668..a5c7c499cc29 100644
>> --- a/fs/ubifs/journal.c
>> +++ b/fs/ubifs/journal.c
>> @@ -981,6 +981,14 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, 
>> const struct inode *inode)
>>       dbg_jnl("ino %lu, nlink %u", inode->i_ino, inode->i_nlink);
>> +    if (kill_xattrs) {
>> +        if (ui->xattr_cnt > ubifs_xattr_max_cnt(c)) {
>> +            ubifs_err(c, "Cannot delete inode, it has too much 
>> xattrs!");
>> +            ubifs_ro_mode(c, err);
> The function ubifs_ro_mode is called with an uninitialized `err`.
> Can you please look at this again?

Hi Kees, thanks for reminding. Nathan has sent a patch to fix it.
https://lore.kernel.org/linux-mtd/b560f413-70f1-8ebb-7403-34591658ca86@huawei.com/T/#t
>> +            return -EPERM;
>> +        }
>> +    }
>> +
>>       /*
>>        * If the inode is being deleted, do not write the attached 
>> data. No
>>        * need to synchronize the write-buffer either.
>> [...]
> .




More information about the linux-mtd mailing list