summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCathy Avery <cavery@redhat.com>2019-02-28 20:28:24 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2019-03-07 01:26:13 +0100
commit2ff717cdc693d532e4560f43858443aea7d88197 (patch)
treea7c8aa70cf06cebe2a2089c97dcb8a28c490c074
parentscsi: virtio_scsi: don't send sc payload with tmfs (diff)
downloadlinux-2ff717cdc693d532e4560f43858443aea7d88197.tar.xz
linux-2ff717cdc693d532e4560f43858443aea7d88197.zip
scsi: target: tcmu: wait for nl reply only if there are listeners or during an add
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> Acked-by: Mike Christie <mchristi@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/target/target_core_user.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 1e6d24943565..396c2fa1ec22 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1764,11 +1764,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;
}