On mon, 13 Jan 2014 19:27:45 +0100, David Sterba wrote:
> On Tue, Jan 07, 2014 at 05:25:19PM +0800, Wang Shilong wrote:
>> --- a/fs/btrfs/transaction.c
>> +++ b/fs/btrfs/transaction.c
>> @@ -1971,6 +1971,19 @@ int btrfs_clean_one_deleted_snapshot(struct btrfs_root *root)
>> }
>> root = list_first_entry(&fs_info->dead_roots,
>> struct btrfs_root, root_list);
>
> You're pulling the root from dead_roots here ...
>
>> + /*
>> + * Make sure root is not involved in send,
>
> ... and there's no way to send such a thing.
The root what is about to be sent out may be deleted after we get it, if
there is no in-memory i-node in it, it will be inserted into the dead_roots list
immediately, then the cleaner thread will drop it. But the sender doesn't know,
the sender will access a broken tree.
Thanks
Miao
>
>> + * if we fail with first root, we return
>> + * directly rather than continue.
>> + */
>> + spin_lock(&root->root_item_lock);
>> + if (root->send_in_progress) {
>> + spin_unlock(&fs_info->trans_lock);
>> + spin_unlock(&root->root_item_lock);
>> + return 0;
>> + }
>> + spin_unlock(&root->root_item_lock);
>> +
>> list_del_init(&root->root_list);
>> spin_unlock(&fs_info->trans_lock);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html