mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erez Zadok <ezk@cs.sunysb.edu>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Erez Zadok <ezk@cs.sunysb.edu>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Miklos Szeredi <miklos@szeredi.hu>,
	akpm@linux-foundation.org, dave@linux.vnet.ibm.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch 01/10] vfs: add path_create() and path_mknod()
Date: Thu, 3 Apr 2008 19:24:47 -0400	[thread overview]
Message-ID: <200804032324.m33NOlqa030835@agora.fsl.cs.sunysb.edu> (raw)
In-Reply-To: Your message of "Thu, 03 Apr 2008 03:32:39 BST." <20080403023239.GY9785@ZenIV.linux.org.uk>

In message <20080403023239.GY9785@ZenIV.linux.org.uk>, Al Viro writes:
> On Wed, Apr 02, 2008 at 10:21:24PM -0400, Erez Zadok wrote:
> > Yes, I do grab both vfsmount and superblock refs.  I found out that grabbing
> > vfsmount refs wasn't enough to prevent "umount -l" from detaching the f/s on
> > which I'm stacked on.  So now at mount time (or branch management time), I
> > grab those super-refs, as I have them after a successful path_lookup.  And,
> > since I keep a list of the branches I'm stacked on, I know precisely which
> > superblocks' references I need to release when unionfs is unmounted.
> 
> How the devil would holding a superblock prevent umount -l?

It doesn't prevent umount -l; but it prevents the lower superblock from
being kfree()d if there were no references left to it, so I don't try to
accessed freed memory (and get 6b6b6b6b oopses :-)

> > But what do I do if I descend into another lower superblock while looking up
> > a lower directory?  How do keep track of the superblock refs now?  I'd
> > basically have to memorize the hierarchy of mounted superblocks somehow?
> > How would I know when to release those refs?  (hmm, maybe I can rely on
> > d_mounted or the like?)
> >
> > > > - sometimes it's ok to pass NULL for those things, sometimes it's not ok
> > > 
> > > See above.  This crap will be gone.  For ->follow_link() nobody is allowed
> > > to pass NULL as nameidata, period.
> > 
> > There's been talk in the past of splitting nameidata into intent structure
> > and all the rest.  Is that also part of your plan for 26?  Intents are
> > indeed very useful in ->lookup; the rest I can do without.
> 
> intents will die.  There'll be a method for final step of lookup + open,
> but that's it (and it'll take preallocated struct file as one of the
> arguments).

How much of nameidata will still need to be passed to f/s ops?  How many vfs
helpers will still require a nameidata?  Hopefully as few as possible.

