Skip to content

Commit

Permalink
scsi: target: tcmu: wait for nl reply only if there are listeners or …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Cathy Avery authored and Martin K. Petersen committed Mar 7, 2019
1 parent 3722e6a commit 2ff717c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/target/target_core_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 2ff717c

Please sign in to comment.