Skip to contentSkip to conversation

NFSv4.1 set the cl_hostname for data servers

PATCH In review [email protected] 5 participants 8 messages Feb 16, 2012 – Feb 17, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFSv4.1 set the cl_hostname for data servers

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---
 fs/nfs/client.c            |    3 ++-
 fs/nfs/internal.h          |    3 ++-
 fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +2 -1
index d0f850f..c625284 100644
@@ -1443,7 +1443,7 @@ error:
  */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		const struct sockaddr *ds_addr,
-		int ds_addrlen, int ds_proto)
+		int ds_addrlen, int ds_proto, char *ds_hostname)
 {
 	struct nfs_client_initdata cl_init = {
 		.addr = ds_addr,
@@ -1452,6 +1452,7 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		.proto = ds_proto,
 		.minorversion = mds_clp->cl_minorversion,
 		.net = mds_clp->net,
+		.hostname = ds_hostname,
 	};
 	struct rpc_timeout ds_timeout = {
 		.to_initval = 15 * HZ,
fs/nfs/internal.h +2 -1
index 0c3648a..b870695 100644
@@ -170,7 +170,8 @@ extern void nfs_mark_client_ready(struct nfs_client *clp, int state);
 extern int nfs4_check_client_ready(struct nfs_client *clp);
 extern struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 					     const struct sockaddr *ds_addr,
-					     int ds_addrlen, int ds_proto);
+					     int ds_addrlen, int ds_proto,
+					     char *ds_hostname);
 #ifdef CONFIG_PROC_FS
 extern int __init nfs_fs_proc_init(void);
 extern void nfs_fs_proc_exit(void);
fs/nfs/nfs4filelayoutdev.c +10 -1
index 41677f0..a0b1fc5 100644
@@ -153,6 +153,7 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 {
 	struct nfs_client *clp = ERR_PTR(-EIO);
 	struct nfs4_pnfs_ds_addr *da;
+	char *ds_hostname = NULL;
 	int status = 0;
 
 	dprintk("--> %s DS %s au_flavor %d\n", __func__, ds->ds_remotestr,
@@ -164,9 +165,17 @@ nfs4_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 		dprintk("%s: DS %s: trying address %s\n",
 			__func__, ds->ds_remotestr, da->da_remotestr);
 
+		/* For debug: OK if ds_remotestr or ds_hostname is NULL */
+		if (da->da_remotestr) {
+			char *end = strchr(da->da_remotestr, ':');
+			ds_hostname = kstrndup(da->da_remotestr,
+					       end - da->da_remotestr,
+					       GFP_KERNEL);
+		}
 		clp = nfs4_set_ds_client(mds_srv->nfs_client,
 				 (struct sockaddr *)&da->da_addr,
-				 da->da_addrlen, IPPROTO_TCP);
+				 da->da_addrlen, IPPROTO_TCP, ds_hostname);
+		kfree(ds_hostname);
 		if (!IS_ERR(clp))
 			break;
 	}
Signature · 1 line
1.7.6.4
#1 lore raw

T24gVGh1LCAyMDEyLTAyLTE2IGF0IDE2OjEwIC0wNTAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90 ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gDQo+IFVzZWQg YnkgL3Byb2MvZnMvbmZzZnMvc2VydmVycw0KPiANCj4gU2lnbmVkLW9mZi1ieTogQW5keSBBZGFt c29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gLS0tDQo+ICBmcy9uZnMvY2xpZW50LmMgICAgICAg ICAgICB8ICAgIDMgKystDQo+ICBmcy9uZnMvaW50ZXJuYWwuaCAgICAgICAgICB8ICAgIDMgKyst DQo+ICBmcy9uZnMvbmZzNGZpbGVsYXlvdXRkZXYuYyB8ICAgMTEgKysrKysrKysrKy0NCj4gIDMg ZmlsZXMgY2hhbmdlZCwgMTQgaW5zZXJ0aW9ucygrKSwgMyBkZWxldGlvbnMoLSkNCj4gDQo+IGRp Zm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ZzogT0sgaWYgZHNfcmVtb3Rlc3RyIG9y IGRzX2hvc3RuYW1lIGlzIE5VTEwgKi8NCj4gKwkJaWYgKGRhLT5kYV9yZW1vdGVzdHIpIHsNCj4g KwkJCWNoYXIgKmVuZCA9IHN0cmNocihkYS0+ZGFfcmVtb3Rlc3RyLCAnOicpOw0KPiArCQkJZHNf aG9zdG5hbWUgPSBrc3RybmR1cChkYS0+ZGFfcmVtb3Rlc3RyLA0KPiArCQkJCQkgICAgICAgZW5k IC0gZGEtPmRhX3JlbW90ZXN0ciwNCj4gKwkJCQkJICAgICAgIEdGUF9LRVJORUwpOw0KPiArCQl9 DQo+ICAJCWNscCA9IG5mczRfc2V0X2RzX2NsaWVudChtZHNfc3J2LT5uZnNfY2xpZW50LA0KPiAg CQkJCSAoc3RydWN0IHNvY2thZGRyICopJmRhLT5kYV9hZGRyLA0KPiAtCQkJCSBkYS0+ZGFfYWRk cmxlbiwgSVBQUk9UT19UQ1ApOw0KPiArCQkJCSBkYS0+ZGFfYWRkcmxlbiwgSVBQUk9UT19UQ1As IGRzX2hvc3RuYW1lKTsNCj4gKwkJa2ZyZWUoZHNfaG9zdG5hbWUpOw0KPiAgCQlpZiAoIUlTX0VS UihjbHApKQ0KPiAgCQkJYnJlYWs7DQo+ICAJfQ0KDQotLSANClRyb25kIE15a2xlYnVzdA0KTGlu dXggTkZTIGNsaWVudCBtYWludGFpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFw cC5jb20NCnd3dy5uZXRhcHAuY29tDQoNCg==