Is this preallocated struct file a replacement to the nd->intent.open.file
that could have returned an allocated struct file?  (I could never really
tell what's the right thing to do with that field.)

> Please, explain what you want to do with intents, because
> as far as I'm concerned these had been a mistake for a lot of reasons.

I said above "intents are indeed very useful" only because they were:

1. required to be passed to vfs_* methods, which made it hard if the ->op I
   was in didn't have an intent (I have to create temp intents for those).

2. apparently heavily used in nfs4, to a point where if I stacked on nfs4
   and didn't pass a correctly formatted nameidata, I'd get an oops deep
   inside nfs4 code.  (I think some of those nfs4 requirements went away,
   not sure what's left.).

> > Ironically, since lookup_one_len doesn't involve vfsmounts, but I need them
> > for other reasons, I'm forced to live with NULL vfsmounts in some cases, or
> > refer to the lower vfsmounts I already had for my root dentry (that makes
> > transparently descending into a different vfsmount challenging, if not
> > inconsistent).
> 
> Details, please.  If you just want a snapshot of vfsmount tree, then by
> all means take a bloody snapshot.  collect_mounts() is there for purpose.
> If you want mount/umount/etc. changes affect what you have, then I really
> would like to see the semantics you want.  Some variation on shared-subtree
> might be close to that...

I'll have to take a closer look at vfsmount tree snapshotting and
collect_mounts() before I can say how useful they'd be.  But if you recall
my questions at LSF, I asked whether it was possible for me to create a
readonly directory tree (e.g., r-o bind mounts) or some form of an immutable
namespace that no one can modify underneath me.  You said that r-o bind
mounts were not intended for that.

Right now I'm allowing users to modify lower branches, with all the pros and
cons that it has.  But even if I wanted to prevent users from touching any
lower files below a certain directory, while allowing only unionfs to modify
those files, it doesn't appear that there's something available I could use.


I have two other questions/requests:

1. The less I have to use or know about vfsmounts and nameidata/intents, the
   better.  But whatever API changes you make, please consider the symmetry
   between the f/s ->op I'm called with, and the vfs helpers I might use in
   the ->op to pass through to the lower f/s.  Ideally the prototypes of the
   ->op and vfs helpers be identical, so I don't have to work too hard to
   locate the lower objects, or worse, having to make them up temporarily.

2. You mentioned that all this work is scheduled for 26.  25 is nearing
   release.  Do you have code already that I can experiment with?  A preview
   of things to come?  Maybe an example or two of how a filesystem
   (stackable, nfsd, or otherwise) should lookup and open arbitrary files?
   What you mentioned in this discussion thread sounds promising and
   exciting, but may take me a while to apply to my tree (longer than the
   usual merge window, which reportedly will shrink even further, now that
   we have linux-next :-).  So the more lead time, the better, please.

Thanks,
Erez.

  reply	other threads:[~2008-04-03 23:25 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 20:12 [patch 00/10] vfs: add helpers to check r/o bind mounts Miklos Szeredi
2008-04-02 20:12 ` [patch 01/10] vfs: add path_create() and path_mknod() Miklos Szeredi
2008-04-02 20:54   ` Al Viro
2008-04-02 21:11     ` Miklos Szeredi
2008-04-02 21:48       ` Al Viro
2008-04-02 22:21         ` Trond Myklebust
2008-04-02 22:36           ` Al Viro
2008-04-02 23:19             ` Trond Myklebust
2008-04-02 23:40               ` Al Viro
2008-04-02 23:47                 ` Al Viro
2008-04-03  0:42                   ` Trond Myklebust
2008-04-03  0:47                     ` Erez Zadok
2008-04-03  1:00                       ` Al Viro
2008-04-03  1:37                         ` Erez Zadok
2008-04-03  1:46                           ` Al Viro
2008-04-03  2:21                             ` Erez Zadok
2008-04-03  2:32                               ` Al Viro
2008-04-03 23:24                                 ` Erez Zadok [this message]
2008-04-04 11:04                                   ` Miklos Szeredi
2008-04-03  0:58                     ` Al Viro
2008-04-03  7:32         ` Miklos Szeredi
2008-04-03 22:32           ` Erez Zadok
2008-04-03 12:33     ` Stephen Smalley
2008-04-02 21:00   ` Dave Hansen
2008-04-02 21:19   ` Dave Hansen
2008-04-02 20:12 ` [patch 02/10] vfs: add path_mkdir() Miklos Szeredi
2008-04-02 22:15   ` Erez Zadok
2008-04-02 20:12 ` [patch 03/10] vfs: add path_rmdir() Miklos Szeredi
2008-04-02 20:12 ` [patch 04/10] vfs: add path_unlink() Miklos Szeredi
2008-04-02 20:12 ` [patch 05/10] vfs: add path_symlink() Miklos Szeredi
2008-04-02 20:12 ` [patch 06/10] vfs: add path_link() Miklos Szeredi
2008-04-02 20:12 ` [patch 07/10] vfs: add path_rename() Miklos Szeredi
2008-04-04 17:56   ` Erez Zadok
2008-04-04 18:04     ` Miklos Szeredi
2008-04-02 20:12 ` [patch 08/10] vfs: add path_setattr() Miklos Szeredi
2008-04-02 20:12 ` [patch 09/10] vfs: add path_setxattr() Miklos Szeredi
2008-04-02 20:12 ` [patch 10/10] vfs: add path_removexattr() Miklos Szeredi
2008-04-02 21:22 ` [patch 00/10] vfs: add helpers to check r/o bind mounts Erez Zadok
2008-04-09  0:53 ` [PATCH] Unionfs: use the new path_* VFS helpers Erez Zadok
2008-04-10 11:10   ` Miklos Szeredi
2008-04-10 12:02     ` [PATCH] Call LSM functions outside VFS helper functions Tetsuo Handa
2008-04-10 12:17       ` Matthew Wilcox
2008-04-10 12:56       ` Miklos Szeredi
2008-05-05 10:16 [patch 00/10] vfs: add helpers to check r/o bind mounts v3 Miklos Szeredi
2008-05-05 10:16 ` [patch 01/10] vfs: add path_create() and path_mknod() Miklos Szeredi
2008-05-06  4:12   ` Andrew Morton
2008-05-06  4:24     ` Al Viro
2008-05-06  5:46       ` Andrew Morton
2008-05-06  6:24       ` Miklos Szeredi

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=200804032324.m33NOlqa030835@agora.fsl.cs.sunysb.edu \
    --to=ezk@cs.sunysb.edu \
    --cc=akpm@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=trond.myklebust@fys.uio.no \
    --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

all inboxes | Powered by JetHome®