public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs_quota: don't try to report quotas which aren't there.
@ 2011-02-18 17:47 Eric Sandeen
  2011-02-18 17:55 ` [PATCH V2] " Eric Sandeen
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2011-02-18 17:47 UTC (permalink / raw)
  To: xfs-oss

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.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/quota/report.c b/quota/report.c
index 0e005c3..d8d2bef 100644
--- a/quota/report.c
+++ b/quota/report.c
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-20 21:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18 17:47 [PATCH] xfs_quota: don't try to report quotas which aren't there Eric Sandeen
2011-02-18 17:55 ` [PATCH V2] " Eric Sandeen
2011-02-18 18:02   ` [PATCH V3] " Eric Sandeen
2011-02-20 21:16     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox