Skip to contentSkip to conversation

common/quota: adjust _qmount_option for gfs2

PATCH In review Su Yue 2 participants 4 messages Jun 3, 2025 – Jul 4, 2025

lore
Share & tools
lore

Su Yue

author
#0 lore raw

PATCH 1/1 common/quota: adjust _qmount_option for gfs2

gfs2 supports mount options 'quota=[off/account/quiet/on]' but 'usrquota' and 'grpquota' are unsupported.
So in _qmount_option, transform $OPTS to 'quota=on' first.

---
 common/quota | 7 +++++++
 1 file changed, 7 insertions(+)
common/quota +7 -0
index a51386b1dd24..4b8052e07dde 100644
@@ -283,6 +283,12 @@ _qmount_option()
 {
 	OPTS=$1
 
+	if [[ "$FSTYP" == gfs2 ]]; then
+		OPTS=`echo $OPTS \
+		| sed   -e 's/usrquota/quota=on/g' \
+			-e 's/grpquota/quota=on/g'`
+	fi
+
 	# Replace any user defined quota options
 	# with the quota option that we want.
 	# Simplest to do this rather than delete existing ones first because
@@ -300,6 +306,7 @@ _qmount_option()
 		-e 's/\bpquota/QUOTA/g'    \
 		-e 's/prjquota/QUOTA/g'    \
 		-e 's/noquota/QUOTA/g'     \
+		-e 's/quota=[^, ]*/QUOTA/g' \
 		-e 's/quota/QUOTA/g'       \
 		-e 's/uqnoenforce/QUOTA/g' \
 		-e 's/gqnoenforce/QUOTA/g' \
Signature · 1 line
2.48.1
#1 lore raw
Quoted 14 lines · Su Yue

gfs2 supports mount options 'quota=[off/account/quiet/on]' but 'usrquota' and 'grpquota' are unsupported.
So in _qmount_option, transform $OPTS to 'quota=on' first.

---
 common/quota | 7 +++++++
 1 file changed, 7 insertions(+)
common/quota +0 -0
index a51386b1dd24..4b8052e07dde 100644

common/quota _qmount_option() · line 290

Quoted 8 lines
common/quota +5 -0
@@ -283,6 +283,12 @@ _qmount_option()
 {
 	OPTS=$1
 
+	if [[ "$FSTYP" == gfs2 ]]; then
+		OPTS=`echo $OPTS \
+		| sed   -e 's/usrquota/quota=on/g' \
+			-e 's/grpquota/quota=on/g'`
+	fi

There's not response from gfs list. I'm not familiar with gfs2, so I have to ask some questions about your patch...

From the manual of gfs2:
quota=[off/account/on]
Turns quotas on or off for a filesystem. Setting the quotas to be in the "account" state causes the per UID/GID usage statistics to be correctly maintained by the filesystem, limit and warn values are ignored. The default value is "off".

Looks like there's only one mount option "quota=..." for gfs2. And I didn't find a description about project quota, so
1. What will gfs2 do if there's a "prjquota" or "pquota"?
2. Do you need to replace "noquota" with "quota=off"?
3. And "quota" to "quota=on" ?
4. Have you tried your patch on gfs2, can all quota related generic cases pass/notrun on gfs2?

BTW, in this function you can see:

        # ext4 doesn't _do_ "-o pquota/prjquota" because reasons
        # Switch it to "quota" to enable mkfs-time pquota
        if [[ "$FSTYP" == ext[234] ]]; then
                OPTS=`echo $OPTS \
                | sed   -e 's/\bpquota/quota/g' \
                        -e 's/prjquota/quota/g'`
        # ocfs2 doesn't support "-o projquota"
        elif [[ "$FSTYP" == ocfs2 ]]; then
                OPTS=`echo $OPTS | sed -e 's/prjquota//g'`
        fi

please move your gfs2 specific codes here ^^, and give it enough comments.

common/quota _qmount_option() · line 309

Quoted 9 lines
common/quota +2 -0
+
 	# Replace any user defined quota options
 	# with the quota option that we want.
 	# Simplest to do this rather than delete existing ones first because
@@ -300,6 +306,7 @@ _qmount_option()
 		-e 's/\bpquota/QUOTA/g'    \
 		-e 's/prjquota/QUOTA/g'    \
 		-e 's/noquota/QUOTA/g'     \
+		-e 's/quota=[^, ]*/QUOTA/g' \

I think you might need a word boundary, e.g. "\bquota=..."

Thanks,
Zorro

Quoted 7 lines
common/quota +0 -0
 		-e 's/quota/QUOTA/g'       \
 		-e 's/uqnoenforce/QUOTA/g' \
 		-e 's/gqnoenforce/QUOTA/g' \
Signature · 1 line
2.48.1
author
#2 lore raw
Quoted 22 lines · Zorro Lang
Quoted 17 lines · Su Yue

gfs2 supports mount options 'quota=[off/account/quiet/on]' but 'usrquota' and 'grpquota' are unsupported.
So in _qmount_option, transform $OPTS to 'quota=on' first.

---
common/quota | 7 +++++++

1 file changed, 7 insertions(+)
common/quota +0 -0
index a51386b1dd24..4b8052e07dde 100644
@@ -283,6 +283,12 @@ _qmount_option()
 {

OPTS=$1

Quoted 8 lines
Quoted 5 lines

+ if [[ "$FSTYP" == gfs2 ]]; then
+ OPTS=`echo $OPTS \
+ | sed -e 's/usrquota/quota=on/g' \
+ -e 's/grpquota/quota=on/g'`
+ fi

There's not response from gfs list. I'm not familiar with gfs2, so I have to ask some questions about your patch...

Feel free to communicate : )

Quoted 8 lines

From the manual of gfs2:
quota=[off/account/on]
Turns quotas on or off for a filesystem. Setting the quotas to be in the "account" state causes the per UID/GID usage statistics to be correctly maintained by the filesystem, limit and warn values are ignored. The default value is "off".

Looks like there's only one mount option "quota=..." for gfs2. And I didn't find a description about project quota, so
1. What will gfs2 do if there's a "prjquota" or "pquota"?

The mount will fail if prjquota/pquota is in mount options. _require_prjquota() should be modified.

Quoted 1 line

2. Do you need to replace "noquota" with "quota=off"?

Yes.. I forgot the case.

Quoted 1 line

3. And "quota" to "quota=on" ?

The only case "_qmount_option ‘quota’” is tests/xfs/820, not in generic group.

Quoted 3 lines

4. Have you tried your patch on gfs2, can all quota related generic cases pass/notrun on gfs2?

TBH, not all quota tests run well on gfs2
There was a bug which can cause kernel hang in gfs2 fixed by kernel commit 5a90f8d49922 ("gfs2: Don't start unnecessary transactions during log flush”) In v6.16-rc1.

Quoted 3 lines

BTW, in this function you can see:

       # ext4 doesn't _do_ "-o pquota/prjquota" because reasons
       # Switch it to "quota" to enable mkfs-time pquota

The comment is confusing to me. ext[234] support ‘-o prjquota’ if MKFS_OPTIONS="-O quota -E quotatype=usrquota:grpquota:prjquota”.

Quoted 10 lines
       if [[ "$FSTYP" == ext[234] ]]; then
               OPTS=`echo $OPTS \
               | sed   -e 's/\bpquota/quota/g' \
                       -e 's/prjquota/quota/g'`
       # ocfs2 doesn't support "-o projquota"
       elif [[ "$FSTYP" == ocfs2 ]]; then
               OPTS=`echo $OPTS | sed -e 's/prjquota//g'`
       fi

please move your gfs2 specific codes here ^^, and give it enough comments.

There is one question from me about the _qmount_option() and _qmount()

Not all tests of qgroup use _qmount, some of them call _scratch_mount() directly. Is this intentional to avoid influenced by other mount options? If It’s not IMO it’s feasible to convert them to _qmount?

Quoted 12 lines

common/quota _qmount_option() · line 306

Quoted 10 lines

+
# Replace any user defined quota options

# with the quota option that we want.
# Simplest to do this rather than delete existing ones first because
common/quota +1 -3
@@ -300,6 +306,7 @@ _qmount_option()
-e 's/\bpquota/QUOTA/g'    \
-e 's/prjquota/QUOTA/g'    \
-e 's/noquota/QUOTA/g'     \
+ -e 's/quota=[^, ]*/QUOTA/g' \

I think you might need a word boundary, e.g. "\bquota=..."

Right.
—
Su

Quoted 9 lines

Thanks,
Zorro

Quoted 5 lines
common/quota +0 -3
-e 's/quota/QUOTA/g'       \
-e 's/uqnoenforce/QUOTA/g' \
-e 's/gqnoenforce/QUOTA/g' \
Signature · 1 line
2.48.1
#3 lore raw
Quoted 75 lines · Glass Su
Quoted 22 lines · Zorro Lang
Quoted 17 lines · Su Yue

gfs2 supports mount options 'quota=[off/account/quiet/on]' but 'usrquota' and 'grpquota' are unsupported.
So in _qmount_option, transform $OPTS to 'quota=on' first.

---
common/quota | 7 +++++++

1 file changed, 7 insertions(+)
common/quota +0 -0
index a51386b1dd24..4b8052e07dde 100644
@@ -283,6 +283,12 @@ _qmount_option()
 {

OPTS=$1

Quoted 8 lines
Quoted 5 lines

+ if [[ "$FSTYP" == gfs2 ]]; then
+ OPTS=`echo $OPTS \
+ | sed -e 's/usrquota/quota=on/g' \
+ -e 's/grpquota/quota=on/g'`
+ fi

There's not response from gfs list. I'm not familiar with gfs2, so I have to ask some questions about your patch...

Feel free to communicate : )

Quoted 8 lines

From the manual of gfs2:
quota=[off/account/on]
Turns quotas on or off for a filesystem. Setting the quotas to be in the "account" state causes the per UID/GID usage statistics to be correctly maintained by the filesystem, limit and warn values are ignored. The default value is "off".

Looks like there's only one mount option "quota=..." for gfs2. And I didn't find a description about project quota, so
1. What will gfs2 do if there's a "prjquota" or "pquota"?

The mount will fail if prjquota/pquota is in mount options. _require_prjquota() should be modified.

Quoted 1 line

2. Do you need to replace "noquota" with "quota=off"?

Yes.. I forgot the case.

Quoted 1 line

3. And "quota" to "quota=on" ?

The only case "_qmount_option ‘quota’” is tests/xfs/820, not in generic group.

Quoted 3 lines

4. Have you tried your patch on gfs2, can all quota related generic cases pass/notrun on gfs2?

TBH, not all quota tests run well on gfs2
There was a bug which can cause kernel hang in gfs2 fixed by kernel commit 5a90f8d49922 ("gfs2: Don't start unnecessary transactions during log flush”) In v6.16-rc1.

Quoted 3 lines

BTW, in this function you can see:

       # ext4 doesn't _do_ "-o pquota/prjquota" because reasons
       # Switch it to "quota" to enable mkfs-time pquota

The comment is confusing to me. ext[234] support ‘-o prjquota’ if MKFS_OPTIONS="-O quota -E quotatype=usrquota:grpquota:prjquota”.

Quoted 9 lines
       if [[ "$FSTYP" == ext[234] ]]; then
               OPTS=`echo $OPTS \
               | sed   -e 's/\bpquota/quota/g' \
                       -e 's/prjquota/quota/g'`
       # ocfs2 doesn't support "-o projquota"
       elif [[ "$FSTYP" == ocfs2 ]]; then
               OPTS=`echo $OPTS | sed -e 's/prjquota//g'`
       fi
Quoted 7 lines
Quoted 1 line

please move your gfs2 specific codes here ^^, and give it enough comments.

There is one question from me about the _qmount_option() and _qmount()

Not all tests of qgroup use _qmount, some of them call _scratch_mount() directly. Is this intentional to avoid influenced by other mount options? If It’s not IMO it’s feasible to convert them to _qmount?

Except some xfs specific cases, I think only g/537 and g/230 don't use _qmount directly.

$ for f in `grep -rsnl _qmount_option tests/`;do grep -wq _qmount $f||echo $f;done|grep -v xfs
tests/generic/537
tests/generic/230

By checking these two cases, I think their code logic can work well without _qmount currently. But if you find some cases fail on gfs2, please feel free to convert them to _qmount or fix them in your way :)

Thanks,
Zorro

Quoted 28 lines
Quoted 13 lines

common/quota _qmount_option() · line 306

Quoted 11 lines

+
# Replace any user defined quota options

# with the quota option that we want.
# Simplest to do this rather than delete existing ones first because
common/quota +1 -3
@@ -300,6 +306,7 @@ _qmount_option()
-e 's/\bpquota/QUOTA/g'    \
-e 's/prjquota/QUOTA/g'    \
-e 's/noquota/QUOTA/g'     \
+ -e 's/quota=[^, ]*/QUOTA/g' \

I think you might need a word boundary, e.g. "\bquota=..."

Right.
—
Su

Quoted 9 lines

Thanks,
Zorro

Quoted 5 lines
common/quota +0 -3
-e 's/quota/QUOTA/g'       \
-e 's/uqnoenforce/QUOTA/g' \
-e 's/gqnoenforce/QUOTA/g' \
Signature · 1 line
2.48.1