linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: don't populate fs table with foreign fs paths unless foreign_allowed
@ 2016-08-29 13:40 Bill O'Donnell
  2016-08-29 15:13 ` Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Bill O'Donnell @ 2016-08-29 13:40 UTC (permalink / raw)
  To: xfs

Commits b20b6c2 and 29647c8 modified xfs_quota for use on
non-XFS filesystems. One modification in fs_initialise_mounts
(paths.c) resulted in an xfstest fail (xfs/261), due to foreign
fs paths entering the fs table.

This patch reverts the behavior in fs_initialise_mounts back
to skip populating the table with foreign paths, unless the
-f flag is thrown in xfs_quota to set foreign_allowed true.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
 libxcmd/paths.c | 5 +++++
 quota/init.c    | 1 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libxcmd/paths.c b/libxcmd/paths.c
index 4158688..7375c0e 100644
--- a/libxcmd/paths.c
+++ b/libxcmd/paths.c
@@ -34,6 +34,7 @@ extern char *progname;
 int fs_count;
 struct fs_path *fs_table;
 struct fs_path *fs_path;
+bool foreign_allowed = false;	/* foreign filesystems not allowed (default) */
 
 char *mtab_file;
 #define PROC_MOUNTS	"/proc/self/mounts"
@@ -311,6 +312,10 @@ fs_table_initialise_mounts(
 			return errno;
 
 	while ((mnt = getmntent(mtp)) != NULL) {
+		/* don't populate if not XFS, and foreign fs disallowed */
+		if ((strcmp(mnt->mnt_type, "xfs") != 0) &&
+		    !foreign_allowed)
+			continue;
 		if (!realpath(mnt->mnt_dir, rmnt_dir))
 			continue;
 		if (!realpath(mnt->mnt_fsname, rmnt_fsname))
diff --git a/quota/init.c b/quota/init.c
index 44be322..65e4dad 100644
--- a/quota/init.c
+++ b/quota/init.c
@@ -24,7 +24,6 @@
 char	*progname;
 int	exitcode;
 int	expert;
-bool	foreign_allowed = false;
 
 static char **projopts;	/* table of project names (cmdline) */
 static int nprojopts;	/* number of entries in name table. */
-- 
2.7.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2016-09-02 23:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-29 13:40 [PATCH] xfsprogs: don't populate fs table with foreign fs paths unless foreign_allowed Bill O'Donnell
2016-08-29 15:13 ` Darrick J. Wong
2016-08-29 15:43   ` Bill O'Donnell
2016-08-29 23:16     ` Dave Chinner
2016-08-29 23:28       ` Bill O'Donnell
2016-08-29 23:12 ` Dave Chinner
2016-08-29 23:26   ` Bill O'Donnell
2016-08-29 23:40     ` Dave Chinner
2016-08-29 23:47       ` Bill O'Donnell
2016-08-30  0:25         ` Dave Chinner
2016-08-30  0:53           ` Bill O'Donnell
2016-09-01 22:07           ` Bill O'Donnell
2016-09-02 21:22 ` [PATCH v2] xfsprogs: (xfs_quota) foreign fs path handling changes Bill O'Donnell
2016-09-02 22:57   ` Eric Sandeen
2016-09-02 23:10     ` Bill O'Donnell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).