]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
scsi: allow passing in null rq to scsi_prep_state_check()
authorMing Lei <ming.lei@redhat.com>
Sat, 14 Oct 2017 09:22:31 +0000 (17:22 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 1 Nov 2017 14:20:02 +0000 (08:20 -0600)
In the following patch, we will implement scsi_get_budget()
which need to call scsi_prep_state_check() when rq isn't
dequeued yet.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/scsi/scsi_lib.c

index 9cf6a80fe29754fc93d96d41edb090db2fdd67f4..d159bb085714483c5efb93d07d1633e63f959429 100644 (file)
@@ -1301,7 +1301,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
                        /*
                         * If the devices is blocked we defer normal commands.
                         */
-                       if (!(req->rq_flags & RQF_PREEMPT))
+                       if (req && !(req->rq_flags & RQF_PREEMPT))
                                ret = BLKPREP_DEFER;
                        break;
                default:
@@ -1310,7 +1310,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
                         * special commands.  In particular any user initiated
                         * command is not allowed.
                         */
-                       if (!(req->rq_flags & RQF_PREEMPT))
+                       if (req && !(req->rq_flags & RQF_PREEMPT))
                                ret = BLKPREP_KILL;
                        break;
                }