Re: [PATCH] xfs: show the proper user quota options

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

 




On 2020/11/24 8:30, Darrick J. Wong wrote:
> On Mon, Nov 23, 2020 at 05:38:52PM +0800, xiakaixu1987@xxxxxxxxx wrote:
>> From: Kaixu Xia <kaixuxia@xxxxxxxxxxx>
>>
>> The quota option 'usrquota' should be shown if both the XFS_UQUOTA_ACCT
>> and XFS_UQUOTA_ENFD flags are set. The option 'uqnoenforce' should be
>> shown when only the XFS_UQUOTA_ACCT flag is set. The current code logic
>> seems wrong, Fix it and show proper options.
> 
> This needs a regression test case to make sure that quota mount options
> passed in ==> quota options in /proc/mounts, wouldn't you say? ;)

Hi Darrick,

The simple test case as follows:

Before the patch:
 # mount -o uqnoenforce /dev/vdc1 /data1
 # cat /proc/mounts | grep xfs
/dev/vdc1 /data1 xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,usrquota 0 0

After the patch:
 # mount -o uqnoenforce /dev/vdc1 /data1
 # cat /proc/mounts | grep xfs
/dev/vdc1 /data1 xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,uqnoenforce 0 0

I'm not sure if a xfstest case is needed:)

Thanks,
Kaixu

> 
> --D
> 
>> Signed-off-by: Kaixu Xia <kaixuxia@xxxxxxxxxxx>
>> ---
>>  fs/xfs/xfs_super.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>> index e3e229e52512..5ebd6cdc44a7 100644
>> --- a/fs/xfs/xfs_super.c
>> +++ b/fs/xfs/xfs_super.c
>> @@ -199,10 +199,12 @@ xfs_fs_show_options(
>>  		seq_printf(m, ",swidth=%d",
>>  				(int)XFS_FSB_TO_BB(mp, mp->m_swidth));
>>  
>> -	if (mp->m_qflags & (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD))
>> -		seq_puts(m, ",usrquota");
>> -	else if (mp->m_qflags & XFS_UQUOTA_ACCT)
>> -		seq_puts(m, ",uqnoenforce");
>> +	if (mp->m_qflags & XFS_UQUOTA_ACCT) {
>> +		if (mp->m_qflags & XFS_UQUOTA_ENFD)
>> +			seq_puts(m, ",usrquota");
>> +		else
>> +			seq_puts(m, ",uqnoenforce");
>> +	}
>>  
>>  	if (mp->m_qflags & XFS_PQUOTA_ACCT) {
>>  		if (mp->m_qflags & XFS_PQUOTA_ENFD)
>> -- 
>> 2.20.0
>>

-- 
kaixuxia



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux