patch-2.3.35 linux/drivers/scsi/scsi_lib.c

Next file: linux/drivers/scsi/scsi_merge.c
Previous file: linux/drivers/scsi/scsi_error.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.34/linux/drivers/scsi/scsi_lib.c linux/drivers/scsi/scsi_lib.c
@@ -607,6 +607,22 @@
 		if (spnt->blk && spnt->major == major) {
 			return spnt;
 		}
+		/*
+		 * I am still not entirely satisfied with this solution,
+		 * but it is good enough for now.  Disks have a number of
+		 * major numbers associated with them, the primary
+		 * 8, which we test above, and a secondary range of 7
+		 * different consecutive major numbers.   If this ever
+		 * becomes insufficient, then we could add another function
+		 * to the structure, and generalize this completely.
+		 */
+		if( spnt->min_major != 0 
+		    && spnt->max_major != 0
+		    && major >= spnt->min_major
+		    && major <= spnt->max_major )
+		{
+			return spnt;
+		}
 	}
 	return NULL;
 }
@@ -742,11 +758,16 @@
 			if (!SCpnt) {
 				break;
 			}
-			SHpnt->host_busy++;
-			SDpnt->device_busy++;
 		}
 
 		/*
+		 * Now bump the usage count for both the host and the
+		 * device.
+		 */
+		SHpnt->host_busy++;
+		SDpnt->device_busy++;
+
+		/*
 		 * FIXME(eric)
 		 * I am not sure where the best place to do this is.  We need
 		 * to hook in a place where we are likely to come if in user
@@ -821,12 +842,14 @@
 			 * get those allocated here.  
 			 */
 			if (!SDpnt->scsi_init_io_fn(SCpnt)) {
+				spin_lock_irq(&io_request_lock);
 				continue;
 			}
 			/*
 			 * Initialize the actual SCSI command for this request.
 			 */
 			if (!STpnt->init_command(SCpnt)) {
+				spin_lock_irq(&io_request_lock);
 				continue;
 			}
 		}

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen (who was at: [email protected])