Skip to content

Commit db983f6

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: core: Also call destroy_rcu_head() for passthrough requests
cmd->rcu is initialized by scsi_initialize_rq(). For passthrough requests, blk_get_request() calls scsi_initialize_rq(). For filesystem requests, scsi_init_command() calls scsi_initialize_rq(). Make sure that destroy_rcu_head() is called for passthrough requests. Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Ewan D. Milne <emilne@redhat.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Reported-by: Ewan D. Milne <emilne@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 165aa2b commit db983f6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,16 @@ static bool scsi_end_request(struct request *req, blk_status_t error,
585585
if (!blk_rq_is_scsi(req)) {
586586
WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED));
587587
cmd->flags &= ~SCMD_INITIALIZED;
588-
destroy_rcu_head(&cmd->rcu);
589588
}
590589

590+
/*
591+
* Calling rcu_barrier() is not necessary here because the
592+
* SCSI error handler guarantees that the function called by
593+
* call_rcu() has been called before scsi_end_request() is
594+
* called.
595+
*/
596+
destroy_rcu_head(&cmd->rcu);
597+
591598
/*
592599
* In the MQ case the command gets freed by __blk_mq_end_request,
593600
* so we have to do all cleanup that depends on it earlier.

0 commit comments

Comments
 (0)