diff options
| -rw-r--r-- | fs/btrfs/ctree.h | 3 | ||||
| -rw-r--r-- | fs/btrfs/ioctl.c | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 8b851ac7c3fa..6f364e1d8d3d 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
| @@ -4219,7 +4219,8 @@ int btree_readahead_hook(struct btrfs_root *root, struct extent_buffer *eb, | |||
| 4219 | static inline int is_fstree(u64 rootid) | 4219 | static inline int is_fstree(u64 rootid) |
| 4220 | { | 4220 | { |
| 4221 | if (rootid == BTRFS_FS_TREE_OBJECTID || | 4221 | if (rootid == BTRFS_FS_TREE_OBJECTID || |
| 4222 | (s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID) | 4222 | ((s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID && |
| 4223 | !btrfs_qgroup_level(rootid))) | ||
| 4223 | return 1; | 4224 | return 1; |
| 4224 | return 0; | 4225 | return 0; |
| 4225 | } | 4226 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 2e66d8e76f32..e38b645c5015 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
| @@ -456,6 +456,13 @@ static noinline int create_subvol(struct inode *dir, | |||
| 456 | if (ret) | 456 | if (ret) |
| 457 | return ret; | 457 | return ret; |
| 458 | 458 | ||
| 459 | /* | ||
| 460 | * Don't create subvolume whose level is not zero. Or qgroup will be | ||
| 461 | * screwed up since it assume subvolme qgroup's level to be 0. | ||
| 462 | */ | ||
| 463 | if (btrfs_qgroup_level(objectid)) | ||
| 464 | return -ENOSPC; | ||
| 465 | |||
| 459 | btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP); | 466 | btrfs_init_block_rsv(&block_rsv, BTRFS_BLOCK_RSV_TEMP); |
| 460 | /* | 467 | /* |
| 461 | * The same as the snapshot creation, please see the comment | 468 | * The same as the snapshot creation, please see the comment |
