Commit 21077c62 authored by Samuel Cabrero's avatar Samuel Cabrero Committed by Steve French
Browse files

cifs: Send witness register messages to userspace daemon in echo task



If the daemon starts after mounting a share, or if it crashes, this
provides a mechanism to register again.

Signed-off-by: default avatarSamuel Cabrero <scabrero@suse.de>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 20fab0da
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -540,3 +540,18 @@ void cifs_swn_dump(struct seq_file *m)
	mutex_unlock(&cifs_swnreg_idr_mutex);
	seq_puts(m, "\n");
}

void cifs_swn_check(void)
{
	struct cifs_swn_reg *swnreg;
	int id;
	int ret;

	mutex_lock(&cifs_swnreg_idr_mutex);
	idr_for_each_entry(&cifs_swnreg_idr, swnreg, id) {
		ret = cifs_swn_send_register_message(swnreg);
		if (ret < 0)
			cifs_dbg(FYI, "%s: Failed to send register message: %d\n", __func__, ret);
	}
	mutex_unlock(&cifs_swnreg_idr_mutex);
}
+2 −0
Original line number Diff line number Diff line
@@ -20,4 +20,6 @@ extern int cifs_swn_notify(struct sk_buff *skb, struct genl_info *info);

extern void cifs_swn_dump(struct seq_file *m);

extern void cifs_swn_check(void);

#endif /* _CIFS_SWN_H */
+5 −0
Original line number Diff line number Diff line
@@ -405,6 +405,11 @@ cifs_echo_request(struct work_struct *work)
		cifs_dbg(FYI, "Unable to send echo request to server: %s\n",
			 server->hostname);

#ifdef CONFIG_CIFS_SWN_UPCALL
	/* Check witness registrations */
	cifs_swn_check();
#endif

requeue_echo:
	queue_delayed_work(cifsiod_wq, &server->echo, server->echo_interval);
}