* [PATCH 1/2] libmount/tab: always trust the source of a pseudofs
@ 2011-12-26 22:10 Dave Reisner
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Dave Reisner @ 2011-12-26 22:10 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
Since nodev FSs have no backing block device, it's unreasonable to try
and resolve the source back to a path on the filesystem. Always trust
the source of the FS given in /etc/fstab to avoid remounting the device
when a directory of the same name exists in the current working
directory.
Example reproduction:
# mkdir /foo
# echo 'foo /foo tmpfs defaults 0 0' >> /etc/fstab
# mount -a
# cd /root; mkdir foo
# mount -a
# mount | grep /foo
foo on /foo type tmpfs (rw,relatime)
/root/foo on /foo type tmpfs (rw,relatime)
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
libmount/src/tab.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 2bc49e3..da3677f 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -45,6 +45,7 @@
#include "mountP.h"
#include "strutils.h"
+#include "utils.h"
/**
* mnt_new_table:
@@ -841,6 +842,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
src_fs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
if (src_fs)
src = mnt_fs_get_srcpath(src_fs);
+ else if (mnt_fstype_is_pseudofs(mnt_fs_get_fstype(fstab_fs)))
+ src = mnt_fs_get_source(fstab_fs);
else
src = mnt_resolve_spec(mnt_fs_get_source(fstab_fs), tb->cache);
--
1.7.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update
2011-12-26 22:10 [PATCH 1/2] libmount/tab: always trust the source of a pseudofs Dave Reisner
@ 2011-12-26 22:10 ` Dave Reisner
2012-01-02 14:02 ` Karel Zak
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
2012-01-02 14:01 ` [PATCH 1/2] libmount/tab: always trust " Karel Zak
2 siblings, 1 reply; 7+ messages in thread
From: Dave Reisner @ 2011-12-26 22:10 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
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@archlinux.org>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] mount: don't canonicalize the source of a pseudofs
2011-12-26 22:10 [PATCH 1/2] libmount/tab: always trust the source of a pseudofs Dave Reisner
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
@ 2011-12-26 23:47 ` Dave Reisner
2011-12-27 11:29 ` Karel Zak
2012-01-02 14:02 ` Karel Zak
2012-01-02 14:01 ` [PATCH 1/2] libmount/tab: always trust " Karel Zak
2 siblings, 2 replies; 7+ messages in thread
From: Dave Reisner @ 2011-12-26 23:47 UTC (permalink / raw)
To: util-linux; +Cc: Dave Reisner
In line with previous patches, the source of a pseudofs is strictly
semantic; do not attempt to resolve it to a filesystem path.
As a side effect of this, nspec needs to be initialized to NULL since
it may not be assigned null by spec_to_devname when the FS is deemed
a pseudofs.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
---
This wasn't as evil as I thought, after all...
mount/mount.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/mount/mount.c b/mount/mount.c
index 9b444c4..49d49f6 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -2016,7 +2016,7 @@ is_existing_file (const char *s) {
static int
mount_one (const char *spec, const char *node, const char *types,
const char *fstabopts, char *cmdlineopts, int freq, int pass) {
- const char *nspec;
+ const char *nspec = NULL;
char *opts;
/* Substitute values in opts, if required */
@@ -2046,7 +2046,8 @@ mount_one (const char *spec, const char *node, const char *types,
strncmp(types, "nfs", 3) &&
strncmp(types, "cifs", 4) &&
strncmp(types, "smbfs", 5))) {
- nspec = spec_to_devname(spec);
+ if (!is_pseudo_fs(types))
+ nspec = spec_to_devname(spec);
if (nspec)
spec = nspec;
}
--
1.7.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mount: don't canonicalize the source of a pseudofs
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
@ 2011-12-27 11:29 ` Karel Zak
2012-01-02 14:02 ` Karel Zak
1 sibling, 0 replies; 7+ messages in thread
From: Karel Zak @ 2011-12-27 11:29 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Mon, Dec 26, 2011 at 06:47:24PM -0500, Dave Reisner wrote:
> In line with previous patches, the source of a pseudofs is strictly
> semantic; do not attempt to resolve it to a filesystem path.
>
> As a side effect of this, nspec needs to be initialized to NULL since
> it may not be assigned null by spec_to_devname when the FS is deemed
> a pseudofs.
>
> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
> ---
> This wasn't as evil as I thought, after all...
>
> mount/mount.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mount/mount.c b/mount/mount.c
> index 9b444c4..49d49f6 100644
> --- a/mount/mount.c
> +++ b/mount/mount.c
> @@ -2016,7 +2016,7 @@ is_existing_file (const char *s) {
> static int
> mount_one (const char *spec, const char *node, const char *types,
> const char *fstabopts, char *cmdlineopts, int freq, int pass) {
> - const char *nspec;
> + const char *nspec = NULL;
> char *opts;
>
> /* Substitute values in opts, if required */
> @@ -2046,7 +2046,8 @@ mount_one (const char *spec, const char *node, const char *types,
> strncmp(types, "nfs", 3) &&
> strncmp(types, "cifs", 4) &&
> strncmp(types, "smbfs", 5))) {
> - nspec = spec_to_devname(spec);
> + if (!is_pseudo_fs(types))
> + nspec = spec_to_devname(spec);
Exactly this is implemented in spec_to_devname(), it does not
canonicalize pseudo filesystems.
> if (nspec)
> spec = nspec;
> }
> --
> 1.7.8.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] libmount/tab: always trust the source of a pseudofs
2011-12-26 22:10 [PATCH 1/2] libmount/tab: always trust the source of a pseudofs Dave Reisner
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
@ 2012-01-02 14:01 ` Karel Zak
2 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2012-01-02 14:01 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Mon, Dec 26, 2011 at 05:10:22PM -0500, Dave Reisner wrote:
> libmount/src/tab.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
@ 2012-01-02 14:02 ` Karel Zak
0 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2012-01-02 14:02 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Mon, Dec 26, 2011 at 05:10:23PM -0500, Dave Reisner wrote:
> libmount/src/context.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mount: don't canonicalize the source of a pseudofs
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
2011-12-27 11:29 ` Karel Zak
@ 2012-01-02 14:02 ` Karel Zak
1 sibling, 0 replies; 7+ messages in thread
From: Karel Zak @ 2012-01-02 14:02 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux, Dave Reisner
On Mon, Dec 26, 2011 at 06:47:24PM -0500, Dave Reisner wrote:
> mount/mount.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-01-02 14:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-26 22:10 [PATCH 1/2] libmount/tab: always trust the source of a pseudofs Dave Reisner
2011-12-26 22:10 ` [PATCH 2/2] libmount/context: avoid resolving pseudofs source on update Dave Reisner
2012-01-02 14:02 ` Karel Zak
2011-12-26 23:47 ` [PATCH] mount: don't canonicalize the source of a pseudofs Dave Reisner
2011-12-27 11:29 ` Karel Zak
2012-01-02 14:02 ` Karel Zak
2012-01-02 14:01 ` [PATCH 1/2] libmount/tab: always trust " Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.