diff options
author | Jens Axboe <axboe@fb.com> | 2017-02-13 09:37:26 -0700 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-02-13 09:37:26 -0700 |
commit | 53f39eeaa26385ad41ebea3dd6d7b2c14e98369a (patch) | |
tree | 94d5f73e3bbd6e18c5283e3562f3f78fa7a4618d /drivers/block | |
parent | b5093f9c3548fc0b63a4c29be1d9204e645a274b (diff) | |
parent | ecdd09597a57251323b0de50e3d45e69298c4a83 (diff) |
Merge branch 'for-4.11/block' into for-next
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/loop.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index f347285c67ec..304377182c1a 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1097,9 +1097,12 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE) return -EINVAL; + /* I/O need to be drained during transfer transition */ + blk_mq_freeze_queue(lo->lo_queue); + err = loop_release_xfer(lo); if (err) - return err; + goto exit; if (info->lo_encrypt_type) { unsigned int type = info->lo_encrypt_type; @@ -1114,12 +1117,14 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) err = loop_init_xfer(lo, xfer, info); if (err) - return err; + goto exit; if (lo->lo_offset != info->lo_offset || lo->lo_sizelimit != info->lo_sizelimit) - if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) - return -EFBIG; + if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) { + err = -EFBIG; + goto exit; + } loop_config_discard(lo); @@ -1156,7 +1161,9 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info) /* update dio if lo_offset or transfer is changed */ __loop_update_dio(lo, lo->use_dio); - return 0; + exit: + blk_mq_unfreeze_queue(lo->lo_queue); + return err; } static int |