diff options
author | Weston Andros Adamson <dros@netapp.com> | 2012-02-17 15:20:26 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-01 17:10:22 -0500 |
commit | 7d2ed9ac22bc6bf0d34e8fd291a5295f373b384e (patch) | |
tree | d6af20f85e68c075c6587afaa94f56fe001aae4b /fs/nfs/nfs4xdr.c | |
parent | 9edbd953f8aeabf49b89c7c29ff9e31560775b27 (diff) |
NFSv4: parse and display server implementation ids
Shows the implementation ids in /proc/self/mountstats. This doesn't break
the nfs-utils mountstats tool.
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index d824aedb1237..b7c04339fdc1 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -291,7 +291,11 @@ static int nfs4_stat_to_errno(int); | |||
291 | /* eir_server_scope<> */ \ | 291 | /* eir_server_scope<> */ \ |
292 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 + \ | 292 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + 1 + \ |
293 | 1 /* eir_server_impl_id array length */ + \ | 293 | 1 /* eir_server_impl_id array length */ + \ |
294 | 0 /* ignored eir_server_impl_id contents */) | 294 | 1 /* nii_domain */ + \ |
295 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + \ | ||
296 | 1 /* nii_name */ + \ | ||
297 | XDR_QUADLEN(NFS4_OPAQUE_LIMIT) + \ | ||
298 | 3 /* nii_date */) | ||
295 | #define encode_channel_attrs_maxsz (6 + 1 /* ca_rdma_ird.len (0) */) | 299 | #define encode_channel_attrs_maxsz (6 + 1 /* ca_rdma_ird.len (0) */) |
296 | #define decode_channel_attrs_maxsz (6 + \ | 300 | #define decode_channel_attrs_maxsz (6 + \ |
297 | 1 /* ca_rdma_ird.len */ + \ | 301 | 1 /* ca_rdma_ird.len */ + \ |
@@ -5256,6 +5260,7 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
5256 | char *dummy_str; | 5260 | char *dummy_str; |
5257 | int status; | 5261 | int status; |
5258 | struct nfs_client *clp = res->client; | 5262 | struct nfs_client *clp = res->client; |
5263 | uint32_t impl_id_count; | ||
5259 | 5264 | ||
5260 | status = decode_op_hdr(xdr, OP_EXCHANGE_ID); | 5265 | status = decode_op_hdr(xdr, OP_EXCHANGE_ID); |
5261 | if (status) | 5266 | if (status) |
@@ -5297,11 +5302,38 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
5297 | memcpy(res->server_scope->server_scope, dummy_str, dummy); | 5302 | memcpy(res->server_scope->server_scope, dummy_str, dummy); |
5298 | res->server_scope->server_scope_sz = dummy; | 5303 | res->server_scope->server_scope_sz = dummy; |
5299 | 5304 | ||
5300 | /* Throw away Implementation id array */ | 5305 | /* Implementation Id */ |
5301 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); | 5306 | p = xdr_inline_decode(xdr, 4); |
5302 | if (unlikely(status)) | 5307 | if (unlikely(!p)) |
5303 | return status; | 5308 | goto out_overflow; |
5309 | impl_id_count = be32_to_cpup(p++); | ||
5304 | 5310 | ||
5311 | if (impl_id_count) { | ||
5312 | /* nii_domain */ | ||
5313 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); | ||
5314 | if (unlikely(status)) | ||
5315 | return status; | ||
5316 | if (unlikely(dummy > NFS4_OPAQUE_LIMIT)) | ||
5317 | return -EIO; | ||
5318 | memcpy(res->impl_id->domain, dummy_str, dummy); | ||
5319 | |||
5320 | /* nii_name */ | ||
5321 | status = decode_opaque_inline(xdr, &dummy, &dummy_str); | ||
5322 | if (unlikely(status)) | ||
5323 | return status; | ||
5324 | if (unlikely(dummy > NFS4_OPAQUE_LIMIT)) | ||
5325 | return -EIO; | ||
5326 | memcpy(res->impl_id->name, dummy_str, dummy); | ||
5327 | |||
5328 | /* nii_date */ | ||
5329 | p = xdr_inline_decode(xdr, 12); | ||
5330 | if (unlikely(!p)) | ||
5331 | goto out_overflow; | ||
5332 | p = xdr_decode_hyper(p, &res->impl_id->date.seconds); | ||
5333 | res->impl_id->date.nseconds = be32_to_cpup(p); | ||
5334 | |||
5335 | /* if there's more than one entry, ignore the rest */ | ||
5336 | } | ||
5305 | return 0; | 5337 | return 0; |
5306 | out_overflow: | 5338 | out_overflow: |
5307 | print_overflow_msg(__func__, xdr); | 5339 | print_overflow_msg(__func__, xdr); |