From: Bart Van Assche <bart.vanassche@wdc.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Bart Van Assche <bart.vanassche@wdc.com>,
Shaohua Li <shli@kernel.org>
Subject: [PATCH v5 2/6] md: Delete gendisk before cleaning up the request queue
Date: Wed, 28 Feb 2018 10:15:29 -0800 [thread overview]
Message-ID: <20180228181533.29402-3-bart.vanassche@wdc.com> (raw)
In-Reply-To: <20180228181533.29402-1-bart.vanassche@wdc.com>
Remove the disk, partition and bdi sysfs attributes before cleaning up
the request queue associated with the disk.
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Shaohua Li <shli@kernel.org>
---
drivers/md/md.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index bc67ab6844f0..eba7fa2f0abb 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5203,12 +5203,12 @@ static void md_free(struct kobject *ko)
if (mddev->sysfs_state)
sysfs_put(mddev->sysfs_state);
+ if (mddev->gendisk)
+ del_gendisk(mddev->gendisk);
if (mddev->queue)
blk_cleanup_queue(mddev->queue);
- if (mddev->gendisk) {
- del_gendisk(mddev->gendisk);
+ if (mddev->gendisk)
put_disk(mddev->gendisk);
- }
percpu_ref_exit(&mddev->writes_pending);
kfree(mddev);
--
2.16.2
next prev parent reply other threads:[~2018-02-28 18:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-28 18:15 [PATCH v5 0/6] Fix races between blkcg code and request queue initialization and cleanup Bart Van Assche
2018-02-28 18:15 ` [PATCH v5 1/6] block/loop: Delete gendisk before cleaning up the request queue Bart Van Assche
2018-02-28 18:15 ` Bart Van Assche [this message]
2018-02-28 18:15 ` [PATCH v5 3/6] zram: " Bart Van Assche
2018-02-28 18:15 ` [PATCH v5 4/6] block: Add 'lock' as third argument to blk_alloc_queue_node() Bart Van Assche
2018-02-28 18:15 ` [PATCH v5 5/6] block: Fix a race between the cgroup code and request queue initialization Bart Van Assche
2018-02-28 18:15 ` [PATCH v5 6/6] block: Fix a race between request queue removal and the block cgroup controller Bart Van Assche
2018-02-28 18:19 ` [PATCH v5 0/6] Fix races between blkcg code and request queue initialization and cleanup Jens Axboe
2018-02-28 19:01 ` Bart Van Assche
2018-02-28 19:08 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180228181533.29402-3-bart.vanassche@wdc.com \
--to=bart.vanassche@wdc.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=shli@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox