From: Al Viro <viro-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
To: Miklos Szeredi <mszeredi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Eric W. Biederman"
<ebiederm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
linux-fsdevel
<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux API <linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: User-visible context-mount API
Date: Fri, 19 Jan 2018 06:32:29 +0000 [thread overview]
Message-ID: <20180119063229.GH13338@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAOssrKfN_ZT5yJC1mxkhUf6FG=_eMD4nzQtETfu_4X3vOf1kHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Jan 17, 2018 at 10:53:36AM +0100, Miklos Szeredi wrote:
> Documenting --make-private thing properly would also help. To me the
> wording "make private" strongly implies "I want to make submounts
> private to this instance". See for example rhbz#1432211.
>
> > If anything, "private bind on itself" would be a useful operation.
> > Turning given location into a mountpoint, and having everything
> > under it looking as it used to, but with no propagation at all.
> > Without bothering anybody else, even if location currently happens
> > to be on a shared/master mount.
> >
> > I can slap that together for mount(2), but I'm not sure what a sane
> > combination of flags for that would look like ;-) For fsmount
> > I think it would be very useful thing to have.
>
> Yes, I think such an operation would be pretty useful. Not sure if
> it's the whole story, though.
FWIW, there's a fun variant of the API:
* fsopen(): string -> fsfd; takes fs type name, returns a file descriptor
connected to fs driver. Subsequent read/write on it is used to pass
options, authenticate, etc. - all you need to talk the driver into
creating an active instance.
* fspick(): location -> fsfd; fsfd connected to filesystem mounted at given
place. After that you can talk to the driver to get superblock-level
remount.
* new_mount(): fsfd x string -> fd. Creates a vfsmount and gives a file
descriptor for given relative pathname.
* clone_mount(): location x bool -> fd. Copies a vfsmount or an entire
subtree (depending upon the second parameter) and returns a file descriptor.
Basically, bind or rbind sans attaching it anywhere.
* change_flags(): fd x (propagation or vfsmount flags) x bool -> int
fd should point to root of some vfsmount (O_PATH, or either of the previous
two. Flag is "do we want it to affect the entire subtree"; the tricky
question is what to do with vfsmount flags - for those we might want
things like "here's the full set" or "change those flags thus".
Hell knows - there might be two primitives there; the second one
would be fd x mask x new_flags x bool -> int, as in "set the bits
present in mask to values as in new_flags". Not sure.
* move_mount(): fd x location x bool -> int. fd - what to move, location -
where to put it, bool - do we want to suppress propagation. Potentially
hacky part is that if fd is not attached to anything, we simply attach it;
otherwise - move.
Normal mount: fsopen, talk to driver, new_mount, move_mount, close descriptors
mount --bind: fd = clone_mount(old, false); move_mount(fd, new, false); close
mount --rbind: clone_mount(old, true); move_mount; close
mount --make-shared et.al.: open(..., O_PATH); change_flags; close
mount --move: open; mount_move; close
vfsmount-level remount: open; change_flags (or change_mount_flags, if we keep
it separate from topology ones); close
sb-level remount: fspick; talk to driver; close
make an arbitrary subtree really private (as discussed upthread):
fd = clone_mount(old, true); change_flags (or change_propagation_flags);
mount_move(fd, old, true); close(fd);
The tricky part in terms of implementation is that we want a
tree created by clone_mount() and never attached anywhere to be
dissolved on the final close() of the result of clone_mount().
It's not quite O_PATH - we want file_operations for that sucker
that would have ->release() doing that.
It would do namespace_lock(), check ->f_path.mnt for a flag and do
umount_tree() if not set, then namespace_unlock(). move_mount()
would set the flag.
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: David Howells <dhowells@redhat.com>,
Jeff Layton <jlayton@redhat.com>,
"Eric W. Biederman" <ebiederm@redhat.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
util-linux@vger.kernel.org,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Subject: Re: User-visible context-mount API
Date: Fri, 19 Jan 2018 06:32:29 +0000 [thread overview]
Message-ID: <20180119063229.GH13338@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAOssrKfN_ZT5yJC1mxkhUf6FG=_eMD4nzQtETfu_4X3vOf1kHw@mail.gmail.com>
On Wed, Jan 17, 2018 at 10:53:36AM +0100, Miklos Szeredi wrote:
> Documenting --make-private thing properly would also help. To me the
> wording "make private" strongly implies "I want to make submounts
> private to this instance". See for example rhbz#1432211.
>
> > If anything, "private bind on itself" would be a useful operation.
> > Turning given location into a mountpoint, and having everything
> > under it looking as it used to, but with no propagation at all.
> > Without bothering anybody else, even if location currently happens
> > to be on a shared/master mount.
> >
> > I can slap that together for mount(2), but I'm not sure what a sane
> > combination of flags for that would look like ;-) For fsmount
> > I think it would be very useful thing to have.
>
> Yes, I think such an operation would be pretty useful. Not sure if
> it's the whole story, though.
FWIW, there's a fun variant of the API:
* fsopen(): string -> fsfd; takes fs type name, returns a file descriptor
connected to fs driver. Subsequent read/write on it is used to pass
options, authenticate, etc. - all you need to talk the driver into
creating an active instance.
* fspick(): location -> fsfd; fsfd connected to filesystem mounted at given
place. After that you can talk to the driver to get superblock-level
remount.
* new_mount(): fsfd x string -> fd. Creates a vfsmount and gives a file
descriptor for given relative pathname.
* clone_mount(): location x bool -> fd. Copies a vfsmount or an entire
subtree (depending upon the second parameter) and returns a file descriptor.
Basically, bind or rbind sans attaching it anywhere.
* change_flags(): fd x (propagation or vfsmount flags) x bool -> int
fd should point to root of some vfsmount (O_PATH, or either of the previous
two. Flag is "do we want it to affect the entire subtree"; the tricky
question is what to do with vfsmount flags - for those we might want
things like "here's the full set" or "change those flags thus".
Hell knows - there might be two primitives there; the second one
would be fd x mask x new_flags x bool -> int, as in "set the bits
present in mask to values as in new_flags". Not sure.
* move_mount(): fd x location x bool -> int. fd - what to move, location -
where to put it, bool - do we want to suppress propagation. Potentially
hacky part is that if fd is not attached to anything, we simply attach it;
otherwise - move.
Normal mount: fsopen, talk to driver, new_mount, move_mount, close descriptors
mount --bind: fd = clone_mount(old, false); move_mount(fd, new, false); close
mount --rbind: clone_mount(old, true); move_mount; close
mount --make-shared et.al.: open(..., O_PATH); change_flags; close
mount --move: open; mount_move; close
vfsmount-level remount: open; change_flags (or change_mount_flags, if we keep
it separate from topology ones); close
sb-level remount: fspick; talk to driver; close
make an arbitrary subtree really private (as discussed upthread):
fd = clone_mount(old, true); change_flags (or change_propagation_flags);
mount_move(fd, old, true); close(fd);
The tricky part in terms of implementation is that we want a
tree created by clone_mount() and never attached anywhere to be
dissolved on the final close() of the result of clone_mount().
It's not quite O_PATH - we want file_operations for that sucker
that would have ->release() doing that.
It would do namespace_lock(), check ->f_path.mnt for a flag and do
umount_tree() if not set, then namespace_unlock(). move_mount()
would set the flag.
next prev parent reply other threads:[~2018-01-19 6:32 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 16:07 User-visible context-mount API David Howells
2018-01-15 17:31 ` Eric W. Biederman
2018-01-15 17:32 ` Eric W. Biederman
2018-01-16 14:55 ` David Howells
[not found] ` <28167.1516032442-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2018-01-16 9:01 ` Miklos Szeredi
2018-01-16 9:01 ` Miklos Szeredi
2018-01-16 10:10 ` David Howells
2018-01-16 10:35 ` Miklos Szeredi
[not found] ` <CAOssrKc46bf=yme=zSubYF6t-TGfxEpCaKMQ6GVp30-vuaXWLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 14:18 ` David Howells
2018-01-16 14:18 ` David Howells
[not found] ` <22576.1516097412-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2018-01-17 10:43 ` Karel Zak
2018-01-17 10:43 ` Karel Zak
[not found] ` <CAOssrKdgudK7kKbhQBAnV9EwzHBq=4+9M26JGfmhNDGrGXmnFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-16 15:40 ` David Howells
2018-01-16 15:40 ` David Howells
[not found] ` <1643.1516117204-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2018-01-16 16:41 ` Miklos Szeredi
2018-01-16 16:41 ` Miklos Szeredi
[not found] ` <CAOssrKdn-ZhOB9V28uL-JK9zgNGJzF4cFBeyoqLLj4pADqNFVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-17 4:17 ` Al Viro
2018-01-17 4:17 ` Al Viro
2018-01-17 9:53 ` Miklos Szeredi
[not found] ` <CAOssrKfN_ZT5yJC1mxkhUf6FG=_eMD4nzQtETfu_4X3vOf1kHw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-17 11:06 ` Karel Zak
2018-01-17 11:06 ` Karel Zak
[not found] ` <20180117110633.zneqvnjzgxkv4yc2-xkT7n84Rsxv/9pzu0YdTqQ@public.gmane.org>
2018-01-18 9:48 ` Miklos Szeredi
2018-01-18 9:48 ` Miklos Szeredi
2018-01-19 2:27 ` Al Viro
2018-01-19 2:27 ` Al Viro
2018-01-19 6:32 ` Al Viro [this message]
2018-01-19 6:32 ` Al Viro
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=20180119063229.GH13338@ZenIV.linux.org.uk \
--to=viro-3bdd1+5odreifsdqtta3olvcufugdwfn@public.gmane.org \
--cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mszeredi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=util-linux-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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.