62 lines
1.6 KiB
Diff
62 lines
1.6 KiB
Diff
|
From e21f1ac46b9672824e00ad907ee0443af2dbad66 Mon Sep 17 00:00:00 2001
|
||
|
From: Hannes Reinecke <hare@suse.de>
|
||
|
Date: Tue, 28 Jun 2016 14:10:38 +0200
|
||
|
Subject: fcoemon: Retry fcm_link_getlink() on EBUSY
|
||
|
|
||
|
If netlink returns -EBUSY as NLMSG_ERROR code there was another
|
||
|
callback running on that socket. So we can simply retry here.
|
||
|
|
||
|
Signed-off-by: Hannes Reinecke <hare@suse.com>
|
||
|
---
|
||
|
fcoemon.c | 11 +++++++++--
|
||
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/fcoemon.c b/fcoemon.c
|
||
|
index 58137df..32ba30c 100644
|
||
|
--- a/fcoemon.c
|
||
|
+++ b/fcoemon.c
|
||
|
@@ -750,7 +750,7 @@ static void fcm_fc_event_handler(struct fc_nl_event *fc_event)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
-static void log_nlmsg_error(struct nlmsghdr *hp, size_t rlen, const char *str)
|
||
|
+static int log_nlmsg_error(struct nlmsghdr *hp, size_t rlen, const char *str)
|
||
|
{
|
||
|
struct nlmsgerr *ep;
|
||
|
|
||
|
@@ -758,8 +758,10 @@ static void log_nlmsg_error(struct nlmsghdr *hp, size_t rlen, const char *str)
|
||
|
ep = (struct nlmsgerr *)NLMSG_DATA(hp);
|
||
|
FCM_LOG_DBG("%s, err=%d, type=%d\n",
|
||
|
str, ep->error, ep->msg.nlmsg_type);
|
||
|
+ return ep->error;
|
||
|
} else {
|
||
|
FCM_LOG("%s", str);
|
||
|
+ return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@@ -1873,7 +1875,7 @@ static void fcm_link_recv(UNUSED void *arg)
|
||
|
break;
|
||
|
|
||
|
if (hp->nlmsg_type == NLMSG_ERROR) {
|
||
|
- log_nlmsg_error(hp, rlen, "nlmsg error");
|
||
|
+ rc = log_nlmsg_error(hp, rlen, "nlmsg error");
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
@@ -1904,6 +1906,11 @@ static void fcm_link_recv(UNUSED void *arg)
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
+ if (rc == -EBUSY) {
|
||
|
+ FCM_LOG_DBG("%s: netlink returned -EBUSY, retry\n",
|
||
|
+ __func__);
|
||
|
+ fcm_link_getlink();
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
--
|
||
|
2.6.6
|
||
|
|