Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274675
b: refs/heads/master
c: f9d9ef6
h: refs/heads/master
i:
  274673: 0580bef
  274671: d57bc77
v: v3
  • Loading branch information
David Sterba committed Oct 24, 2011
1 parent 7ef3fdf commit 8d1ffc0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 20bcd64934e4eb8f3f90a0dca54fb0ac2edd7795
refs/heads/master: f9d9ef62cd3ecbd6cbb7957a253c1e81f69d5586
19 changes: 19 additions & 0 deletions trunk/fs/btrfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,16 @@ static int btrfs_set_super(struct super_block *s, void *data)
return set_anon_super(s, data);
}

/*
* subvolumes are identified by ino 256
*/
static inline int is_subvolume_inode(struct inode *inode)
{
if (inode && inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)
return 1;
return 0;
}

/*
* This will strip out the subvol=%s argument for an argument string and add
* subvolid=0 to make sure we get the actual tree root for path walking to the
Expand Down Expand Up @@ -843,6 +853,15 @@ static struct dentry *mount_subvol(const char *subvol_name, int flags,
if (error)
return ERR_PTR(error);

if (!is_subvolume_inode(path.dentry->d_inode)) {
path_put(&path);
mntput(mnt);
error = -EINVAL;
printk(KERN_ERR "btrfs: '%s' is not a valid subvolume\n",
subvol_name);
return ERR_PTR(-EINVAL);
}

/* Get a ref to the sb and the dentry we found and return it */
s = path.mnt->mnt_sb;
atomic_inc(&s->s_active);
Expand Down

0 comments on commit 8d1ffc0

Please sign in to comment.