[RFC 06/13] nfs: Use srcaddr in nfs_match_client.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ben Greear <greearb@xxxxxxxxxxxxxxx>

For bound clients, we have to make sure we do not re-use
a client that is bound differently.

Signed-off-by: Ben Greear <greearb@xxxxxxxxxxxxxxx>
---
 fs/nfs/client.c   |   10 ++++++++++
 fs/nfs/internal.h |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 809fd1e..e5230fe 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -408,6 +408,9 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 
 	list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
 	        const struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr;
+		const struct sockaddr *sa;
+		sa = (const struct sockaddr *)&clp->srcaddr;
+
 		/* Don't match clients that failed to initialise properly */
 		if (clp->cl_cons_state < 0)
 			continue;
@@ -425,6 +428,13 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 		if (!nfs_sockaddr_cmp(sap, clap))
 			continue;
 
+		/* Check to make sure local-IP bindings match,
+		 * but just the IP-addr.
+		 */
+		if (data->srcaddr &&
+		    !nfs_sockaddr_match_ipaddr(data->srcaddr, sa))
+			continue;
+
 		atomic_inc(&clp->cl_count);
 		return clp;
 	}
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 11c5ac7..dbb2ee7 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -89,7 +89,9 @@ struct nfs_client_initdata {
 	unsigned long init_flags;
 	const char *hostname;
 	const struct sockaddr *addr;
+	const struct sockaddr *srcaddr;
 	size_t addrlen;
+	size_t srcaddrlen;
 	struct nfs_subversion *nfs_mod;
 	int proto;
 	u32 minorversion;
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux