All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Josef Bacik <jbacik@fb.com>,
	linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] Btrfs: unset DCACHE_DISCONNECTED when mounting default subvol
Date: Tue, 18 Feb 2014 15:26:52 -0500	[thread overview]
Message-ID: <20140218202652.GA12374@fieldses.org> (raw)
In-Reply-To: <20140215024524.GA6660@fieldses.org>

On Fri, Feb 14, 2014 at 09:45:24PM -0500, J. Bruce Fields wrote:
> On Fri, Feb 14, 2014 at 05:40:55PM -0800, Eric W. Biederman wrote:
> > "J. Bruce Fields" <bfields@fieldses.org> writes:
> > 
> > > On Fri, Feb 14, 2014 at 01:43:48PM -0500, Josef Bacik wrote:
> > >> A user was running into errors from an NFS export of a subvolume that had a
> > >> default subvol set.  When we mount a default subvol we will use d_obtain_alias()
> > >> to find an existing dentry for the subvolume in the case that the root subvol
> > >> has already been mounted, or a dummy one is allocated in the case that the root
> > >> subvol has not already been mounted.  This allows us to connect the dentry later
> > >> on if we wander into the path.  However if we don't ever wander into the path we
> > >> will keep DCACHE_DISCONNECTED set for a long time, which angers NFS.  It doesn't
> > >> appear to cause any problems but it is annoying nonetheless, so simply unset
> > >> DCACHE_DISCONNECTED in the get_default_root case and switch btrfs_lookup() to
> > >> use d_materialise_unique() instead which will make everything play nicely
> > >> together and reconnect stuff if we wander into the defaul subvol path from a
> > >> different way.  With this patch I'm no longer getting the NFS errors when
> > >> exporting a volume that has been mounted with a default subvol set.  Thanks,
> > >
> > > Looks obviously correct, but based on a quick grep, there are four
> > > d_obtain_alias callers outside export methods:
> > >
> > > 	- btrfs/super.c:get_default_root()
> > > 	- fs/ceph/super.c:open_root_dentry()
> > > 	- fs/nfs/getroot.c:nfs_get_root()
> > > 	- fs/nilfs2/super.c:nilfs_get_root_dentry()
> > >
> > > It'd be nice to give them a common d_obtain_alias variant instead of
> > > making them all clear this by hand.
> > 
> > I am in favor of one small fix at a time, so that progress is made and
> > fixing something just for btrfs seems reasonable for the short term.
> > 
> > > Of those nilfs2 also uses d_splice_alias.  I think that problem would
> > > best be solved by fixing d_splice_alias not to require a
> > > DCACHE_DISCONNECTED dentry; IS_ROOT() on its own should be fine.
> > 
> > You mean by renaming d_splice_alias d_materialise_unique?
> > 
> > Or is there a useful distinction you see that should be preserved
> > between the two methods?
> > 
> > Right now my inclination is that everyone should just use
> > d_materialise_unique and we should kill d_splice_alias.
> 
> Probably.  One remaining distinction:
> 
> 	- In the local filesystem case if you discover a directory is
> 	  already aliased elsewhere, you have a corrupted filesystem and
> 	  want to error out the lookup.  (Didn't you propose a patch to
> 	  do something like that before?)
> 	- In the distributed filesystem this is perfectly normal and we
> 	  want to do our best to fix up our local cache to represent
> 	  remote reality.

The following keeps the d_splice_alias/d_materialise_unique distinction
and (hopefully) fixes Josef's bug, and does a little cleanup (including
your suggested DISCONNECTED->CONNECTING rename).

Any better idea for the naming of d_materialise_unique?

I also didn't try to merge the implementations--the merged
d_splice_alias/d_materialise_unique was a little uglier than I expected.
I'll keep messing around with it though.

--b.

  reply	other threads:[~2014-02-18 20:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 18:43 [PATCH] Btrfs: unset DCACHE_DISCONNECTED when mounting default subvol Josef Bacik
2014-02-14 18:55 ` Eric W. Biederman
2014-02-14 22:05 ` J. Bruce Fields
2014-02-15  1:40   ` Eric W. Biederman
2014-02-15  2:45     ` J. Bruce Fields
2014-02-18 20:26       ` J. Bruce Fields [this message]
2014-02-18 20:28         ` [PATCH 1/9] dcache: move d_splice_alias J. Bruce Fields
2014-02-18 20:28           ` [PATCH 2/9] dcache: close d_move race in d_splice_alias J. Bruce Fields
2014-02-21  1:43             ` Christoph Hellwig
2014-02-18 20:28           ` [PATCH 3/9] dcache: d_splice_alias mustn't create directory aliases J. Bruce Fields
2014-02-18 20:29           ` [PATCH 4/9] dcache: d_splice_alias should ignore DCACHE_DISCONNECTED J. Bruce Fields
2014-02-18 20:29           ` [PATCH 5/9] dcache: d_obtain_alias callers don't all want DISCONNECTED J. Bruce Fields
2014-02-21  1:44             ` Christoph Hellwig
2014-02-24 20:23               ` J. Bruce Fields
2014-02-18 20:29           ` [PATCH 6/9] dcache: remove unused d_find_alias parameter J. Bruce Fields
2014-02-18 20:29           ` [PATCH 7/9] dcache: d_find_alias needn't recheck IS_ROOT && DCACHE_DISCONNECTED J. Bruce Fields
2014-02-18 20:29           ` [PATCH 8/9] exportfs: update Exporting documentation J. Bruce Fields
2014-02-18 20:29           ` [PATCH 9/9] dcache: rename DCACHE_DISCONNECTED -> DCACHE_CONNECTING J. Bruce Fields
2014-02-21  1:42           ` [PATCH 1/9] dcache: move d_splice_alias Christoph Hellwig
2014-02-18 21:32         ` [PATCH] Btrfs: unset DCACHE_DISCONNECTED when mounting default subvol Eric W. Biederman

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=20140218202652.GA12374@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=ebiederm@xmission.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.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.