Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH] quotasys: silence errors caused by vanishing mounts in the mount table
@ 2026-11-28 19:22 Theodore Ts'o
  0 siblings, 0 replies; only message in thread
From: Theodore Ts'o @ 2026-11-28 19:22 UTC (permalink / raw)
  To: Jan Kara; +Cc: Ext4 Developers List, Theodore Ts'o, linuxquota-devel

Even when setquota is given a single explicit mountpoint (such as
/xt-vdc), it walks the entire mount table and opens mountpoints three
times (once each for user, group. and project quotas), before
filtering out the user-specified mountpoint.  Unfortunately (as is the
case with xfstests's generic/234), if setquota is racing with systemd
creating and removing the tmpfs mount /run/user/31415 when commands
are run under "su fsgqa", this can cause a spurious error messages
resulting in generic/234 failing intermittently.

Fix this by suppressing the error message while scanning the mount
table; since we take a snapshot of the mounts and then iterate over
them, it is quite normal that we might have some mounts that might
appear or disappear while we populate the in-memory mount information.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 quotasys.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/quotasys.c b/quotasys.c
index 7cbc864..6ee920a 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -440,7 +440,17 @@ int do_quotactl(int cmd, const char *dev, const char *mnt, int id, caddr_t addr)
 		int fd = open(mnt, O_DIRECTORY | O_PATH);
 
 		if (fd < 0) {
-			errstr(_("Unable to get a filedescriptor from mountpoint: %s\n"), mnt);
+			/*
+			 * The mount table we scan is only a snapshot; a
+			 * mount point which has been removed in the mean
+			 * time (e.g. /run/user/<uid>) is not worth a message.
+			 *
+			 * Besides, if quotactl_fd(2) is not available, the
+			 * fallback where we call quotactl(2) doesn't print
+			 * any error messages, but just returns -1 and sets errno.
+			 */
+			if (errno != ENOENT)
+				errstr(_("Unable to get a filedescriptor from mountpoint: %s: %s\n"), mnt, strerror(errno));
 			return fd;
 		}
 
@@ -1090,13 +1100,16 @@ alloc:
 		}
 			
 		if (!realpath(mnt->mnt_dir, mntpointbuf)) {
-			errstr(_("Cannot resolve mountpoint path %s: %s\n"), mnt->mnt_dir, strerror(errno));
+			/* Unmounted and removed since we read the mount table? */
+			if (errno != ENOENT)
+				errstr(_("Cannot resolve mountpoint path %s: %s\n"), mnt->mnt_dir, strerror(errno));
 			free((char *)devname);
 			continue;
 		}
 		
 		if (statfs(mntpointbuf, &fsstat) != 0) {
-			errstr(_("Cannot statfs() %s: %s\n"), mntpointbuf, strerror(errno));
+			if (errno != ENOENT)
+				errstr(_("Cannot statfs() %s: %s\n"), mntpointbuf, strerror(errno));
 			free((char *)devname);
 			continue;
 		}
-- 
2.56.1.839.g22a8290db9-goog


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-28 19:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 19:22 [PATCH] quotasys: silence errors caused by vanishing mounts in the mount table Theodore Ts'o

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