#2 lore raw
Quoted 26 lines · Trond
Quoted 16 lines · On Thu, 2012-02-16 at 16:10 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---

fs/nfs/client.c            |    3 ++-
fs/nfs/internal.h          |    3 ++-
fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +0 -0
index d0f850f..c625284 100644

fs/nfs/client.c error: · line 1446

Quoted 5 lines
fs/nfs/client.c +1 -1
@@ -1443,7 +1443,7 @@ error:
 */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		const struct sockaddr *ds_addr,
-		int ds_addrlen, int ds_proto)
+		int ds_addrlen, int ds_proto, char *ds_hostname)

Can you make this (and the other instances below) 'const char *', so that we avoid any confusion? Otherwise it looks more or less OK...

Quoted 2 lines

Note that we should consider splitting da->da_remotestr into a hostname/port part at some point so that we avoid the copy below.

da_remotestr (and ds_remotestr) were meant to be for display only (and iirc they can actually be NULL).

The right way to do this is from the actual sin_addr (da_addr).

-dros

#3 lore raw
Quoted 29 lines · Dros
Quoted 26 lines · Trond
Quoted 16 lines · On Thu, 2012-02-16 at 16:10 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---

fs/nfs/client.c            |    3 ++-
fs/nfs/internal.h          |    3 ++-
fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +0 -0
index d0f850f..c625284 100644

fs/nfs/client.c error: · line 1446

Quoted 5 lines
fs/nfs/client.c +1 -1
@@ -1443,7 +1443,7 @@ error:
 */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
 		const struct sockaddr *ds_addr,
-		int ds_addrlen, int ds_proto)
+		int ds_addrlen, int ds_proto, char *ds_hostname)

Can you make this (and the other instances below) 'const char *', so that we avoid any confusion? Otherwise it looks more or less OK...

Quoted 4 lines
Quoted 2 lines

Note that we should consider splitting da->da_remotestr into a hostname/port part at some point so that we avoid the copy below.

da_remotestr (and ds_remotestr) were meant to be for display only (and iirc they can actually be NULL).

^^ dprintk() display, that is.

Quoted 4 lines

The right way to do this is from the actual sin_addr (da_addr).

-dros

#4 lore raw

Isn't the clp->cl_rpcclient->cl_server always the same as clp->cl_hostname? Can we just get rid of the cl_hostname and use the cl_server?

-->Andy

Quoted 44 lines · Dros
Quoted 29 lines · Dros
Quoted 26 lines · Trond
Quoted 16 lines · On Thu, 2012-02-16 at 16:10 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---
fs/nfs/client.c            |    3 ++- fs/nfs/internal.h          |    3 ++- fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-

3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +0 -0
index d0f850f..c625284 100644

fs/nfs/client.c error: · line 1446

Quoted 5 lines
fs/nfs/client.c +1 -1
@@ -1443,7 +1443,7 @@ error:
 */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
             const struct sockaddr *ds_addr,
-           int ds_addrlen, int ds_proto)
+           int ds_addrlen, int ds_proto, char *ds_hostname)

Can you make this (and the other instances below) 'const char *', so that we avoid any confusion? Otherwise it looks more or less OK...

Quoted 4 lines
Quoted 2 lines

Note that we should consider splitting da->da_remotestr into a hostname/port part at some point so that we avoid the copy below.

