Message ID | 20190228192824.28458-1-cavery@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 2ff717cdc693d532e4560f43858443aea7d88197 |
Headers | show |
Series | tcmu: wait for nl reply only if there are listeners or during an add | expand |
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>
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!
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; }
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(-)