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

[Xen-changelog] [linux-2.6.18-xen] pvscsi: add retry in REPORT_LUN emulation



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216803464 -3600
# Node ID 3bcc901cbd7a45c96520b6a99d483a349169cbd4
# Parent  8a3dc4fdb4785447398e983c22241c38f128663b
pvscsi: add retry in REPORT_LUN emulation

Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
 drivers/xen/scsiback/emulate.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff -r 8a3dc4fdb478 -r 3bcc901cbd7a drivers/xen/scsiback/emulate.c
--- a/drivers/xen/scsiback/emulate.c    Tue Jul 22 11:59:42 2008 +0100
+++ b/drivers/xen/scsiback/emulate.c    Wed Jul 23 09:57:44 2008 +0100
@@ -73,8 +73,6 @@
 #define VSCSI_MAX_SCSI_OP_CODE         256
 static unsigned char bitmap[VSCSI_MAX_SCSI_OP_CODE];
 
-/* REPORT LUNS Header*/
-#define VSCSI_REPORT_LUNS_HEADER       8
 
 
 /*
@@ -200,6 +198,11 @@ static int __nr_luns_under_host(struct v
 
        return (lun_cnt);
 }
+
+
+/* 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)
@@ -215,6 +218,7 @@ 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;
        
@@ -231,7 +235,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 = kmalloc(alloc_len, GFP_KERNEL)) == NULL) {
                printk(KERN_ERR "scsiback:%s kmalloc err\n", __FUNCTION__);
                goto fail;
@@ -246,8 +250,19 @@ static void __report_luns(pending_req_t 
                    (entry->v.tgt == target)) {
                        
                        /* check overflow */
-                       if (lun_cnt >= alloc_luns)
+                       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;
+                       }
 
                        lun = entry->v.lun;
                        upper = (lun >> 8) & 0x3f;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.