Skip to contentSkip to conversation

nbd: clean up error handling

PATCH Pavel Machek 2 participants 3 messages Dec 18, 2008 – Dec 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Uses existing error_out: label instead of hardcoding error action.

---
commit d4bf0663fe12e5536360b2b9a3df3f49cdb7ef76
tree b5b88ccf8008e135a972415f186b8a93cecb184c
parent 70b683565a6bfdb95a367b47509c2bc5db54c33f
author Pavel <[email protected]> Thu, 18 Dec 2008 19:20:21 +0100 committer Pavel <[email protected]> Thu, 18 Dec 2008 19:20:21 +0100

 drivers/block/nbd.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
drivers/block/nbd.c +3 -6
index d3a91ca..f0b8ee2 100644
@@ -465,9 +465,7 @@ static void nbd_handle_req(struct nbd_de
 		mutex_unlock(&lo->tx_lock);
 		printk(KERN_ERR "%s: Attempted send on closed socket\n",
 		       lo->disk->disk_name);
-		req->errors++;
-		nbd_end_request(req);
-		return;
+		goto error_out;
 	}
 
 	lo->active_req = req;
@@ -475,8 +473,7 @@ static void nbd_handle_req(struct nbd_de
 	if (nbd_send_req(lo, req) != 0) {
 		printk(KERN_ERR "%s: Request send failed\n",
 				lo->disk->disk_name);
-		req->errors++;
-		nbd_end_request(req);
+		goto error_out;
 	} else {
 		spin_lock(&lo->queue_lock);
 		list_add(&req->queuelist, &lo->queue_head);
@@ -563,7 +560,7 @@ static int nbd_ioctl(struct block_device
 	struct nbd_device *lo = bdev->bd_disk->private_data;
 	struct file *file;
 	int error;
-	struct request sreq ;
+	struct request sreq;
 	struct task_struct *thread;
 
 	if (!capable(CAP_SYS_ADMIN))
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hi Pavel,

hanks for the patch...

drivers/block/nbd.c static void nbd_handle_req(struct nbd_de · line 476

Quoted 11 lines · Pavel Machek

Uses existing error_out: label instead of hardcoding error action.

drivers/block/nbd.c +1 -2
@@ -475,8 +473,7 @@ static void nbd_handle_req(struct nbd_de
 	if (nbd_send_req(lo, req) != 0) {
 		printk(KERN_ERR "%s: Request send failed\n",
 				lo->disk->disk_name);
-		req->errors++;
-		nbd_end_request(req);
+		goto error_out;

This one is not correct. We don't return immediately here.

--
Paul

#2 lore raw
Quoted 9 lines · Paul Clements

Hi Pavel,

hanks for the patch...

Quoted 3 lines · Pavel Machek

Uses existing error_out: label instead of hardcoding error action.

Quoted 9 lines

drivers/block/nbd.c static void nbd_handle_req(struct nbd_de · line 476

Quoted 7 lines
drivers/block/nbd.c +1 -2
@@ -475,8 +473,7 @@ static void nbd_handle_req(struct nbd_de
 	if (nbd_send_req(lo, req) != 0) {
 		printk(KERN_ERR "%s: Request send failed\n",
 				lo->disk->disk_name);
-		req->errors++;
-		nbd_end_request(req);
+		goto error_out;

This one is not correct. We don't return immediately here.

Sorry about that. Will do next series shortly...
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html