From: Denys Vlasenko <vda.linux@googlemail.com>
To: Chuck Ebbert <cebbert@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Roman Borisov <ext-roman.borisov@nokia.com>,
Alexander Shishkin <virtuoso@slind.org>
Subject: Re: 2.6.35-rc4: mount results with and without MS_SILENT differ
Date: Sat, 26 Mar 2011 22:43:18 +0100 [thread overview]
Message-ID: <201103262243.18031.vda.linux@googlemail.com> (raw)
In-Reply-To: <20110324234711.60a6e3c3@katamari>
On Friday 25 March 2011 04:47, Chuck Ebbert wrote:
> On Mon, 14 Mar 2011 05:20:08 +0100
> Denys Vlasenko <vda.linux@googlemail.com> wrote:
>
> It looks like this bug has been there forever.
>
> This fails:
> > mount -vv --make-rshared mount.shared1 2>&1
>
> This succeeds:
> > mount -vv --loud --make-rshared mount.shared2 2>&1 # <-HERE
>
> Failure case uses MS_REC | MS_SHARED | MS_SILENT
> > mount: mount('','mount.shared1','',0x0010c000,''):0
>
> It succeeds with MS_REC | MS_SHARED
> > mount: mount('','mount.shared2','',0x00104000,''):0
>
> Looking at do_mount() we see some flags get filtered out before checking
> namespace flags:
>
> flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
> MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
> MS_STRICTATIME);
>
> Then:
>
> else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
> retval = do_change_type(&path, flags);
>
> In do_change_type()
>
> type = flags_to_propagation_type(flag);
> if (!type)
> return -EINVAL;
>
> And flags_to_propagation_type() filters out MS_REC before making sure one
> and only one of the propagation type flags is set:
>
> int type = flags & ~MS_REC;
>
> /* Fail if any non-propagation flags are set */
> if (type & ~(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
> return 0;
> /* Only one propagation flag should be set */
> if (!is_power_of_2(type))
> return 0;
>
> Looks like the is_power_of_2() test is failing because MS_SILENT is set.
> I'm not sure whether to filter MS_SILENT in the upper or lower function
> though.
We cannot slear out MS_SILENT here:
flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
MS_STRICTATIME);
Because...
if (flags & MS_REMOUNT)
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
data_page);
else if (flags & MS_BIND)
retval = do_loopback(&path, dev_name, flags & MS_REC);
else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
retval = do_change_type(&path, flags);
else if (flags & MS_MOVE)
retval = do_move_mount(&path, dev_name);
else
...it needs to propagate into:
retval = do_new_mount(&path, type_page, flags, mnt_flags,
dev_name, data_page);
I think MS_SILENT can be cleared along with MS_REC in do_change_type() ->
flags_to_propagation_type(), on this line:
- int type = flags & ~MS_REC;
+ int type = flags & ~(MS_REC | MS_SILENT);
--
vda
next prev parent reply other threads:[~2011-03-26 21:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 4:20 Denys Vlasenko
2011-03-25 3:47 ` Chuck Ebbert
2011-03-26 21:43 ` Denys Vlasenko [this message]
2011-04-01 14:48 ` [PATCH] fs: bound mount propagation fix Roman Borisov
2011-04-12 10:28 ` Roman Borisov
2011-04-19 21:04 ` Andrew Morton
2011-04-20 11:51 ` Roman Borisov
[not found] <cover.1303304011.git.ext-roman.borisov@nokia.com>
2011-04-20 14:11 ` [PATCH v2] " Roman Borisov
2011-04-21 20:04 ` [PATCH v3] " Andrew Morton
2011-04-22 9:02 ` Roman Borisov
2011-04-22 11:05 ` [PATCH v4] fs: namespacec " Roman Borisov
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=201103262243.18031.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=cebbert@redhat.com \
--cc=ext-roman.borisov@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=virtuoso@slind.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome