Thread (37 messages) 37 messages, 4 authors, 2022-07-19

Re: [PATCH 09/10] md: only delete entries from all_mddevs when the disk is freed

From: Hannes Reinecke <hare@suse.de>
Date: 2022-07-19 07:59:17
Also in: linux-block

On 7/19/22 09:14, Christoph Hellwig wrote:
On Mon, Jul 18, 2022 at 09:17:42AM +0200, Hannes Reinecke wrote:
quoted
Why can't we use 'atomic_inc_unless_zero' here and do away with the
additional 'deleted' flag?
See my previous reply.
quoted
quoted
@@ -3338,6 +3342,8 @@ static bool md_rdev_overlaps(struct md_rdev *rdev)
     	spin_lock(&all_mddevs_lock);
   	list_for_each_entry(mddev, &all_mddevs, all_mddevs) {
+		if (mddev->deleted)
+			continue;
Any particular reason why you can't use the 'mddev_get()' / 'mddev_put()'
sequence here?
Mostly because it would be pretty mess.  mdev_put takes all_mddevs_lock,
so we'd have to add an unlock/relock cycle for each loop iteration.
quoted
After all, I don't think that 'mddev' should vanish while being in this
loop, no?
It won't, at least without the call to mddev_put.  Once mddev_put is
in the game things aren't that easy, and I suspect the exising and
new code might have bugs in that area in the reboot notifier and
md_exit for extreme corner cases.
And again, MD mess.
But thanks for start clearing it up.

Cheers,

Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help