Skip to contentSkip to conversation

raid5_end_write_request spinlock fix

PATCH In review Qi Yong 2 participants 2 messages Apr 21, 2006 – Apr 22, 2006 MD RAID

lore
Share & tools
lore

Qi Yong

author
#0 lore raw

PATCH 1/1 raid5_end_write_request spinlock fix

Hello,

Reduce the raid5_end_write_request() spinlock window.

---

drivers/md/raid5.c +2 -5
index 3184360..9c24377 100644
@@ -581,7 +581,6 @@ static int raid5_end_write_request (stru
  	struct stripe_head *sh = bi->bi_private;
 	raid5_conf_t *conf = sh->raid_conf;
 	int disks = sh->disks, i;
-	unsigned long flags;
 	int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags);
 
 	if (bi->bi_size)
@@ -599,16 +598,14 @@ static int raid5_end_write_request (stru
 		return 0;
 	}
 
-	spin_lock_irqsave(&conf->device_lock, flags);
 	if (!uptodate)
 		md_error(conf->mddev, conf->disks[i].rdev);
 
 	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
-	
 	clear_bit(R5_LOCKED, &sh->dev[i].flags);
 	set_bit(STRIPE_HANDLE, &sh->state);
-	__release_stripe(conf, sh);
-	spin_unlock_irqrestore(&conf->device_lock, flags);
+	release_stripe(sh);
+
 	return 0;
 }
 
Signature · 1 line
Coywolf Qi Hunt
#1 lore raw
Quoted 3 lines · On Friday April 21, [email protected] wrote:

Hello,

Reduce the raid5_end_write_request() spinlock window.

Thank you for reviewing the md code and suggesting improvements. However it would help if you used a few more words to describe your patches. E.g. explain why you are convinced that it is safe to reduce the range of the lock like this.

NeilBrown

Quoted 38 lines

---

drivers/md/raid5.c +2 -5
index 3184360..9c24377 100644
@@ -581,7 +581,6 @@ static int raid5_end_write_request (stru
  	struct stripe_head *sh = bi->bi_private;
 	raid5_conf_t *conf = sh->raid_conf;
 	int disks = sh->disks, i;
-	unsigned long flags;
 	int uptodate = test_bit(BIO_UPTODATE, &bi->bi_flags);
 
 	if (bi->bi_size)
@@ -599,16 +598,14 @@ static int raid5_end_write_request (stru
 		return 0;
 	}
 
-	spin_lock_irqsave(&conf->device_lock, flags);
 	if (!uptodate)
 		md_error(conf->mddev, conf->disks[i].rdev);
 
 	rdev_dec_pending(conf->disks[i].rdev, conf->mddev);
-	
 	clear_bit(R5_LOCKED, &sh->dev[i].flags);
 	set_bit(STRIPE_HANDLE, &sh->state);
-	__release_stripe(conf, sh);
-	spin_unlock_irqrestore(&conf->device_lock, flags);
+	release_stripe(sh);
+
 	return 0;
 }
 
Signature · 2 lines
-- 
Coywolf Qi Hunt