Re: [PATCH v2] btrfs: Defer setting new inode mode until after do_set_acl succeeds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21/03/2019 16:57, Nikolay Borisov wrote:
[...]

>  * Fixed logic of when i_mode is set, v1 was causing an uninitialised mode
>  to be assigned to inode->i_mode resulting in fs consistency problems. Fix this
>  by introducing a variable which is set to true when the i_mode needs to be 
>  changed. I know this variable could be eliminated by simply initialising 
>  mode = inode->i_mode and always assigning it in the if (!ret) branch but I 
>  find this somewhat subtle and rather be explicit with the boolean variable. 

[...]

> +	if (!ret) {
> +		if (change_mode)
> +			inode->i_mode = mode;

But what about initializing mode by inode->i_mode *and* adding a comment
that this is either the saved state or the new one, depending on
posix_acl_update_mode()'s outcome?

-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@xxxxxxx                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux