Message ID | 20200709083333.137927-1-wqu@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/2] btrfs: avoid possible signal interruption for btrfs_drop_snapshot() on relocation tree | expand |
On Thu, Jul 09, 2020 at 04:33:32PM +0800, Qu Wenruo wrote: > From the mentioned forced read-only, to later balance error due to half > dropped reloc trees. > > [FIX] > Fix this problem by using btrfs_join_transaction() if > btrfs_drop_snapshot() is called from relocation context. > > As btrfs_join_transaction() won't wait full tickets, it won't get > interrupted from signal. Could you please rephrase the text above?
On 2020/7/9 下午7:05, David Sterba wrote: > On Thu, Jul 09, 2020 at 04:33:32PM +0800, Qu Wenruo wrote: > >> From the mentioned forced read-only, to later balance error due to half >> dropped reloc trees. >> >> [FIX] >> Fix this problem by using btrfs_join_transaction() if >> btrfs_drop_snapshot() is called from relocation context. >> >> As btrfs_join_transaction() won't wait full tickets, it won't get >> interrupted from signal. > > Could you please rephrase the text above? > How about this: As btrfs_join_transaction() won't reserve new metadata space, it won't get interrupted by signal at all. Thanks, Qu
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index c0bc35f932bf..d8ef48a807d1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5298,7 +5298,10 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int update_ref, int for_reloc) goto out; } - trans = btrfs_start_transaction(tree_root, 0); + if (for_reloc) + trans = btrfs_join_transaction(tree_root); + else + trans = btrfs_start_transaction(tree_root, 0); if (IS_ERR(trans)) { err = PTR_ERR(trans); goto out_free;