From: Samuel Cabrero <scabrero@suse.de>
To: linux-cifs@vger.kernel.org
Cc: Samuel Cabrero <scabrero@suse.de>
Subject: [PATCH v3 11/11] cifs: Handle witness share moved notification
Date: Fri, 30 Oct 2020 12:52:10 +0100 [thread overview]
Message-ID: <20201030115210.8888-12-scabrero@suse.de> (raw)
In-Reply-To: <20201030115210.8888-1-scabrero@suse.de>
Just log a message as it is not clear enough what this notification
means. It is received for example when a node belonging to a scale-out
file server dies, but it is also received as soon as a client registers
for notifications (w2k12r2) when the server is scale-out.
Signed-off-by: Samuel Cabrero <scabrero@suse.de>
---
fs/cifs/cifs_swn.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/fs/cifs/cifs_swn.c b/fs/cifs/cifs_swn.c
index b71b05638b1c..ab079533dc24 100644
--- a/fs/cifs/cifs_swn.c
+++ b/fs/cifs/cifs_swn.c
@@ -534,6 +534,29 @@ static int cifs_swn_client_move(struct cifs_swn_reg *swnreg, struct sockaddr_sto
return cifs_swn_reconnect(swnreg->tcon, addr);
}
+static int cifs_swn_share_moved(struct cifs_swn_reg *swnreg, struct sockaddr_storage *addr)
+{
+ struct sockaddr_in *ipv4 = (struct sockaddr_in *)addr;
+ struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)addr;
+
+ if (addr->ss_family == AF_INET)
+ cifs_dbg(FYI, "%s: share '%s' from '%s' moved to %pI4\n",
+ __func__, swnreg->share_name, swnreg->net_name,
+ &ipv4->sin_addr);
+ else if (addr->ss_family == AF_INET6)
+ cifs_dbg(FYI, "%s: share '%s' from '%s' moved to %pI6\n",
+ __func__, swnreg->share_name, swnreg->net_name,
+ &ipv6->sin6_addr);
+
+ /*
+ * FIXME It is not clear enough how to handle this notification and what does it mean.
+ * It is received for example when a node belonging to a scale-out file server dies, but
+ * it is also received as soon as a client registers for notifications (w2k12r2) when the
+ * share is scale-out and all nodes are working fine. Just log for now.
+ */
+ return 0;
+}
+
int cifs_swn_notify(struct sk_buff *skb, struct genl_info *info)
{
struct cifs_swn_reg *swnreg;
@@ -593,6 +616,17 @@ int cifs_swn_notify(struct sk_buff *skb, struct genl_info *info)
}
return cifs_swn_client_move(swnreg, &addr);
}
+ case CIFS_SWN_NOTIFICATION_SHARE_MOVE: {
+ struct sockaddr_storage addr;
+
+ if (info->attrs[CIFS_GENL_ATTR_SWN_IP]) {
+ nla_memcpy(&addr, info->attrs[CIFS_GENL_ATTR_SWN_IP], sizeof(addr));
+ } else {
+ cifs_dbg(FYI, "%s: missing IP address attribute\n", __func__);
+ return -EINVAL;
+ }
+ return cifs_swn_share_moved(swnreg, &addr);
+ }
default:
cifs_dbg(FYI, "%s: unknown notification type %d\n", __func__, type);
break;
--
2.29.0
prev parent reply other threads:[~2020-10-30 11:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 11:51 [PATCH v3 00/11] Witness protocol support for transparent failover Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 01/11] cifs: Make extract_hostname function public Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 02/11] cifs: Make extract_sharename " Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 03/11] cifs: Register generic netlink family Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 04/11] cifs: add witness mount option and data structs Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 05/11] cifs: Send witness register and unregister commands to userspace daemon Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 06/11] cifs: Set witness notification handler for messages from " Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 07/11] cifs: Add witness information to debug data dump Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 08/11] cifs: Send witness register messages to userspace daemon in echo task Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 09/11] cifs: Simplify reconnect code when dfs upcall is enabled Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 10/11] cifs: Handle witness client move notification Samuel Cabrero
2020-10-30 11:52 ` Samuel Cabrero [this message]
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=20201030115210.8888-12-scabrero@suse.de \
--to=scabrero@suse.de \
--cc=linux-cifs@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