diff mbox series

vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()

Message ID 1510186649-9765-1-git-send-email-byungchul.park@lge.com
State Not Applicable, archived
Delegated to: David Miller
Headers show
Series vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work() | expand

Commit Message

Byungchul Park Nov. 9, 2017, 12:17 a.m. UTC
I am sorry for having made a mistake on it.

-----8<-----
From ba9a0f76dffceffa4fa3aa2d9be49cdb0d9b7d4f Mon Sep 17 00:00:00 2001
From: Byungchul Park <byungchul.park@lge.com>
Date: Thu, 9 Nov 2017 09:00:21 +0900
Subject: [PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()

The following patch changed the behavior which originally did safe
iteration. Make it safe as it was.

   12bdcbd539c6327c09da0503c674733cb2d82cb5
   vhost/scsi: Don't reinvent the wheel but use existing llist API

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 drivers/vhost/scsi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Byungchul Park Nov. 15, 2017, 11:52 p.m. UTC | #1
On Thu, Nov 09, 2017 at 09:17:29AM +0900, Byungchul Park wrote:
> I am sorry for having made a mistake on it.

Hello Nicholas,

Please consider this patch urgently. I'm sorry for having changed the
original behavior with the previous patch.

The safe version of llist API should be used to keep the original
behavior.

Thanks,
Byungchul

> -----8<-----
> >From ba9a0f76dffceffa4fa3aa2d9be49cdb0d9b7d4f Mon Sep 17 00:00:00 2001
> From: Byungchul Park <byungchul.park@lge.com>
> Date: Thu, 9 Nov 2017 09:00:21 +0900
> Subject: [PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
> 
> The following patch changed the behavior which originally did safe
> iteration. Make it safe as it was.
> 
>    12bdcbd539c6327c09da0503c674733cb2d82cb5
>    vhost/scsi: Don't reinvent the wheel but use existing llist API
> 
> Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> ---
>  drivers/vhost/scsi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> index 046f6d2..46539ca 100644
> --- a/drivers/vhost/scsi.c
> +++ b/drivers/vhost/scsi.c
> @@ -519,7 +519,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
>  					vs_completion_work);
>  	DECLARE_BITMAP(signal, VHOST_SCSI_MAX_VQ);
>  	struct virtio_scsi_cmd_resp v_rsp;
> -	struct vhost_scsi_cmd *cmd;
> +	struct vhost_scsi_cmd *cmd, *t;
>  	struct llist_node *llnode;
>  	struct se_cmd *se_cmd;
>  	struct iov_iter iov_iter;
> @@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
>  
>  	bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
>  	llnode = llist_del_all(&vs->vs_completion_list);
> -	llist_for_each_entry(cmd, llnode, tvc_completion_list) {
> +	llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) {
>  		se_cmd = &cmd->tvc_se_cmd;
>  
>  		pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,
> -- 
> 1.9.1
Michael S. Tsirkin Nov. 16, 2017, 1:30 a.m. UTC | #2
On Thu, Nov 16, 2017 at 08:52:39AM +0900, Byungchul Park wrote:
> On Thu, Nov 09, 2017 at 09:17:29AM +0900, Byungchul Park wrote:
> > I am sorry for having made a mistake on it.
> 
> Hello Nicholas,
> 
> Please consider this patch urgently. I'm sorry for having changed the
> original behavior with the previous patch.
> 
> The safe version of llist API should be used to keep the original
> behavior.
> 
> Thanks,
> Byungchul

I have included this patch in my tree.

> > -----8<-----
> > >From ba9a0f76dffceffa4fa3aa2d9be49cdb0d9b7d4f Mon Sep 17 00:00:00 2001
> > From: Byungchul Park <byungchul.park@lge.com>
> > Date: Thu, 9 Nov 2017 09:00:21 +0900
> > Subject: [PATCH] vhost/scsi: Use safe iteration in vhost_scsi_complete_cmd_work()
> > 
> > The following patch changed the behavior which originally did safe
> > iteration. Make it safe as it was.
> > 
> >    12bdcbd539c6327c09da0503c674733cb2d82cb5
> >    vhost/scsi: Don't reinvent the wheel but use existing llist API
> > 
> > Signed-off-by: Byungchul Park <byungchul.park@lge.com>
> > ---
> >  drivers/vhost/scsi.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
> > index 046f6d2..46539ca 100644
> > --- a/drivers/vhost/scsi.c
> > +++ b/drivers/vhost/scsi.c
> > @@ -519,7 +519,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
> >  					vs_completion_work);
> >  	DECLARE_BITMAP(signal, VHOST_SCSI_MAX_VQ);
> >  	struct virtio_scsi_cmd_resp v_rsp;
> > -	struct vhost_scsi_cmd *cmd;
> > +	struct vhost_scsi_cmd *cmd, *t;
> >  	struct llist_node *llnode;
> >  	struct se_cmd *se_cmd;
> >  	struct iov_iter iov_iter;
> > @@ -527,7 +527,7 @@ static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
> >  
> >  	bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
> >  	llnode = llist_del_all(&vs->vs_completion_list);
> > -	llist_for_each_entry(cmd, llnode, tvc_completion_list) {
> > +	llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) {
> >  		se_cmd = &cmd->tvc_se_cmd;
> >  
> >  		pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,
> > -- 
> > 1.9.1
Byungchul Park Nov. 16, 2017, 1:33 a.m. UTC | #3
On 11/16/2017 10:30 AM, Michael S. Tsirkin wrote:
> On Thu, Nov 16, 2017 at 08:52:39AM +0900, Byungchul Park wrote:
>> On Thu, Nov 09, 2017 at 09:17:29AM +0900, Byungchul Park wrote:
>>> I am sorry for having made a mistake on it.
>>
>> Hello Nicholas,
>>
>> Please consider this patch urgently. I'm sorry for having changed the
>> original behavior with the previous patch.
>>
>> The safe version of llist API should be used to keep the original
>> behavior.
>>
>> Thanks,
>> Byungchul
> 
> I have included this patch in my tree.

Thank you.
diff mbox series

Patch

diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 046f6d2..46539ca 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -519,7 +519,7 @@  static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
 					vs_completion_work);
 	DECLARE_BITMAP(signal, VHOST_SCSI_MAX_VQ);
 	struct virtio_scsi_cmd_resp v_rsp;
-	struct vhost_scsi_cmd *cmd;
+	struct vhost_scsi_cmd *cmd, *t;
 	struct llist_node *llnode;
 	struct se_cmd *se_cmd;
 	struct iov_iter iov_iter;
@@ -527,7 +527,7 @@  static void vhost_scsi_complete_cmd_work(struct vhost_work *work)
 
 	bitmap_zero(signal, VHOST_SCSI_MAX_VQ);
 	llnode = llist_del_all(&vs->vs_completion_list);
-	llist_for_each_entry(cmd, llnode, tvc_completion_list) {
+	llist_for_each_entry_safe(cmd, t, llnode, tvc_completion_list) {
 		se_cmd = &cmd->tvc_se_cmd;
 
 		pr_debug("%s tv_cmd %p resid %u status %#02x\n", __func__,