File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -1251,28 +1251,26 @@ static inline int scsi_dev_queue_ready(struct request_queue *q,
1251
1251
int token ;
1252
1252
1253
1253
token = sbitmap_get (& sdev -> budget_map );
1254
- if (atomic_read (& sdev -> device_blocked )) {
1255
- if (token < 0 )
1256
- goto out ;
1254
+ if (token < 0 )
1255
+ return -1 ;
1257
1256
1258
- if (scsi_device_busy ( sdev ) > 1 )
1259
- goto out_dec ;
1257
+ if (! atomic_read ( & sdev -> device_blocked ) )
1258
+ return token ;
1260
1259
1261
- /*
1262
- * unblock after device_blocked iterates to zero
1263
- */
1264
- if (atomic_dec_return (& sdev -> device_blocked ) > 0 )
1265
- goto out_dec ;
1266
- SCSI_LOG_MLQUEUE (3 , sdev_printk (KERN_INFO , sdev ,
1267
- "unblocking device at zero depth\n" ));
1260
+ /*
1261
+ * Only unblock if no other commands are pending and
1262
+ * if device_blocked has decreased to zero
1263
+ */
1264
+ if (scsi_device_busy (sdev ) > 1 ||
1265
+ atomic_dec_return (& sdev -> device_blocked ) > 0 ) {
1266
+ sbitmap_put (& sdev -> budget_map , token );
1267
+ return -1 ;
1268
1268
}
1269
1269
1270
+ SCSI_LOG_MLQUEUE (3 , sdev_printk (KERN_INFO , sdev ,
1271
+ "unblocking device at zero depth\n" ));
1272
+
1270
1273
return token ;
1271
- out_dec :
1272
- if (token >= 0 )
1273
- sbitmap_put (& sdev -> budget_map , token );
1274
- out :
1275
- return -1 ;
1276
1274
}
1277
1275
1278
1276
/*
You can’t perform that action at this time.
0 commit comments