* [PATCH] tcmu: wait for nl reply only if there are listeners
@ 2019-02-02 3:01 Mike Christie
2019-02-05 17:46 ` Mike Christie
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Mike Christie @ 2019-02-02 3:01 UTC (permalink / raw)
To: target-devel
genlmsg_multicast_allns used to return -ESRCH even if the message was
successfully sent to a listener. With commit:
commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82
Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue Feb 6 14:48:32 2018 +0100
netlink: ensure to loop over all netns in genlmsg_multicast_allns()
it now will return success if the message was sent to a listener. With
that patch, tcmu can now immediately fail if -ESRCH is returned because
we know there will be no reply.
Signed-off-by: Mike Christie <mchristi@redhat.com>
---
drivers/target/target_core_user.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 5831e0e..dccc13c 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1794,9 +1794,6 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev,
ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
TCMU_MCGRP_CONFIG, GFP_KERNEL);
- /* We don't care if no one is listening */
- if (ret = -ESRCH)
- ret = 0;
if (!ret)
ret = tcmu_wait_genl_cmd_reply(udev);
return ret;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tcmu: wait for nl reply only if there are listeners
2019-02-02 3:01 [PATCH] tcmu: wait for nl reply only if there are listeners Mike Christie
@ 2019-02-05 17:46 ` Mike Christie
2019-02-28 19:28 ` [PATCH] tcmu: wait for nl reply only if there are listeners or during an add Cathy Avery
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mike Christie @ 2019-02-05 17:46 UTC (permalink / raw)
To: target-devel
Martin, I am self nacking this patch for now.
On 02/01/2019 09:01 PM, Mike Christie wrote:
> genlmsg_multicast_allns used to return -ESRCH even if the message was
> successfully sent to a listener. With commit:
>
> commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82
> Author: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Date: Tue Feb 6 14:48:32 2018 +0100
>
> netlink: ensure to loop over all netns in genlmsg_multicast_allns()
>
> it now will return success if the message was sent to a listener. With
> that patch, tcmu can now immediately fail if -ESRCH is returned because
> we know there will be no reply.
>
> Signed-off-by: Mike Christie <mchristi@redhat.com>
>
> ---
> drivers/target/target_core_user.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 5831e0e..dccc13c 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1794,9 +1794,6 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev,
>
> ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
> TCMU_MCGRP_CONFIG, GFP_KERNEL);
> - /* We don't care if no one is listening */
> - if (ret = -ESRCH)
> - ret = 0;
> if (!ret)
> ret = tcmu_wait_genl_cmd_reply(udev);
> return ret;
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
2019-02-02 3:01 [PATCH] tcmu: wait for nl reply only if there are listeners Mike Christie
2019-02-05 17:46 ` Mike Christie
@ 2019-02-28 19:28 ` Cathy Avery
2019-03-01 21:17 ` Mike Christie
2019-03-06 17:37 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Cathy Avery @ 2019-02-28 19:28 UTC (permalink / raw)
To: target-devel
genlmsg_multicast_allns now returns the correct statuses when a
message is sent to a listener. However in the case of adding a
device we want to wait for the listener otherwise we may miss the
the device during startup.
Signed-off-by: Cathy Avery <cavery@redhat.com>
---
drivers/target/target_core_user.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 5831e0eecea1..2d3f8f5403d8 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1794,11 +1794,12 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev,
ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
TCMU_MCGRP_CONFIG, GFP_KERNEL);
- /* We don't care if no one is listening */
- if (ret = -ESRCH)
- ret = 0;
- if (!ret)
- ret = tcmu_wait_genl_cmd_reply(udev);
+
+ /* Wait during an add as the listener may not be up yet */
+ if (ret = 0 ||
+ (ret = -ESRCH && cmd = TCMU_CMD_ADDED_DEVICE))
+ return tcmu_wait_genl_cmd_reply(udev);
+
return ret;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
2019-02-02 3:01 [PATCH] tcmu: wait for nl reply only if there are listeners Mike Christie
2019-02-05 17:46 ` Mike Christie
2019-02-28 19:28 ` [PATCH] tcmu: wait for nl reply only if there are listeners or during an add Cathy Avery
@ 2019-03-01 21:17 ` Mike Christie
2019-03-06 17:37 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Mike Christie @ 2019-03-01 21:17 UTC (permalink / raw)
To: target-devel
On 02/28/2019 01:28 PM, Cathy Avery wrote:
> genlmsg_multicast_allns now returns the correct statuses when a
> message is sent to a listener. However in the case of adding a
> device we want to wait for the listener otherwise we may miss the
> the device during startup.
>
> Signed-off-by: Cathy Avery <cavery@redhat.com>
> ---
> drivers/target/target_core_user.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
> index 5831e0eecea1..2d3f8f5403d8 100644
> --- a/drivers/target/target_core_user.c
> +++ b/drivers/target/target_core_user.c
> @@ -1794,11 +1794,12 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev,
>
> ret = genlmsg_multicast_allns(&tcmu_genl_family, skb, 0,
> TCMU_MCGRP_CONFIG, GFP_KERNEL);
> - /* We don't care if no one is listening */
> - if (ret = -ESRCH)
> - ret = 0;
> - if (!ret)
> - ret = tcmu_wait_genl_cmd_reply(udev);
> +
> + /* Wait during an add as the listener may not be up yet */
> + if (ret = 0 ||
> + (ret = -ESRCH && cmd = TCMU_CMD_ADDED_DEVICE))
> + return tcmu_wait_genl_cmd_reply(udev);
> +
> return ret;
> }
Looks ok to me.
Acked-by: Mike Christie <mchristi@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
2019-02-02 3:01 [PATCH] tcmu: wait for nl reply only if there are listeners Mike Christie
` (2 preceding siblings ...)
2019-03-01 21:17 ` Mike Christie
@ 2019-03-06 17:37 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2019-03-06 17:37 UTC (permalink / raw)
To: target-devel
Cathy,
> genlmsg_multicast_allns now returns the correct statuses when a
> message is sent to a listener. However in the case of adding a
> device we want to wait for the listener otherwise we may miss the
> the device during startup.
Applied to 5.1/scsi-queue, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-06 17:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-02 3:01 [PATCH] tcmu: wait for nl reply only if there are listeners Mike Christie
2019-02-05 17:46 ` Mike Christie
2019-02-28 19:28 ` [PATCH] tcmu: wait for nl reply only if there are listeners or during an add Cathy Avery
2019-03-01 21:17 ` Mike Christie
2019-03-06 17:37 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.