[PATCH 2/2] libmount/context: avoid resolving pseudofs source on update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similar to the previous commit, when mounting a pseudofs, trust the
source of the fs, as it cannot be matched to backing device on the
filesystem.

Similar situation, but slightly different bug:

  # mkdir /foo /root/foo
  # echo 'foo  /foo  tmpfs  defaults  0  0' >> /etc/fstab
  # cd /root
  # mount -a
  # mount | grep /foo
  /root/foo on /foo type tmpfs (rw,relatime)

This fixes the pure libmount based mount utility, but the legacy mount
tool will still fail to handle this properly.

Signed-off-by: Dave Reisner <dreisner@xxxxxxxxxxxxx>
---
Two things:

- Since this touched a different file than the previous commit, I thought it best
to keep them separate. Karel, if you disagree, I'm happy to rebase for you.

- Legacy mount has defeated me. Uggh.

 libmount/src/context.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libmount/src/context.c b/libmount/src/context.c
index c61a144..ea372ce 100644
--- a/libmount/src/context.c
+++ b/libmount/src/context.c
@@ -32,6 +32,7 @@
  */
 
 #include "mountP.h"
+#include "utils.h"
 
 #include <sys/wait.h>
 
@@ -1105,7 +1106,8 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt)
 		/*
 		 * Source is PATH (canonicalize)
 		 */
-		path = mnt_resolve_path(src, cache);
+		if (!mnt_fstype_is_pseudofs(mnt_fs_get_fstype(cxt->fs)))
+			path = mnt_resolve_path(src, cache);
 		if (path && strcmp(path, src))
 			rc = mnt_fs_set_source(cxt->fs, path);
 	 }
-- 
1.7.8.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux