Re: [PATCH 001 of 9] md: Fix deadlock in md/raid1 and md/raid10 when handling a read error.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andre Noll said:     (by the date of Thu, 6 Mar 2008 11:51:34 +0100)

> But is that enough to avoid the deadlock? I think the following
> scenario would be possible with the code in the original patch:
> 
> 	// suppose conf->pending_bio_list.head==NULL ATM
> 
> 	CPU0:
> 	int rv = 0;
> 	spin_lock_irq(&conf->device_lock);
> 	if (conf->pending_bio_list.head) // false
> 	spin_unlock_irq(&conf->device_lock);
> 
> 	CPU1:
> 	conf->pending_bio_list.head = something;
> 
> 	CPU0:
> 	return rv; // zero

Remember that it's impossible to predict when is executed what. This
scenario can be true also, will it work?

 	CPU0:
 	int rv = 0;

CPU1:
conf->

	CPU0:
	spin_lock_irq(&conf->device_lock);

CPU1:
->pending_bio_list.

	CPU0:
 	if (conf->pending_bio_list.head) // false

CPU1:
.head = 

	CPU0:
 	spin_unlock_irq(&conf->device_lock);
 	return rv; // zero

CPU1:
= something;


This is exaggerated of course. But if you want to think "concurrent
execution" you must think that way.

-- 
Janek Kozicki                                                         |
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux