diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-09 11:01:49 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-09 11:01:49 +1000 |
commit | fa625c1956830c826ebf13324c2b33fcabef7db0 (patch) | |
tree | 92c7f1272617c5c6a82478ba161af97eae0260cd /fs/btrfs/extent-tree.c | |
parent | 66fd7a66e8b9e11e49f46ea77910f935c4dee5c3 (diff) | |
parent | af8c34ce6ae32addda3788d54a7e340cad22516b (diff) |
Backmerge tag 'v4.7-rc2' into drm-next
Daniel has a pull request that relies on stuff in fixes that are in rc2.
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a400951e8678..689d25ac6a68 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2042,6 +2042,11 @@ int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, struct btrfs_bio *bbio = NULL; + /* + * Avoid races with device replace and make sure our bbio has devices + * associated to its stripes that don't go away while we are discarding. + */ + btrfs_bio_counter_inc_blocked(root->fs_info); /* Tell the block device(s) that the sectors can be discarded */ ret = btrfs_map_block(root->fs_info, REQ_DISCARD, bytenr, &num_bytes, &bbio, 0); @@ -2074,6 +2079,7 @@ int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr, } btrfs_put_bbio(bbio); } + btrfs_bio_counter_dec(root->fs_info); if (actual_bytes) *actual_bytes = discarded_bytes; |