]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: use d_obtain_alias when mounting subvol/subvolid
authorJosef Bacik <josef@redhat.com>
Mon, 25 Jul 2011 19:40:35 +0000 (15:40 -0400)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 01:56:07 +0000 (20:56 -0500)
commit117f178e4c7acf8066e05a32b8cde06d955fb293
tree36f7d3a21c97c2acdab739cdca1914dfb8f78f5c
parent01da751147c6dad1d2f376d50eae94f72f931568
Btrfs: use d_obtain_alias when mounting subvol/subvolid

Currently what we do is just wrong.  We either

1) Alloc a new "root" dentry with sb->s_root as it's parent which is just wrong
as we could walk into this subvol later on via another path and hilarity could
ensue.  Also we don't check the return value of d_splice_alias which isn't good
either.

or

2) Do a d_find_alias() which we could have lost our dentry from cache at this
point and found nothing.

So use d_obtain_alias().  In the case that we already have the inode/dentry in
cache we will get the correct dentry.  If not we will get a disconnected dentry
tree so if we walk into it later on everything will be connected up properly.
Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
(cherry picked from commit ba5b8958dabbd7890a6929af1ffc0d87187765dc)
fs/btrfs/super.c