Btrfs: don't miss roots in deletion during walking backrefs
diff mbox

Message ID 1389703008-1781-1-git-send-email-wangsl.fnst@cn.fujitsu.com
State Rejected
Headers show

Commit Message

Wang Shilong Jan. 14, 2014, 12:36 p.m. UTC
btrfs_read_fs_root_no_name() will check its root refs, and will
return us ENOENT if this root in deletion.

However, in some case, for example qgroup, we still need to track
those roots, fix it.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
 fs/btrfs/backref.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wang Shilong Jan. 15, 2014, 12:57 p.m. UTC | #1
Please ignore this patch, there is still a race condition between
root deletion and walking backrefs, i will send them together later!

Thanks,
Wang
On 01/14/2014 08:36 PM, Wang Shilong wrote:
> btrfs_read_fs_root_no_name() will check its root refs, and will
> return us ENOENT if this root in deletion.
>
> However, in some case, for example qgroup, we still need to track
> those roots, fix it.
>
> Signed-off-by: Wang Shilong<wangsl.fnst@cn.fujitsu.com>
> ---
>   fs/btrfs/backref.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> index 835b6c9..ec4a1d2 100644
> --- a/fs/btrfs/backref.c
> +++ b/fs/btrfs/backref.c
> @@ -303,7 +303,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
>   	root_key.objectid = ref->root_id;
>   	root_key.type = BTRFS_ROOT_ITEM_KEY;
>   	root_key.offset = (u64)-1;
> -	root = btrfs_read_fs_root_no_name(fs_info, &root_key);
> +	root = btrfs_get_fs_root(fs_info, &root_key, false);
>   	if (IS_ERR(root)) {
>   		ret = PTR_ERR(root);
>   		goto out;

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 835b6c9..ec4a1d2 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -303,7 +303,7 @@  static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
 	root_key.objectid = ref->root_id;
 	root_key.type = BTRFS_ROOT_ITEM_KEY;
 	root_key.offset = (u64)-1;
-	root = btrfs_read_fs_root_no_name(fs_info, &root_key);
+	root = btrfs_get_fs_root(fs_info, &root_key, false);
 	if (IS_ERR(root)) {
 		ret = PTR_ERR(root);
 		goto out;