[PATCH 01/12] lockd: fix inconsistent use of nsm_use_hostnames

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

 



In nlm_lookup_host() there's an optimization that looks for matching nsm
handles at the same time as looking for hosts, so that if a host
isn't found but a matching nsm handle is, we save a second lookup for
the nsm handle.

The optimization (unlike nsm_find()) ignores nsm_use_hostnames, so may
give incorrect results when that parameter is set.  We could probably
find some way to fix this and keep the optimization, but it seems
unlikely to be very significant, so just skip it entirely.

Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxxxxxx>
---
 fs/lockd/host.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 9fd8889..e9069c2 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -138,7 +138,7 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
 	struct hlist_head *chain;
 	struct hlist_node *pos;
 	struct nlm_host	*host;
-	struct nsm_handle *nsm = NULL;
+	struct nsm_handle *nsm;
 
 	mutex_lock(&nlm_host_mutex);
 
@@ -157,10 +157,6 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
 		if (!nlm_cmp_addr(nlm_addr(host), ni->sap))
 			continue;
 
-		/* See if we have an NSM handle for this client */
-		if (!nsm)
-			nsm = host->h_nsmhandle;
-
 		if (host->h_proto != ni->protocol)
 			continue;
 		if (host->h_version != ni->version)
@@ -184,17 +180,12 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
 	 * The host wasn't in our hash table.  If we don't
 	 * have an NSM handle for it yet, create one.
 	 */
-	if (nsm)
-		atomic_inc(&nsm->sm_count);
-	else {
-		host = NULL;
-		nsm = nsm_find(ni->sap, ni->salen,
-				ni->hostname, ni->hostname_len, 1);
-		if (!nsm) {
-			dprintk("lockd: nlm_lookup_host failed; "
-				"no nsm handle\n");
-			goto out;
-		}
+	host = NULL;
+	nsm = nsm_find(ni->sap, ni->salen, ni->hostname, ni->hostname_len, 1);
+	if (!nsm) {
+		dprintk("lockd: nlm_lookup_host failed; "
+			"no nsm handle\n");
+		goto out;
 	}
 
 	host = kzalloc(sizeof(*host), GFP_KERNEL);
-- 
1.5.5.rc1

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