All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Koenig <mkoenig@suse.de>
To: Ian Kent <raven@themaw.net>
Cc: autofs mailing list <autofs@linux.kernel.org>
Subject: Re: [PATCH] nested mounts with loop
Date: Tue, 02 Oct 2007 11:37:42 +0200	[thread overview]
Message-ID: <n7x8x6lvoux.fsf@sor.suse.de> (raw)
In-Reply-To: <1191302365.26331.36.camel@raven.themaw.net> (Ian Kent's message of "Tue\, 02 Oct 2007 13\:19\:25 +0800")

Ian Kent <raven@themaw.net> writes:

> On Wed, 2007-09-26 at 12:02 -0400, Jeff Moyer wrote:
>> Ian Kent <raven@themaw.net> writes:
>> 
>> > On Wed, 2007-09-26 at 17:32 +0200, Matthias Koenig wrote:
>> >> Ian Kent <raven@themaw.net> writes:
>> >> 
>> >> > On Tue, 2007-09-25 at 18:21 +0200, Matthias Koenig wrote:
>> >> >> Hi,
>> >> >> 
>> >> >> we noticed a problem concerning loop mounts on locations that 
>> >> >> have to be mounted before. E.g. consider the following situation,
>> >> >> a NFS server exporting a cd image, which we want to loop mount
>> >> >> locally to get access to the content:
>> >> >> 
>> >> >> auto.master:
>> >> >> /cdimage        auto.cdimage
>> >> >> /cdcontent      auto.cdcontent
>> >> >> 
>> >> >> auto.cdimage:
>> >> >> foo             nfsserver:/cdimage/foo.img
>> >> >> 
>> >> >> auto.cdcontent:
>> >> >> foo             -fstype=auto,loop       :/cdimage/foo/foo.img
>> >> >> 
>> >> >> The access to /cdcontent/foo will fail, when /cdimage/foo is not 
>> >> >> mounted before, because spawn_mount does not use SPAWN_OPT_ACCESS
>> >> >> in this case.
>> >> >> The patch below fixes this problem.
>> >> >
>> >> > I can't remember now.
>> >> > I wonder why I don't always call access?
>> >> > I must have had a reason, let me think about it for a while.
>> >> 
>> >> Yes, I first tried to set SPAWN_OPT_ACCESS as default, but this did
>> >> not work and had the negative effect, that NFS mounts could not
>> >> be mounted anymore, because an access() has been done on the
>> >> NFS location description "nfsserver:/cdimage", which then fails.
>> >
>> > Of course, I'll go with you're patch.
>> 
>> Are you sure the argument positions will be the same for all of the
>> mount modules?  Is this really the best way to fix this?
>
> Yes, it's possible that the "-o" could end up in a different position if
> the code is modified at some later time without thinking.

Maybe it is better to iterate over the options?

Matthias

Index: autofs-git20070924/daemon/spawn.c
===================================================================
--- autofs-git20070924.orig/daemon/spawn.c
+++ autofs-git20070924/daemon/spawn.c
@@ -293,6 +293,14 @@ int spawn_mount(logger *log, ...)
        while ((*p++ = va_arg(arg, char *)));
        va_end(arg);
 
+#ifndef ENABLE_MOUNT_LOCKING
+       /* validate loop mounts as they could be on some location to be
+        * mounted first */
+       for (p = argv; *(p+1); p++)
+               if (!strcmp(*p, "-o") && strstr(*(p+1), "loop"))
+                       options = SPAWN_OPT_ACCESS;
+#endif
+
        while (retries--) {
                ret = do_spawn(log, options, prog, (const char **) argv);
                if (ret & MTAB_NOTUPDATED)

  reply	other threads:[~2007-10-02  9:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 16:21 [PATCH] nested mounts with loop Matthias Koenig
2007-09-25 18:04 ` Ian Kent
2007-09-26 15:32   ` Matthias Koenig
2007-09-26 15:49     ` Ian Kent
2007-09-26 16:02       ` Jeff Moyer
2007-10-02  5:19         ` Ian Kent
2007-10-02  9:37           ` Matthias Koenig [this message]
2007-10-02 13:15             ` Ian Kent
2007-10-08  3:49 ` Ian Kent
2007-10-08  4:55 ` Ian Kent
2007-10-08 12:28   ` Matthias Koenig
2007-10-08 15:51     ` Ian Kent
2007-10-08 16:10       ` Matthias Koenig
2007-10-10  4:19     ` Ian Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=n7x8x6lvoux.fsf@sor.suse.de \
    --to=mkoenig@suse.de \
    --cc=autofs@linux.kernel.org \
    --cc=raven@themaw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.