Re: [PATCH] btrfs: add missing check for nocow and compression inode flags

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

 




On 10.07.20 г. 16:34 ч., David Sterba wrote:
> On Fri, Jul 10, 2020 at 01:10:25PM +0300, Nikolay Borisov wrote:
>>> +static int check_fsflags(unsigned int old_flags, unsigned int flags)
>>>  {
>>>  	if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
>>>  		      FS_NOATIME_FL | FS_NODUMP_FL | \
>>> @@ -174,9 +177,19 @@ static int check_fsflags(unsigned int flags)
>>>  		      FS_NOCOW_FL))
>>>  		return -EOPNOTSUPP;
>>>  
>>> +	/* COMPR and NOCOMP on new/old are valid */
>>>  	if ((flags & FS_NOCOMP_FL) && (flags & FS_COMPR_FL))
>>>  		return -EINVAL;
>>>  
>>> +	if ((flags & FS_COMPR_FL) && (flags & FS_NOCOW_FL))
>>> +		return -EINVAL;
>>> +
>>> +	/* NOCOW and compression options are mutually exclusive */
>>> +	if ((old_flags & FS_NOCOW_FL) && (flags & (FS_COMPR_FL | FS_NOCOMP_FL)))
>>
>> Why is NOCOW and setting NOCOMP (which would really be a NOOP) an
>> invalid combination?
> 
> The options are not conflicting directly, like for the compression and
> nodatacow, but it still is related to compression so it does not feel
> right to allow that even if it's a noop.
> 

Please put this reasoning in the changelog.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux