NFS: eliminate NIPQUAD(clp->cl_addr.sin_addr)

To ensure the NFS client displays IPv6 addresses properly, replace
address family-specific NIPQUAD() invocations with a call to the RPC
client to get a formatted string representing the remote peer's
address.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Chuck Lever 2007-12-10 14:57:16 -05:00 committed by Trond Myklebust
parent d4d3c50749
commit 5d8515caeb
4 changed files with 20 additions and 16 deletions

View File

@ -1279,10 +1279,10 @@ static int nfs_server_list_show(struct seq_file *m, void *v)
/* display one transport per line on subsequent lines */ /* display one transport per line on subsequent lines */
clp = list_entry(v, struct nfs_client, cl_share_link); clp = list_entry(v, struct nfs_client, cl_share_link);
seq_printf(m, "v%u %02x%02x%02x%02x %4hx %3d %s\n", seq_printf(m, "v%u %s %s %3d %s\n",
clp->rpc_ops->version, clp->rpc_ops->version,
NIPQUAD(clp->cl_addr.sin_addr), rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
ntohs(clp->cl_addr.sin_port), rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT),
atomic_read(&clp->cl_count), atomic_read(&clp->cl_count),
clp->cl_hostname); clp->cl_hostname);
@ -1358,10 +1358,10 @@ static int nfs_volume_list_show(struct seq_file *m, void *v)
(unsigned long long) server->fsid.major, (unsigned long long) server->fsid.major,
(unsigned long long) server->fsid.minor); (unsigned long long) server->fsid.minor);
seq_printf(m, "v%u %02x%02x%02x%02x %4hx %-7s %-17s\n", seq_printf(m, "v%u %s %s %-7s %-17s\n",
clp->rpc_ops->version, clp->rpc_ops->version,
NIPQUAD(clp->cl_addr.sin_addr), rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_ADDR),
ntohs(clp->cl_addr.sin_port), rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_HEX_PORT),
dev, dev,
fsid); fsid);

View File

@ -156,8 +156,9 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
if (memcmp(&delegation->stateid, &nfsi->delegation->stateid, if (memcmp(&delegation->stateid, &nfsi->delegation->stateid,
sizeof(delegation->stateid)) != 0 || sizeof(delegation->stateid)) != 0 ||
delegation->type != nfsi->delegation->type) { delegation->type != nfsi->delegation->type) {
printk("%s: server %u.%u.%u.%u, handed out a duplicate delegation!\n", printk(KERN_WARNING "%s: server %s handed out "
__FUNCTION__, NIPQUAD(clp->cl_addr.sin_addr)); "a duplicate delegation!\n",
__FUNCTION__, clp->cl_hostname);
status = -EIO; status = -EIO;
} }
} }
@ -314,8 +315,9 @@ void nfs_expire_all_delegations(struct nfs_client *clp)
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
atomic_inc(&clp->cl_count); atomic_inc(&clp->cl_count);
task = kthread_run(nfs_do_expire_all_delegations, clp, task = kthread_run(nfs_do_expire_all_delegations, clp,
"%u.%u.%u.%u-delegreturn", "%s-delegreturn",
NIPQUAD(clp->cl_addr.sin_addr)); rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR));
if (!IS_ERR(task)) if (!IS_ERR(task))
return; return;
nfs_put_client(clp); nfs_put_client(clp);

View File

@ -758,8 +758,9 @@ static void nfs4_recover_state(struct nfs_client *clp)
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
atomic_inc(&clp->cl_count); atomic_inc(&clp->cl_count);
task = kthread_run(reclaimer, clp, "%u.%u.%u.%u-reclaim", task = kthread_run(reclaimer, clp, "%s-reclaim",
NIPQUAD(clp->cl_addr.sin_addr)); rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR));
if (!IS_ERR(task)) if (!IS_ERR(task))
return; return;
nfs4_clear_recover_bit(clp); nfs4_clear_recover_bit(clp);
@ -970,8 +971,8 @@ out:
module_put_and_exit(0); module_put_and_exit(0);
return 0; return 0;
out_error: out_error:
printk(KERN_WARNING "Error: state recovery failed on NFSv4 server %u.%u.%u.%u with error %d\n", printk(KERN_WARNING "Error: state recovery failed on NFSv4 server %s"
NIPQUAD(clp->cl_addr.sin_addr), -status); " with error %d\n", clp->cl_hostname, -status);
set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
goto out; goto out;
} }

View File

@ -491,8 +491,9 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
nfs_show_mount_options(m, nfss, 0); nfs_show_mount_options(m, nfss, 0);
seq_printf(m, ",addr="NIPQUAD_FMT, seq_printf(m, ",addr=%s",
NIPQUAD(nfss->nfs_client->cl_addr.sin_addr)); rpc_peeraddr2str(nfss->nfs_client->cl_rpcclient,
RPC_DISPLAY_ADDR));
return 0; return 0;
} }