Skip to contentSkip to conversation

xfs_quota: don't try to report quotas which aren't there.

PATCH Superseded Eric Sandeen 2 participants 4 messages Feb 18, 2011 – Feb 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_quota: don't try to report quotas which aren't there.

Red Hat bug #669333 - xfs_quota generates "XFS_GETQUOTA: No such process" errors shows that if you do this for a filesystem w/o group quota enabled:

# xfs_quota -x -c ' report -h ' /xfsquota"

You'll get this output:

User quota on /xfsquota (/dev/vdb)
Blocks
User ID Used Soft Hard Warn/Grace
---------- ---------------------------------
root 0 0 0 00 [------]

XFS_GETQUOTA: No such process
XFS_GETQUOTA: No such process
...

because we're calling XFS_GETQUOTA for types which aren't enabled.

The below patch fixes it for me, but I'm not sure if it's the best way to detect whether accounting is on? Seems to work.

---

quota/report.c +10 -0
index 0e005c3..d8d2bef 100644
@@ -514,12 +514,16 @@ report_any_type(
 	uint		upper,
 	uint		flags)
 {
+	fs_quota_stat_t	qs;
 	fs_cursor_t	cursor;
 	fs_path_t	*mount;
 
 	if (type & XFS_USER_QUOTA) {
 		fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
 		while ((mount = fs_cursor_next_entry(&cursor))) {
+			xfsquotactl(XFS_GETQSTAT, mount->fs_name, type, 0, &qs);
+			if (!(qs.qs_flags & XFS_QUOTA_UDQ_ACCT))
+				continue;
 			if (xfsquotactl(XFS_QSYNC, mount->fs_name,
 						XFS_USER_QUOTA, 0, NULL) < 0
 					&& errno != ENOENT && errno != ENOSYS)
@@ -531,6 +535,9 @@ report_any_type(
 	if (type & XFS_GROUP_QUOTA) {
 		fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
 		while ((mount = fs_cursor_next_entry(&cursor))) {
+			xfsquotactl(XFS_GETQSTAT, mount->fs_name, type, 0, &qs);
+			if (!(qs.qs_flags & XFS_QUOTA_GDQ_ACCT))
+				continue;
 			if (xfsquotactl(XFS_QSYNC, mount->fs_name,
 						XFS_GROUP_QUOTA, 0, NULL) < 0
 					&& errno != ENOENT && errno != ENOSYS)
@@ -542,6 +549,9 @@ report_any_type(
 	if (type & XFS_PROJ_QUOTA) {
 		fs_cursor_initialise(dir, FS_MOUNT_POINT, &cursor);
 		while ((mount = fs_cursor_next_entry(&cursor))) {
+			xfsquotactl(XFS_GETQSTAT, mount->fs_name, type, 0, &qs);
+			if (!(qs.qs_flags & XFS_QUOTA_PDQ_ACCT))
+				continue;
 			if (xfsquotactl(XFS_QSYNC, mount->fs_name,
 						XFS_PROJ_QUOTA, 0, NULL) < 0
 					&& errno != ENOENT && errno != ENOSYS)

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw

PATCH v2 1/1 xfs_quota: don't try to report quotas which aren't there.

Red Hat bug #669333 - xfs_quota generates "XFS_GETQUOTA: No such process" errors shows that if you do this for a filesystem w/o group quota enabled:

# xfs_quota -x -c ' report -h ' /xfsquota"

You'll get this output:

User quota on /xfsquota (/dev/vdb)
Blocks
User ID Used Soft Hard Warn/Grace
---------- ---------------------------------
root 0 0 0 00 [------]

XFS_GETQUOTA: No such process
XFS_GETQUOTA: No such process
...

because we're calling XFS_GETQUOTA for types which aren't enabled.

The below patch fixes it for me, just ignoring types that aren't there. Thanks to Arkadiusz Miskiewicz for pointing out the simpler fix. :)

---

quota/report.c +1 -1
index 0e005c3..7d391c6 100644
@@ -302,7 +302,7 @@ report_mount(
 	int		count;
 
 	if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
-		if (errno != ENOENT && errno != ENOSYS)
+		if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
 			perror("XFS_GETQUOTA");
 		return 0;
 	}

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw

PATCH v3 1/1 xfs_quota: don't try to report quotas which aren't there.

Red Hat bug #669333 - xfs_quota generates "XFS_GETQUOTA: No such process" errors shows that if you do this for a filesystem w/o group quota enabled:

# xfs_quota -x -c ' report -h ' /xfsquota"

You'll get this output:

User quota on /xfsquota (/dev/vdb)
Blocks
User ID Used Soft Hard Warn/Grace
---------- ---------------------------------
root 0 0 0 00 [------]

XFS_GETQUOTA: No such process
XFS_GETQUOTA: No such process
...

because we're calling XFS_GETQUOTA for types which aren't enabled.

The below patch fixes it for me, just ignoring types that aren't there.

V2: Thanks to Arkadiusz Miskiewicz for pointing out the simpler fix.
V3: Thanks again to Arkadiusz for suggesting fixing dump as well

---

quota/report.c +2 -2
index 0e005c3..8653590 100644
@@ -82,7 +82,7 @@ dump_file(
 	fs_disk_quota_t	d;
 
 	if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
-		if (errno != ENOENT && errno != ENOSYS)
+		if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
 			perror("XFS_GETQUOTA");
 		return;
 	}
@@ -302,7 +302,7 @@ report_mount(
 	int		count;
 
 	if (xfsquotactl(XFS_GETQUOTA, dev, type, id, (void *)&d) < 0) {
-		if (errno != ENOENT && errno != ENOSYS)
+		if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
 			perror("XFS_GETQUOTA");
 		return 0;
 	}

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v3 1/1
#3 lore raw
Quoted 19 lines · Eric Sandeen

Red Hat bug #669333 - xfs_quota generates "XFS_GETQUOTA: No such process" errors shows that if you do this for a filesystem w/o group quota enabled:

# xfs_quota -x -c ' report -h ' /xfsquota"

You'll get this output:

User quota on /xfsquota (/dev/vdb)
Blocks
User ID Used Soft Hard Warn/Grace
---------- ---------------------------------
root 0 0 0 00 [------]

XFS_GETQUOTA: No such process
XFS_GETQUOTA: No such process
...

because we're calling XFS_GETQUOTA for types which aren't enabled.

Quoted 7 lines

The below patch fixes it for me, just ignoring types that aren't there.

V2: Thanks to Arkadiusz Miskiewicz for pointing out the simpler fix.
V3: Thanks again to Arkadiusz for suggesting fixing dump as well

Looks sane.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs