All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][linux 2.6.18] remove pointless error handling in scsiback
@ 2014-07-02  7:26 jgross
  2014-07-02 11:57 ` Jan Beulich
  0 siblings, 1 reply; 11+ messages in thread
From: jgross @ 2014-07-02  7:26 UTC (permalink / raw)
  To: xen-devel, jbeulich; +Cc: Juergen Gross

From: Juergen Gross <jgross@suse.com>

Changeset 610:3bcc901cbd7a added a retry logic for reporting LUNs to the
frontend. The idea was to retry the operation if a LUN was added between
counting the LUNs (needed for calculating the needed buffer size) and
processing them (filling the buffer). The number of retries was limited to
three. Reasoning was "one error is very unlikely, 4 of them are way off".

Unfortunately above changeset was wrong: The retry didn't include recounting
the LUNs, so the buffer size would not be changed. The number of found was not
resetted, so the first found LUN would again trigger the retry logic until the
number of retries would be exhausted.

While one error is really very unlikely (there was no report of failure and
as shown above, the first error would have led to failure at once), even in
case of a correct retry logic following errors are not completely impossible:
If a target with many LUNs is being added to the frontend, the single LUNs are
added one after another. A parallel running "report LUNs" could see a fast
increasing number of LUNs, so even a few retries might fail.

So just remove the retry logic again.

Signed-off-by: Juergen Gross <jgross@suse.com>

diff -r 0251893a7d5a drivers/xen/scsiback/emulate.c
--- a/drivers/xen/scsiback/emulate.c	Mon Jun 16 16:11:33 2014 +0200
+++ b/drivers/xen/scsiback/emulate.c	Wed Jul 02 09:10:49 2014 +0200
@@ -212,7 +212,6 @@ static int __nr_luns_under_host(struct v
 
 /* REPORT LUNS Define*/
 #define VSCSI_REPORT_LUNS_HEADER	8
-#define VSCSI_REPORT_LUNS_RETRY		3
 
 /* quoted scsi_debug.c/resp_report_luns() */
 static void __report_luns(pending_req_t *pending_req, void *data)
@@ -228,7 +227,6 @@ static void __report_luns(pending_req_t 
 	unsigned int alloc_luns = 0;
 	unsigned int req_bufflen = 0;
 	unsigned int actual_len = 0;
-	unsigned int retry_cnt = 0;
 	int select_report = (int)cmd[2];
 	int i, lun_cnt = 0, lun, upper, err = 0;
 	
@@ -245,7 +243,7 @@ static void __report_luns(pending_req_t 
 	alloc_luns = __nr_luns_under_host(info);
 	alloc_len  = sizeof(struct scsi_lun) * alloc_luns
 				+ VSCSI_REPORT_LUNS_HEADER;
-retry:
+
 	if ((buff = kzalloc(alloc_len, GFP_KERNEL)) == NULL) {
 		printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
 		goto fail;
@@ -261,14 +259,6 @@ retry:
 			if (lun_cnt >= alloc_luns) {
 				spin_unlock_irqrestore(&info->v2p_lock,
 							flags);
-
-				if (retry_cnt < VSCSI_REPORT_LUNS_RETRY) {
-					retry_cnt++;
-					if (buff)
-						kfree(buff);
-					goto retry;
-				}
-
 				goto fail;
 			}

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH][linux 2.6.18] remove pointless error handling in scsiback
@ 2014-07-01 15:27 jgross
  2014-07-01 15:39 ` Jan Beulich
  0 siblings, 1 reply; 11+ messages in thread
From: jgross @ 2014-07-01 15:27 UTC (permalink / raw)
  To: xen-devel, jbeulich; +Cc: Juergen Gross

From: Juergen Gross <jgross@suse.com>

It makes no sense to try repeating traversing the lun list in case of a
possible mismatch between the original counting of luns and the real processing.

To make things worse, the retry itself was wrong as the number of detected
luns was not resetted for the retry leading to the next failing retry at once.

Signed-off-by: Juergen Gross <jgross@suse.com>


diff -r 0251893a7d5a drivers/xen/scsiback/emulate.c
--- a/drivers/xen/scsiback/emulate.c	Mon Jun 16 16:11:33 2014 +0200
+++ b/drivers/xen/scsiback/emulate.c	Tue Jul 01 17:19:27 2014 +0200
@@ -228,7 +228,6 @@ static void __report_luns(pending_req_t 
 	unsigned int alloc_luns = 0;
 	unsigned int req_bufflen = 0;
 	unsigned int actual_len = 0;
-	unsigned int retry_cnt = 0;
 	int select_report = (int)cmd[2];
 	int i, lun_cnt = 0, lun, upper, err = 0;
 	
@@ -245,7 +244,7 @@ static void __report_luns(pending_req_t 
 	alloc_luns = __nr_luns_under_host(info);
 	alloc_len  = sizeof(struct scsi_lun) * alloc_luns
 				+ VSCSI_REPORT_LUNS_HEADER;
-retry:
+
 	if ((buff = kzalloc(alloc_len, GFP_KERNEL)) == NULL) {
 		printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
 		goto fail;
@@ -261,14 +260,6 @@ retry:
 			if (lun_cnt >= alloc_luns) {
 				spin_unlock_irqrestore(&info->v2p_lock,
 							flags);
-
-				if (retry_cnt < VSCSI_REPORT_LUNS_RETRY) {
-					retry_cnt++;
-					if (buff)
-						kfree(buff);
-					goto retry;
-				}
-
 				goto fail;
 			}

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-07-02 12:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-02  7:26 [PATCH][linux 2.6.18] remove pointless error handling in scsiback jgross
2014-07-02 11:57 ` Jan Beulich
2014-07-02 12:13   ` Jürgen Groß
2014-07-02 12:27     ` Jan Beulich
2014-07-02 12:33       ` Jan Beulich
2014-07-02 12:38         ` Jürgen Groß
  -- strict thread matches above, loose matches on Subject: below --
2014-07-01 15:27 jgross
2014-07-01 15:39 ` Jan Beulich
2014-07-01 18:51   ` Jürgen Groß
2014-07-02  6:52     ` Jan Beulich
2014-07-02  7:08       ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.