diff mbox

[1/1] tcmu: fix module removal due to stuck thread

Message ID 1493787425-6160-1-git-send-email-mchristi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Christie May 3, 2017, 4:57 a.m. UTC
We need to do a kthread_should_stop to check when kthread_stop has been
called.

This was a regression added in

b6df4b79a5514a9c6c53533436704129ef45bf76
tcmu: Add global data block pool support

so not sure if you wanted to merge it in with that patch or what.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/target/target_core_user.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicholas A. Bellinger May 3, 2017, 6:15 a.m. UTC | #1
On Tue, 2017-05-02 at 23:57 -0500, Mike Christie wrote:
> We need to do a kthread_should_stop to check when kthread_stop has been
> called.
> 
> This was a regression added in
> 
> b6df4b79a5514a9c6c53533436704129ef45bf76
> tcmu: Add global data block pool support
> 
> so not sure if you wanted to merge it in with that patch or what.
> 
> Signed-off-by: Mike Christie <mchristi@redhat.com>
> ---
>  drivers/target/target_core_user.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 0b29e4f..72ed6a8 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1530,6 +1530,9 @@ static int unmap_thread_fn(void *data)
>  		schedule();
>  		finish_wait(&unmap_wait, &__wait);
>  
> +		if (kthread_should_stop())
> +			break;
> +
>  		mutex_lock(&root_udev_mutex);
>  		list_for_each_entry(udev, &root_udev, node) {
>  			mutex_lock(&udev->cmdr_lock);

Applied as a stand-alone incremental patch.

Thanks MNC.

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 0b29e4f..72ed6a8 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1530,6 +1530,9 @@  static int unmap_thread_fn(void *data)
 		schedule();
 		finish_wait(&unmap_wait, &__wait);
 
+		if (kthread_should_stop())
+			break;
+
 		mutex_lock(&root_udev_mutex);
 		list_for_each_entry(udev, &root_udev, node) {
 			mutex_lock(&udev->cmdr_lock);