da_remotestr (and ds_remotestr) were meant to be for display only (and iirc they can actually be NULL).

^^ dprintk() display, that is.

Quoted 4 lines

The right way to do this is from the actual sin_addr (da_addr).

-dros

#5 lore raw

I've got a patch that already does this, which Trond wrote a year ago. I can submit this for 3.4.

Quoted 56 lines · Andy Adamson

Isn't the clp->cl_rpcclient->cl_server always the same as clp->cl_hostname? Can we just get rid of the cl_hostname and use the cl_server?

-->Andy

Quoted 32 lines · Dros
Quoted 29 lines · Dros
Quoted 26 lines · Trond
Quoted 16 lines · On Thu, 2012-02-16 at 16:10 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---

fs/nfs/client.c            |    3 ++-
fs/nfs/internal.h          |    3 ++-
fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-
3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +0 -0
index d0f850f..c625284 100644

fs/nfs/client.c error: · line 1446

Quoted 5 lines
fs/nfs/client.c +1 -1
@@ -1443,7 +1443,7 @@ error:
 */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
            const struct sockaddr *ds_addr,
-           int ds_addrlen, int ds_proto)
+           int ds_addrlen, int ds_proto, char *ds_hostname)

Can you make this (and the other instances below) 'const char *', so that we avoid any confusion? Otherwise it looks more or less OK...

Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

Note that we should consider splitting da->da_remotestr into a hostname/port part at some point so that we avoid the copy below.

da_remotestr (and ds_remotestr) were meant to be for display only (and iirc they can actually be NULL).

^^ dprintk() display, that is.

Quoted 4 lines

The right way to do this is from the actual sin_addr (da_addr).

-dros

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

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#6 lore raw
Quoted 1 line · Chuck Lever

I've got a patch that already does this, which Trond wrote a year ago.  I can submit this for 3.4.

OK. That solves the /proc/fs/nfsfs/servers HOSTNAME is null issue for filelayout data servers.

-->Andy

Quoted 67 lines · Andy Adamson
Quoted 49 lines

Isn't the clp->cl_rpcclient->cl_server always the same as clp->cl_hostname? Can we just get rid of the cl_hostname and use the cl_server?

-->Andy

Quoted 40 lines · Dros
Quoted 29 lines · Dros
Quoted 26 lines · Trond
Quoted 16 lines · On Thu, 2012-02-16 at 16:10 -0500, [email protected] wrote:

From: Andy Adamson <[email protected]>

Used by /proc/fs/nfsfs/servers

---
fs/nfs/client.c            |    3 ++- fs/nfs/internal.h          |    3 ++- fs/nfs/nfs4filelayoutdev.c |   11 ++++++++++-

3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfs/client.c +0 -0
index d0f850f..c625284 100644

fs/nfs/client.c error: · line 1446

Quoted 5 lines
fs/nfs/client.c +1 -1
@@ -1443,7 +1443,7 @@ error:
 */
 struct nfs_client *nfs4_set_ds_client(struct nfs_client* mds_clp,
             const struct sockaddr *ds_addr,
-           int ds_addrlen, int ds_proto)
+           int ds_addrlen, int ds_proto, char *ds_hostname)

Can you make this (and the other instances below) 'const char *', so that we avoid any confusion? Otherwise it looks more or less OK...

Quoted 4 lines
Quoted 2 lines

Note that we should consider splitting da->da_remotestr into a hostname/port part at some point so that we avoid the copy below.

da_remotestr (and ds_remotestr) were meant to be for display only (and iirc they can actually be NULL).

^^ dprintk() display, that is.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

The right way to do this is from the actual sin_addr (da_addr).

-dros

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

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com

#7 lore raw
In reply to Andy Adamson

T24gRnJpLCAyMDEyLTAyLTE3IGF0IDEzOjQwIC0wNTAwLCBBbmR5IEFkYW1zb24gd3JvdGU6DQo+ IElzbid0IHRoZSBjbHAtPmNsX3JwY2NsaWVudC0+Y2xfc2VydmVyIGFsd2F5cyB0aGUgc2FtZSBh cw0KPiBjbHAtPmNsX2hvc3RuYW1lPyBDYW4gd2UganVzdCBnZXQgcmlkIG9mIHRoZSBjbF9ob3N0 bmFtZSBhbmQgdXNlIHRoZQ0KPiBjbF9zZXJ2ZXI/DQo+IA0KDQpZZXMuIFRoYXQgd291bGQgYWxz byBiZSBhbiBhY2NlcHRhYmxlIGFsdGVybmF0aXZlLi4uDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0 DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RA bmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg0K