Message ID | 20221101150050.3510-2-hch@lst.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/14] block: set the disk capacity to 0 in blk_mark_disk_dead | expand |
On 11/1/22 08:00, Christoph Hellwig wrote: > nvme and xen-blkfront are already doing this to stop buffered writes from > creating dirty pages that can't be written out later. Move it to the > common code. > > This also removes the comment about the ordering from nvme, as bd_mutex > not only is gone entirely, but also hasn't been used for locking updates > to the disk size long before that, and thus the ordering requirement > documented there doesn't apply any more. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > Reviewed-by: Keith Busch <kbusch@kernel.org> > Reviewed-by: Sagi Grimberg <sagi@grimberg.me> > Reviewed-by: Ming Lei <ming.lei@redhat.com> > Reviewed-by: Chao Leng <lengchao@huawei.com> > --- Looks good. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> -ck
On Tue, 1 Nov 2022 16:00:37 +0100, Christoph Hellwig wrote: > nvme and xen-blkfront are already doing this to stop buffered writes from > creating dirty pages that can't be written out later. Move it to the > common code. > > This also removes the comment about the ordering from nvme, as bd_mutex > not only is gone entirely, but also hasn't been used for locking updates > to the disk size long before that, and thus the ordering requirement > documented there doesn't apply any more. > > [...] Applied, thanks! [01/14] block: set the disk capacity to 0 in blk_mark_disk_dead commit: 71b26083d59cd4ab22489829ffe7d4ead93f5546 [02/14] nvme-pci: refactor the tagset handling in nvme_reset_work commit: 0ffc7e98bfaa45380b800deeb9b65ce0371c652d [03/14] nvme: don't remove namespaces in nvme_passthru_end commit: 23a908647efade186576c9628dd7bb560f6e759b [04/14] nvme: remove the NVME_NS_DEAD check in nvme_remove_invalid_namespaces commit: 4f17344e9daeb6e9f89976d811a5373710ed1f04 [05/14] nvme: remove the NVME_NS_DEAD check in nvme_validate_ns commit: fde776afdd8467a09395a7aebdb2499f86315945 [06/14] nvme: don't unquiesce the admin queue in nvme_kill_queues commit: 6bcd5089ee1302e9ad7072ca0866f0c5a1158359 [07/14] nvme: split nvme_kill_queues commit: cd50f9b24726e9e195a0682c8d8d952396d57aef [08/14] nvme-pci: don't unquiesce the I/O queues in nvme_remove_dead_ctrl commit: bad3e021ae2bb5ac9d650c9a04788efe753367f3 [09/14] nvme-apple: don't unquiesce the I/O queues in apple_nvme_reset_work commit: 2b4c2355c5e155cdf341d9ce2c2355b4b26c32c9 [10/14] blk-mq: skip non-mq queues in blk_mq_quiesce_queue commit: 8537380bb9882c201db60a1eb201aac6e74083e8 [11/14] blk-mq: move the srcu_struct used for quiescing to the tagset commit: 80bd4a7aab4c9ce59bf5e35fdf52aa23d8a3c9f5 [12/14] blk-mq: pass a tagset to blk_mq_wait_quiesce_done commit: 483239c75ba768e0e2c0e0c503e5fc13c3d5773a [13/14] blk-mq: add tagset quiesce interface commit: 414dd48e882c5a39e7bd01b096ee6497eb3314b0 [14/14] nvme: use blk_mq_[un]quiesce_tagset commit: 98d81f0df70ce6fc48517d938026e3c684b9051a Best regards,
diff --git a/block/genhd.c b/block/genhd.c index 493b93faee9c8..e7bd036024fab 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -555,6 +555,11 @@ void blk_mark_disk_dead(struct gendisk *disk) { set_bit(GD_DEAD, &disk->state); blk_queue_start_drain(disk->queue); + + /* + * Stop buffered writers from dirtying pages that can't be written out. + */ + set_capacity_and_notify(disk, 0); } EXPORT_SYMBOL_GPL(blk_mark_disk_dead); diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 35b9bcad9db90..b28489290323f 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2129,7 +2129,6 @@ static void blkfront_closing(struct blkfront_info *info) if (info->rq && info->gd) { blk_mq_stop_hw_queues(info->rq); blk_mark_disk_dead(info->gd); - set_capacity(info->gd, 0); } for_each_rinfo(info, rinfo, i) { diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0090dc0b3ae6f..aea0f89acf409 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -5116,10 +5116,7 @@ static void nvme_stop_ns_queue(struct nvme_ns *ns) /* * Prepare a queue for teardown. * - * This must forcibly unquiesce queues to avoid blocking dispatch, and only set - * the capacity to 0 after that to avoid blocking dispatchers that may be - * holding bd_butex. This will end buffered writers dirtying pages that can't - * be synced. + * This must forcibly unquiesce queues to avoid blocking dispatch. */ static void nvme_set_queue_dying(struct nvme_ns *ns) { @@ -5128,8 +5125,6 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) blk_mark_disk_dead(ns->disk); nvme_start_ns_queue(ns); - - set_capacity_and_notify(ns->disk, 0); } /**