From: Ram Pai <linuxram@us.ibm.com>
To: Szeredi Miklos <miklos@szeredi.hu>
Cc: mszeredi2@gmail.com, Valerie Aurora <vaurora@redhat.com>,
viro@zeniv.linux.org.uk, hch@infradead.org, agruen@suse.de,
npiggin@kernel.dk, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 01/34] VFS: Make clone_mnt() and copy_tree() return error codes
Date: Fri, 1 Oct 2010 11:32:43 -0700 [thread overview]
Message-ID: <20101001183243.GM9247@ram-laptop> (raw)
In-Reply-To: <AANLkTin0k-Sz8Y6dwm9s6isKgDPgcqpg0NON5kuiOcJ3@mail.gmail.com>
On Fri, Oct 01, 2010 at 11:12:48AM +0200, Szeredi Miklos wrote:
> On Fri, Oct 1, 2010 at 3:58 AM, Ram Pai <linuxram@us.ibm.com> wrote:
> > > > > > @@ -1212,11 +1216,12 @@ struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry,
> > > > > > struct path path;
> > > > > >
> > > > > > if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt))
> > > > > > - return NULL;
> > > > > > + return ERR_PTR(-EINVAL);
> > > >
> > > > Ram, do you remember how this worked?
> > >
> > > Oops. That should be a OR condition. there is one other check in that
> > > function that should also be a OR condition.
> >
> > I may be wrong here. Can't exactly recollect what CL_COPY_ALL flag means. Al Viro
> > might remember? If CL_COPY_ALL means, to clone everything irrespective of any other
> > flags, then the above code seems right.
>
> CL_COPY_ALL means clone the mount despite MNT_UNBINDABLE. It is used
> for cloning the whole namespace and for collect_mounts(), both of
> which ignore MNT_UNBINDABLE.
Ok. That reminds me when the above piece of code in copy_tree() is triggered.
It triggered when a mount tree with a unbindable mount at its head
is moved on a shared mount with atleast one peer.
something like this should trigger the code.
# create a unbindable mount
mkdir -p /mnt2/m1
mount --bind /mnt2/m1 /mnt2/m1
mount --make-unbindable /mnt2/m1
#create a shared mount with one peer.
mkdir -p /mnt2/s1
mkdir -p /mnt2/s2
mount --bind /mnt2/s1 /mnt2/s1
mount --make-shared /mnt2/s1
mount --bind /mnt2/s1 /mnt2/s2
#move the unbindable mount to one of the shared peer
mkdir -p /mnt2/s1/movemount
mount --move /mnt2/m1 /mnt2/s1/movemount
the last step will fail and that is because of the above check in copy_tree()
>
> Of the two remaining callers of copy_tree() do_loopback already checks
> MNT_UNBINDABLE on the root of the tree to be copied.
>
> So that leaves the one in pnode.c. That one will be called when
> attaching a new mount or mount tree. If the root of that tree is
> unbindable then the propagation will fail with -ENOMEM which is wrong,
> it should simply skip the whole tree and not try to propagate.
Yes. the propagation_mnt() should fail if it is unable to create clones
of the source mount due to any reason. However -ENOMEM may not be
the right return code.
> Calls
> which result in propagation are do_loopback, do_move_mount and
> do_add_mount. Of this do_loopback and do_move_mount already check for
> MNT_UNBINDABLE, do_add_mount doesn't check, but should probably just
> mask out MNT_UNBINDABLE.
>
> So in the end that check in copy_tree() should never actually trigger
> and can be turned into a WARN_ON
You can do that. But then we have to catch for the cases where a unbindable
mount is moved on a shared mounts. I suppose we can put in a check in do_move_mount().
>
> Additionally the propagation code should perhaps be more defensive and
> skip MNT_UNBINDABLE source mounts.
No. If we do that, I am afraid, we will end up with inconsistent peer-mount trees
which will not resemble each other.
RP
>
> Thanks,
> Miklos
next prev parent reply other threads:[~2010-10-01 18:32 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-16 22:11 [PATCH 00/34] Union mount core for review Valerie Aurora
2010-09-16 22:11 ` [PATCH 01/34] VFS: Make clone_mnt() and copy_tree() return error codes Valerie Aurora
2010-09-20 21:26 ` Andreas Gruenbacher
2010-09-21 18:53 ` Valerie Aurora
2010-09-30 9:51 ` Miklos Szeredi
2010-09-30 21:41 ` Valerie Aurora
2010-09-30 21:44 ` Valerie Aurora
2010-10-01 0:33 ` Ram Pai
2010-10-01 1:58 ` Ram Pai
2010-10-01 9:12 ` Szeredi Miklos
2010-10-01 18:32 ` Ram Pai [this message]
2010-10-06 18:24 ` Valerie Aurora
2010-10-12 7:41 ` Ram Pai
2010-10-06 18:31 ` Valerie Aurora
2010-10-07 9:42 ` Miklos Szeredi
2010-09-16 22:11 ` [PATCH 02/34] VFS: Add CL_NO_SHARED flag to clone_mnt()/copy_tree() Valerie Aurora
2010-09-16 22:11 ` [PATCH 03/34] VFS: Add CL_NO_SLAVE " Valerie Aurora
[not found] ` <AANLkTim1bbGrrPcFHThx3XOm8GmudQFSmFUs3NAXT5yC@mail.gmail.com>
2010-09-17 4:34 ` Ram Pai
2010-09-17 17:15 ` Valerie Aurora
2010-09-20 5:25 ` Ram Pai
2010-09-21 0:03 ` Valerie Aurora
2010-09-27 5:42 ` Ram Pai
2010-09-27 18:50 ` Valerie Aurora
2010-10-01 0:44 ` Ram Pai
2010-09-16 22:11 ` [PATCH 04/34] VFS: Add CL_MAKE_HARD_READONLY " Valerie Aurora
2010-09-16 22:11 ` [PATCH 05/34] union-mount: Union mounts documentation Valerie Aurora
2010-09-16 22:11 ` [PATCH 06/34] union-mount: Introduce MNT_UNION and MS_UNION flags Valerie Aurora
2010-09-16 22:11 ` [PATCH 07/34] union-mount: Add CONFIG_UNION_MOUNT option Valerie Aurora
2010-09-16 22:11 ` [PATCH 08/34] union-mount: Create union_stack structure Valerie Aurora
2010-09-16 22:12 ` [PATCH 09/34] union-mount: Add two superblock fields for union mounts Valerie Aurora
2010-09-16 22:12 ` [PATCH 10/34] union-mount: Add union_alloc() Valerie Aurora
2010-09-16 22:12 ` [PATCH 11/34] union-mount: Add union_find_dir() Valerie Aurora
2010-09-16 22:12 ` [PATCH 12/34] union-mount: Create d_free_unions() Valerie Aurora
2010-09-16 22:12 ` [PATCH 13/34] union-mount: Free union stack on removal of topmost dentry from dcache Valerie Aurora
2010-09-16 22:12 ` [PATCH 14/34] union-mount: Create union_add_dir() Valerie Aurora
2010-09-16 22:12 ` [PATCH 15/34] union-mount: Add union_create_topmost_dir() Valerie Aurora
2010-09-16 22:12 ` [PATCH 16/34] union-mount: Create IS_MNT_UNION() Valerie Aurora
2010-09-16 22:12 ` [PATCH 17/34] union-mount: Create needs_lookup_union() Valerie Aurora
2010-09-16 22:12 ` [PATCH 18/34] union-mount: Create check_topmost_union_mnt() Valerie Aurora
2010-09-16 22:12 ` [PATCH 19/34] union-mount: Add clone_union_tree() and put_union_sb() Valerie Aurora
2010-09-16 22:12 ` [PATCH 20/34] union-mount: Create build_root_union() Valerie Aurora
2010-09-16 22:12 ` [PATCH 21/34] union-mount: Create prepare_mnt_union() and cleanup_mnt_union() Valerie Aurora
2010-09-16 22:12 ` [PATCH 22/34] union-mount: Prevent improper union-related remounts Valerie Aurora
2010-09-16 22:12 ` [PATCH 23/34] union-mount: Prevent topmost file system from being mounted elsewhere Valerie Aurora
2010-09-30 9:37 ` Miklos Szeredi
2010-09-30 21:47 ` Valerie Aurora
2010-09-16 22:12 ` [PATCH 24/34] union-mount: Prevent bind mounts of union mounts Valerie Aurora
2010-09-16 22:12 ` [PATCH 25/34] union-mount: Implement union mount Valerie Aurora
2010-09-16 22:12 ` [PATCH 26/34] union-mount: Temporarily disable some syscalls Valerie Aurora
2010-09-16 22:12 ` [PATCH 27/34] union-mount: Basic infrastructure of __union_lookup() Valerie Aurora
2010-09-16 22:12 ` [PATCH 28/34] union-mount: Process negative dentries in __union_lookup() Valerie Aurora
2010-09-16 22:12 ` [PATCH 29/34] union-mount: Return files found in lower layers " Valerie Aurora
2010-09-16 22:12 ` [PATCH 30/34] union-mount: Build union stack in __lookup_union() Valerie Aurora
2010-09-16 22:12 ` [PATCH 31/34] union-mount: Follow mount " Valerie Aurora
2010-09-16 22:12 ` [PATCH 32/34] union-mount: Add lookup_union() wrapper for __lookup_union() Valerie Aurora
2010-09-16 22:12 ` [PATCH 33/34] union-mount: Add do_lookup_union() " Valerie Aurora
2010-09-16 22:12 ` [PATCH 34/34] union-mount: Call union lookup functions in lookup path Valerie Aurora
2010-09-21 0:02 ` [PATCH -1/34] VFS: Add hard read-only users count to superblock Valerie Aurora
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=20101001183243.GM9247@ram-laptop \
--to=linuxram@us.ibm.com \
--cc=agruen@suse.de \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi2@gmail.com \
--cc=npiggin@kernel.dk \
--cc=vaurora@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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