From: Miao Xie <miaox@cn.fujitsu.com>
To: dsterba@suse.cz, Wang Shilong <wangsl.fnst@cn.fujitsu.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Btrfs: fix protection between send and root deletion
Date: Tue, 14 Jan 2014 10:22:56 +0800 [thread overview]
Message-ID: <52D49F80.6020604@cn.fujitsu.com> (raw)
In-Reply-To: <20140113182745.GS6498@twin.jikos.cz>
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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-01-14 2:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 9:25 [PATCH v2 1/4] Btrfs: fix wrong send_in_progress accounting Wang Shilong
2014-01-07 9:25 ` [PATCH v2 2/4] Btrfs: fix protection between send and root deletion Wang Shilong
2014-01-13 18:27 ` David Sterba
2014-01-14 2:22 ` Miao Xie [this message]
2014-01-15 16:40 ` David Sterba
2014-01-16 2:32 ` Miao Xie
2014-01-21 18:16 ` David Sterba
2014-01-22 8:44 ` Wang Shilong
2014-01-22 12:43 ` David Sterba
2014-01-08 12:16 ` [PATCH v2 1/4] Btrfs: fix wrong send_in_progress accounting David Sterba
2014-01-08 15:09 ` Wang Shilong
2014-01-13 18:40 ` David Sterba
2014-01-14 11:52 ` Wang Shilong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52D49F80.6020604@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wangsl.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.