Message ID | 20230118180557.1212577-1-bvanassche@acm.org |
---|---|
State | New |
Headers | show |
Series | scsi: device_handler: alua: Remove a might_sleep() annotation | expand |
Bart, > The might_sleep() annotation in alua_rtpg_queue() is not correct since > the command completion code may call this function from atomic > context. Calling alua_rtpg_queue() from atomic context in the command > completion path is fine since request submitters must hold an sdev > reference until command execution has completed. This patch fixes the > following kernel complaint: Applied to 6.2/scsi-fixes, thanks!
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 55a5073248f8..362fa631f39b 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -987,6 +987,9 @@ static void alua_rtpg_work(struct work_struct *work) * * Returns true if and only if alua_rtpg_work() will be called asynchronously. * That function is responsible for calling @qdata->fn(). + * + * Context: may be called from atomic context (alua_check()) only if the caller + * holds an sdev reference. */ static bool alua_rtpg_queue(struct alua_port_group *pg, struct scsi_device *sdev, @@ -995,8 +998,6 @@ static bool alua_rtpg_queue(struct alua_port_group *pg, int start_queue = 0; unsigned long flags; - might_sleep(); - if (WARN_ON_ONCE(!pg) || scsi_device_get(sdev)) return false;