Linux Overlay Filesystem development
 help / color / mirror / Atom feed
From: Dominique Martinet <asmadeus@codewreck.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Vincent Bernat <bernat@luffy.cx>,
	Dominique Martinet <dominique.martinet@cea.fr>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	v9fs-developer@lists.sourceforge.net,
	Ron Minnich <rminnich@sandia.gov>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [V9fs-developer] 9p/overlayfs: what inodes/dentries are safe to use?
Date: Mon, 12 Oct 2015 19:47:59 +0200	[thread overview]
Message-ID: <20151012174759.GA31768@nautica> (raw)
In-Reply-To: <CAJfpegurhotqht8apANWM1iWOw7YWb1oAcY6Nq7nKOp80jvTaQ@mail.gmail.com>

Miklos Szeredi wrote on Mon, Oct 12, 2015:
> The solution depends on how 9p handles hard links.  If any dentry will
> do then d_find_any_alias() will get you a dentry (any dentry) from the
> inode.
> 
> Otherwise I know of no mechanism to get the backing dentry from the file.

I've got two problems at the moment:
 - first, 9P stores informations in the superblock (accessed
through either dentry->d_sb->s_fs_info or inode->i_sb->...), and
operations such as read will get passed an inode and a file (which has a
dentry), but 9P doesn't know which to trust (if I go this right - if 9P
is underlay then the inode is 9p's, if 9P is overlay then the dentry
is ?)
So we probably need a wrapper to get this right, somehow, and use it
everywhere there's a chance we get an alien inode/dentry.

 - The second problem is more inherent to the 9p protocol, that is every
access is made through a "fid" and the client navigates through the
filesystem tree one operation at a time ("walk") - walk will either
"clone" a fid or get one from its parent directory (it can do more
complex lookups but the kernel client never does)

At some point we need to open a new fid to a currently open file.
The current algorithm uses dentry->d_fsdata as a list of fids, so if we
already have a fid pointing to the dentry we can just usethat one, or if
there's nothing we'll either use the parent or start from scratch, but
the point is that once again I don't know if I can "trust"
dentry->d_fsdata to be a valid pointer or not.

Safest bet would be to remove this mechanism altogether, but that's
going to have a noticiable performance hit as we do this kind of clone
fairly often (9p needs more 'fids' than we have 'dentries' because some
operations will mutate or close them, so we clone pretty often)
Otherwise if there's some kind of flag we can check to tell if THAT
dentry is ours then we could only do this kind of lookup when that is
set, but I don't think there is?


Thanks,
-- 
Dominique Martinet

  reply	other threads:[~2015-10-12 17:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15  7:37 9p/overlayfs: read error when reading an empty file Vincent Bernat
2015-08-15 11:17 ` Vincent Bernat
2015-08-15 11:57   ` Vincent Bernat
2015-08-15 13:18 ` Vincent Bernat
2015-08-17 14:11   ` [V9fs-developer] " Dominique Martinet
2015-10-03 17:07     ` Vincent Bernat
2015-10-03 19:19       ` Dominique Martinet
2015-10-12 17:14         ` Miklos Szeredi
2015-10-12 17:47           ` Dominique Martinet [this message]
2015-10-13  3:33             ` [V9fs-developer] 9p/overlayfs: what inodes/dentries are safe to use? Miklos Szeredi
2015-10-13 13:10               ` Eric Van Hensbergen

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=20151012174759.GA31768@nautica \
    --to=asmadeus@codewreck.org \
    --cc=bernat@luffy.cx \
    --cc=dhowells@redhat.com \
    --cc=dominique.martinet@cea.fr \
    --cc=ericvh@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=miklos@szeredi.hu \
    --cc=rminnich@sandia.gov \
    --cc=v9fs-developer@lists.sourceforge.net \
    --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