summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2018-01-06 09:53:49 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2018-01-14 23:06:29 -0500
commit8634ef5e05311f32d7f2aee06f6b27a8834a3bd6 (patch)
treefc32845b930273396c5bde142b4f2077c6bf1664
parent82571552a034f7531b0c8e76c1fd593c8755c519 (diff)
NFS: Fix nfsstat breakage due to LOOKUPP
The LOOKUPP operation was inserted into the nfs4_procedures array rather than being appended, which put /proc/net/rpc/nfs out of whack, and broke the nfsstat utility. Fix by moving the LOOKUPP operation to the end of the array, and by ensuring that it keeps the same length whether or not NFSV4.1 and NFSv4.2 are compiled in. Fixes: 5b5faaf6df734 ("nfs4: add NFSv4 LOOKUPP handlers") Cc: stable@vger.kernel.org # v4.13+ Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs4xdr.c64
-rw-r--r--include/linux/nfs4.h12
2 files changed, 46 insertions, 30 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 77c6729e57f0..65c9c4175145 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -7678,6 +7678,22 @@ nfs4_stat_to_errno(int stat)
7678 .p_name = #proc, \ 7678 .p_name = #proc, \
7679} 7679}
7680 7680
7681#if defined(CONFIG_NFS_V4_1)
7682#define PROC41(proc, argtype, restype) \
7683 PROC(proc, argtype, restype)
7684#else
7685#define PROC41(proc, argtype, restype) \
7686 STUB(proc)
7687#endif
7688
7689#if defined(CONFIG_NFS_V4_2)
7690#define PROC42(proc, argtype, restype) \
7691 PROC(proc, argtype, restype)
7692#else
7693#define PROC42(proc, argtype, restype) \
7694 STUB(proc)
7695#endif
7696
7681const struct rpc_procinfo nfs4_procedures[] = { 7697const struct rpc_procinfo nfs4_procedures[] = {
7682 PROC(READ, enc_read, dec_read), 7698 PROC(READ, enc_read, dec_read),
7683 PROC(WRITE, enc_write, dec_write), 7699 PROC(WRITE, enc_write, dec_write),
@@ -7698,7 +7714,6 @@ const struct rpc_procinfo nfs4_procedures[] = {
7698 PROC(ACCESS, enc_access, dec_access), 7714 PROC(ACCESS, enc_access, dec_access),
7699 PROC(GETATTR, enc_getattr, dec_getattr), 7715 PROC(GETATTR, enc_getattr, dec_getattr),
7700 PROC(LOOKUP, enc_lookup, dec_lookup), 7716 PROC(LOOKUP, enc_lookup, dec_lookup),
7701 PROC(LOOKUPP, enc_lookupp, dec_lookupp),
7702 PROC(LOOKUP_ROOT, enc_lookup_root, dec_lookup_root), 7717 PROC(LOOKUP_ROOT, enc_lookup_root, dec_lookup_root),
7703 PROC(REMOVE, enc_remove, dec_remove), 7718 PROC(REMOVE, enc_remove, dec_remove),
7704 PROC(RENAME, enc_rename, dec_rename), 7719 PROC(RENAME, enc_rename, dec_rename),
@@ -7717,33 +7732,30 @@ const struct rpc_procinfo nfs4_procedures[] = {
7717 PROC(RELEASE_LOCKOWNER, enc_release_lockowner, dec_release_lockowner), 7732 PROC(RELEASE_LOCKOWNER, enc_release_lockowner, dec_release_lockowner),
7718 PROC(SECINFO, enc_secinfo, dec_secinfo), 7733 PROC(SECINFO, enc_secinfo, dec_secinfo),
7719 PROC(FSID_PRESENT, enc_fsid_present, dec_fsid_present), 7734 PROC(FSID_PRESENT, enc_fsid_present, dec_fsid_present),
7720#if defined(CONFIG_NFS_V4_1) 7735 PROC41(EXCHANGE_ID, enc_exchange_id, dec_exchange_id),
7721 PROC(EXCHANGE_ID, enc_exchange_id, dec_exchange_id), 7736 PROC41(CREATE_SESSION, enc_create_session, dec_create_session),
7722 PROC(CREATE_SESSION, enc_create_session, dec_create_session), 7737 PROC41(DESTROY_SESSION, enc_destroy_session, dec_destroy_session),
7723 PROC(DESTROY_SESSION, enc_destroy_session, dec_destroy_session), 7738 PROC41(SEQUENCE, enc_sequence, dec_sequence),
7724 PROC(SEQUENCE, enc_sequence, dec_sequence), 7739 PROC41(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time),
7725 PROC(GET_LEASE_TIME, enc_get_lease_time, dec_get_lease_time), 7740 PROC41(RECLAIM_COMPLETE,enc_reclaim_complete, dec_reclaim_complete),
7726 PROC(RECLAIM_COMPLETE, enc_reclaim_complete, dec_reclaim_complete), 7741 PROC41(GETDEVICEINFO, enc_getdeviceinfo, dec_getdeviceinfo),
7727 PROC(GETDEVICEINFO, enc_getdeviceinfo, dec_getdeviceinfo), 7742 PROC41(LAYOUTGET, enc_layoutget, dec_layoutget),
7728 PROC(LAYOUTGET, enc_layoutget, dec_layoutget), 7743 PROC41(LAYOUTCOMMIT, enc_layoutcommit, dec_layoutcommit),
7729 PROC(LAYOUTCOMMIT, enc_layoutcommit, dec_layoutcommit), 7744 PROC41(LAYOUTRETURN, enc_layoutreturn, dec_layoutreturn),
7730 PROC(LAYOUTRETURN, enc_layoutreturn, dec_layoutreturn), 7745 PROC41(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name),
7731 PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name), 7746 PROC41(TEST_STATEID, enc_test_stateid, dec_test_stateid),
7732 PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), 7747 PROC41(FREE_STATEID, enc_free_stateid, dec_free_stateid),
7733 PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid),
7734 STUB(GETDEVICELIST), 7748 STUB(GETDEVICELIST),
7735 PROC(BIND_CONN_TO_SESSION, 7749 PROC41(BIND_CONN_TO_SESSION,
7736 enc_bind_conn_to_session, dec_bind_conn_to_session), 7750 enc_bind_conn_to_session, dec_bind_conn_to_session),
7737 PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid), 7751 PROC41(DESTROY_CLIENTID,enc_destroy_clientid, dec_destroy_clientid),
7738#endif /* CONFIG_NFS_V4_1 */ 7752 PROC42(SEEK, enc_seek, dec_seek),
7739#ifdef CONFIG_NFS_V4_2 7753 PROC42(ALLOCATE, enc_allocate, dec_allocate),
7740 PROC(SEEK, enc_seek, dec_seek), 7754 PROC42(DEALLOCATE, enc_deallocate, dec_deallocate),
7741 PROC(ALLOCATE, enc_allocate, dec_allocate), 7755 PROC42(LAYOUTSTATS, enc_layoutstats, dec_layoutstats),
7742 PROC(DEALLOCATE, enc_deallocate, dec_deallocate), 7756 PROC42(CLONE, enc_clone, dec_clone),
7743 PROC(LAYOUTSTATS, enc_layoutstats, dec_layoutstats), 7757 PROC42(COPY, enc_copy, dec_copy),
7744 PROC(CLONE, enc_clone, dec_clone), 7758 PROC(LOOKUPP, enc_lookupp, dec_lookupp),
7745 PROC(COPY, enc_copy, dec_copy),
7746#endif /* CONFIG_NFS_V4_2 */
7747}; 7759};
7748 7760
7749static unsigned int nfs_version4_counts[ARRAY_SIZE(nfs4_procedures)]; 7761static unsigned int nfs_version4_counts[ARRAY_SIZE(nfs4_procedures)];
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 47adac640191..57ffaa20d564 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -457,7 +457,12 @@ enum lock_type4 {
457 457
458#define NFS4_DEBUG 1 458#define NFS4_DEBUG 1
459 459
460/* Index of predefined Linux client operations */ 460/*
461 * Index of predefined Linux client operations
462 *
463 * To ensure that /proc/net/rpc/nfs remains correctly ordered, please
464 * append only to this enum when adding new client operations.
465 */
461 466
462enum { 467enum {
463 NFSPROC4_CLNT_NULL = 0, /* Unused */ 468 NFSPROC4_CLNT_NULL = 0, /* Unused */
@@ -480,7 +485,6 @@ enum {
480 NFSPROC4_CLNT_ACCESS, 485 NFSPROC4_CLNT_ACCESS,
481 NFSPROC4_CLNT_GETATTR, 486 NFSPROC4_CLNT_GETATTR,
482 NFSPROC4_CLNT_LOOKUP, 487 NFSPROC4_CLNT_LOOKUP,
483 NFSPROC4_CLNT_LOOKUPP,
484 NFSPROC4_CLNT_LOOKUP_ROOT, 488 NFSPROC4_CLNT_LOOKUP_ROOT,
485 NFSPROC4_CLNT_REMOVE, 489 NFSPROC4_CLNT_REMOVE,
486 NFSPROC4_CLNT_RENAME, 490 NFSPROC4_CLNT_RENAME,
@@ -500,7 +504,6 @@ enum {
500 NFSPROC4_CLNT_SECINFO, 504 NFSPROC4_CLNT_SECINFO,
501 NFSPROC4_CLNT_FSID_PRESENT, 505 NFSPROC4_CLNT_FSID_PRESENT,
502 506
503 /* nfs41 */
504 NFSPROC4_CLNT_EXCHANGE_ID, 507 NFSPROC4_CLNT_EXCHANGE_ID,
505 NFSPROC4_CLNT_CREATE_SESSION, 508 NFSPROC4_CLNT_CREATE_SESSION,
506 NFSPROC4_CLNT_DESTROY_SESSION, 509 NFSPROC4_CLNT_DESTROY_SESSION,
@@ -518,13 +521,14 @@ enum {
518 NFSPROC4_CLNT_BIND_CONN_TO_SESSION, 521 NFSPROC4_CLNT_BIND_CONN_TO_SESSION,
519 NFSPROC4_CLNT_DESTROY_CLIENTID, 522 NFSPROC4_CLNT_DESTROY_CLIENTID,
520 523
521 /* nfs42 */
522 NFSPROC4_CLNT_SEEK, 524 NFSPROC4_CLNT_SEEK,
523 NFSPROC4_CLNT_ALLOCATE, 525 NFSPROC4_CLNT_ALLOCATE,
524 NFSPROC4_CLNT_DEALLOCATE, 526 NFSPROC4_CLNT_DEALLOCATE,
525 NFSPROC4_CLNT_LAYOUTSTATS, 527 NFSPROC4_CLNT_LAYOUTSTATS,
526 NFSPROC4_CLNT_CLONE, 528 NFSPROC4_CLNT_CLONE,
527 NFSPROC4_CLNT_COPY, 529 NFSPROC4_CLNT_COPY,
530
531 NFSPROC4_CLNT_LOOKUPP,
528}; 532};
529 533
530/* nfs41 types */ 534/* nfs41 types */