From: Cathy Avery <cavery@redhat.com>
To: target-devel@vger.kernel.org
Subject: [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
Date: Thu, 28 Feb 2019 19:28:24 +0000 [thread overview]
Message-ID: <20190228192824.28458-1-cavery@redhat.com> (raw)
In-Reply-To: <1549076481-15420-1-git-send-email-mchristi@redhat.com>
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
next prev parent reply other threads:[~2019-02-28 19:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-03-01 21:17 ` [PATCH] tcmu: wait for nl reply only if there are listeners or during an add Mike Christie
2019-03-06 17:37 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190228192824.28458-1-cavery@redhat.com \
--to=cavery@redhat.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox