[PATCH 2/3] mountd: helper function for export upcall's client matching

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

 



From: "J. Bruce Fields" <bfields@xxxxxxxxxx>

This is just minor cleanup.  It also reorders the tests
slightly--perhaps there was some performance advantage to doing them the
other way, but if so I doubt it's significant.

Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx>
---
 utils/mountd/cache.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 0d2f76c..a6bad07 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -495,6 +495,14 @@ static bool match_fsid(struct parsed_fsid *parsed, nfs_export *exp, char *path)
 	return false;
 }
 
+static bool match_client(char *dom, nfs_export *exp, struct addinfo *ai)
+{
+	if (!use_ipaddr && client_member(dom, exp->m_client->m_hostname))
+		return true;
+	if (use_ipaddr && ai && client_check(exp->m_client, ai))
+		return true;
+}
+
 struct addrinfo *lookup_client_addr(char *dom)
 {
 	struct addrinfo *ret;
@@ -583,7 +591,7 @@ static void nfsd_fh(FILE *f)
 				next_exp = exp->m_next;
 			}
 
-			if (!use_ipaddr && !client_member(dom, exp->m_client->m_hostname))
+			if (!match_client(dom, exp, ai))
 				continue;
 			if (exp->m_export.e_mountpoint &&
 			    !is_mountpoint(exp->m_export.e_mountpoint[0]?
@@ -593,10 +601,6 @@ static void nfsd_fh(FILE *f)
 
 			if (!match_fsid(&parsed, exp, path))
 				continue;
-			if (use_ipaddr) {
-				if (ai && !client_check(exp->m_client, ai))
-					continue;
-			}
 			if (!found || subexport(&exp->m_export, found)) {
 				found = &exp->m_export;
 				free(found_path);
-- 
1.7.7.6

--
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