xfs: show the proper user quota options
PATCH 1/1 xfs: show the proper user quota options
From: Kaixu Xia <[email protected]>
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.
--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/xfs/xfs_super.c +6 -4
@@ -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 )
Signature · 1 line
2.20.0
Quoted 6 lines · On 11/23/20 3:38 AM, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag is set. The current code logic seems wrong, Fix it and show proper options.
I'm failing to see the difference in the logic here. Under the current code, what combination of flags yields the wrong string, and what does this patch change in that respect?
Thanks,
-Eric
Quoted 28 lines
Signed-off-by Kaixu Xia <[email protected]>--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )
Quoted 11 lines · Eric Sandeen
Quoted 6 lines · On 11/23/20 3:38 AM, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag is set. The current code logic seems wrong, Fix it and show proper options.I'm failing to see the difference in the logic here. Under the current code, what combination of flags yields the wrong string, and what does this patch change in that respect?
<djwong pointed out what I missed>
But I guess that just emphasizes the need for a test :)
Thanks,
-Eric
Quoted 6 lines · On Mon, Nov 23, 2020 at 05:38:52PM +0800, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag 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? ;)
--D
Quoted 29 lines
Signed-off-by Kaixu Xia <[email protected]>--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )Signature · 1 line
2.20.0
Quoted 10 lines · Darrick J. Wong
Quoted 6 lines · On Mon, Nov 23, 2020 at 05:38:52PM +0800, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag 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
Quoted 32 lines
--D
Quoted 29 lines
Signed-off-by Kaixu Xia <[email protected]>--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )Signature · 1 line
2.20.0
Signature · 1 line
kaixuxia
Quoted 23 lines · kaixuxia
Quoted 10 lines · Darrick J. Wong
Quoted 6 lines · On Mon, Nov 23, 2020 at 05:38:52PM +0800, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag 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
Quoted 6 lines
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 0I'm not sure if a xfstest case is needed:)
It's been broken for a decade and nobody noticed.
YES IT IS.
--D
Quoted 39 lines
Thanks,
KaixuQuoted 32 lines
--D
Quoted 29 lines
Signed-off-by Kaixu Xia <[email protected]>--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )Signature · 1 line
2.20.0Signature · 1 line
kaixuxia
Quoted 8 lines · On Mon, Nov 23, 2020 at 05:38:52PM +0800, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag is set. The current code logic seems wrong, Fix it and show proper options.Signed-off-by Kaixu Xia <[email protected]>
FWIW this causes a regression in xfs/513 since mount option uqnoenforce no longer causes 'usrquota' to be emitted in /proc/mounts. Do you have a patch to fix fstests?
--D
Quoted 28 lines
--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )Signature · 1 line
2.20.0
Quoted 8 lines · Darrick J. Wong
Quoted 7 lines · On Mon, Nov 23, 2020 at 05:38:52PM +0800, [email protected] wrote:
From: Kaixu Xia <[email protected]>
The quota option 'usrquota' should be shown if both the
XFS_UQUOTA_ACCTandXFS_UQUOTA_ENFDflags are set. The option 'uqnoenforce' should be shown when only theXFS_UQUOTA_ACCTflag is set. The current code logic seems wrong, Fix it and show proper options.
Quoted 5 lines
Quoted 1 line
Signed-off-by Kaixu Xia <[email protected]>FWIW this causes a regression in xfs/513 since mount option uqnoenforce no longer causes 'usrquota' to be emitted in
/proc/mounts. Do you have a patch to fix fstests?
Yeah, I'll send the patches to fix the regression in xfs/513 and add the xfstest case for this bug ASAP:)
Thanks,
Kaixu
Quoted 31 lines
--D
Quoted 28 lines
--- fs/xfs/xfs_super.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)fs/xfs/xfs_super.c +6
-4@@ -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 )Signature · 1 line
2.20.0
Signature · 1 line
kaixuxia