2023-09-22 09:50:41

by Wenchao Hao

[permalink] [raw]
Subject: [PATCH 0/2] cleanup patch

This is a cleanup patchset, no logic changed.

The first patch just cleanup scsi_dev_queue_ready();
The second patch add comment for target_destroy callback of
scsi_host_template to tell it is called in atomic context.

Wenchao Hao (2):
scsi: core: cleanup scsi_dev_queue_ready()
scsi: Add comment of target_destroy in scsi_host_template

drivers/scsi/scsi_lib.c | 35 ++++++++++++++++++-----------------
include/scsi/scsi_host.h | 3 +++
2 files changed, 21 insertions(+), 17 deletions(-)

--
2.32.0


2023-09-22 09:51:28

by Wenchao Hao

[permalink] [raw]
Subject: [PATCH 2/2] scsi: Add comment of target_destroy in scsi_host_template

Add comment to tell callback function target_destroy of
scsi_host_template is called in atomic context.

Signed-off-by: Wenchao Hao <[email protected]>
---
include/scsi/scsi_host.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 49f768d0ff37..a72248fa5adf 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -245,6 +245,9 @@ struct scsi_host_template {
* midlayer calls this point so that the driver may deallocate
* and terminate any references to the target.
*
+ * Note: this callback in called with spin_lock held, so donot
+ * call functions might cause schedule
+ *
* Status: OPTIONAL
*/
void (* target_destroy)(struct scsi_target *);
--
2.32.0

2023-09-22 15:07:25

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH 2/2] scsi: Add comment of target_destroy in scsi_host_template

On 9/22/23 02:38, Wenchao Hao wrote:
> Add comment to tell callback function target_destroy of
> scsi_host_template is called in atomic context.
>
> Signed-off-by: Wenchao Hao <[email protected]>
> ---
> include/scsi/scsi_host.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 49f768d0ff37..a72248fa5adf 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -245,6 +245,9 @@ struct scsi_host_template {
> * midlayer calls this point so that the driver may deallocate
> * and terminate any references to the target.
> *
> + * Note: this callback in called with spin_lock held, so donot
> + * call functions might cause schedule
> + *

This comment should mention which spinlock is held.

Thanks,

Bart.

2023-09-24 06:29:59

by Wenchao Hao

[permalink] [raw]
Subject: Re: [PATCH 2/2] scsi: Add comment of target_destroy in scsi_host_template

On 2023/9/22 22:53, Bart Van Assche wrote:
> On 9/22/23 02:38, Wenchao Hao wrote:
>> Add comment to tell callback function target_destroy of
>> scsi_host_template is called in atomic context.
>>
>> Signed-off-by: Wenchao Hao <[email protected]>
>> ---
>>   include/scsi/scsi_host.h | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
>> index 49f768d0ff37..a72248fa5adf 100644
>> --- a/include/scsi/scsi_host.h
>> +++ b/include/scsi/scsi_host.h
>> @@ -245,6 +245,9 @@ struct scsi_host_template {
>>        * midlayer calls this point so that the driver may deallocate
>>        * and terminate any references to the target.
>>        *
>> +     * Note: this callback in called with spin_lock held, so donot
>> +     * call functions might cause schedule
>> +     *
>
> This comment should mention which spinlock is held.
>

Would update, thanks for your review suggestion.

> Thanks,
>
> Bart.
>
>