On Mon, Jan 06, 2014 at 05:25:37PM +0800, Wang Shilong wrote:
> We should gurantee that parent and clone root can not be destroyed
> during send, for this we have two ideas.
> 
> 1.by holding @subvol_sem, this might be a nightmare, because it will
> block all subvolumes deletion for a long time.
> 
> 2.Miao pointed out we can reuse @send_in_progress, that mean we will
> skip snapshot deletion if root sending is in progress.
> 
> Here we adopt the second approach since it won't block other subvolumes
> deletion for a long time.

Agreed, good idea protecting against the deletion during send.

>  static inline int btrfs_need_cleaner_sleep(struct btrfs_root *root)
>  {
> +     spin_lock(&root->root_item_lock);
> +     if (root->send_in_progress) {
> +             spin_unlock(&root->root_item_lock);
> +             return 1;
> +     }
> +     spin_unlock(&root->root_item_lock);

Whi is this needed? btrfs_need_cleaner_sleep needs only fs_info.

* when called from cleaner_kthread it gets the tree_root
* when called from btrfs_drop_snapshot it's a reloc_root

neither of which is ever subject to send.


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

Reply via email to