diff options
| author | Trond Myklebust <trondmy@gmail.com> | 2019-04-09 11:46:18 -0400 |
|---|---|---|
| committer | J. Bruce Fields <bfields@redhat.com> | 2019-04-24 09:46:35 -0400 |
| commit | 029be5d03357f0797d1b9a6b5aab5e7e311fd76a (patch) | |
| tree | 42e21a1276fff6c56d3cd43ee6b5da7310b372d8 | |
| parent | 642ee6b209c2f4c20fe0a7ed36b429c470162eae (diff) | |
nfsd: Add custom rpcbind callbacks for knfsd
Add custom rpcbind callbacks in preparation for the knfsd
per-container version feature.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| -rw-r--r-- | fs/nfsd/nfssvc.c | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 6a52400c85e0..378edcfe9701 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
| @@ -32,6 +32,18 @@ | |||
| 32 | 32 | ||
| 33 | extern struct svc_program nfsd_program; | 33 | extern struct svc_program nfsd_program; |
| 34 | static int nfsd(void *vrqstp); | 34 | static int nfsd(void *vrqstp); |
| 35 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
| 36 | static int nfsd_acl_rpcbind_set(struct net *, | ||
| 37 | const struct svc_program *, | ||
| 38 | u32, int, | ||
| 39 | unsigned short, | ||
| 40 | unsigned short); | ||
| 41 | #endif | ||
| 42 | static int nfsd_rpcbind_set(struct net *, | ||
| 43 | const struct svc_program *, | ||
| 44 | u32, int, | ||
| 45 | unsigned short, | ||
| 46 | unsigned short); | ||
| 35 | 47 | ||
| 36 | /* | 48 | /* |
| 37 | * nfsd_mutex protects nn->nfsd_serv -- both the pointer itself and the members | 49 | * nfsd_mutex protects nn->nfsd_serv -- both the pointer itself and the members |
| @@ -87,7 +99,7 @@ static struct svc_program nfsd_acl_program = { | |||
| 87 | .pg_stats = &nfsd_acl_svcstats, | 99 | .pg_stats = &nfsd_acl_svcstats, |
| 88 | .pg_authenticate = &svc_set_client, | 100 | .pg_authenticate = &svc_set_client, |
| 89 | .pg_init_request = svc_generic_init_request, | 101 | .pg_init_request = svc_generic_init_request, |
| 90 | .pg_rpcbind_set = svc_generic_rpcbind_set, | 102 | .pg_rpcbind_set = nfsd_acl_rpcbind_set, |
| 91 | }; | 103 | }; |
| 92 | 104 | ||
| 93 | static struct svc_stat nfsd_acl_svcstats = { | 105 | static struct svc_stat nfsd_acl_svcstats = { |
| @@ -121,7 +133,7 @@ struct svc_program nfsd_program = { | |||
| 121 | .pg_stats = &nfsd_svcstats, /* version table */ | 133 | .pg_stats = &nfsd_svcstats, /* version table */ |
| 122 | .pg_authenticate = &svc_set_client, /* export authentication */ | 134 | .pg_authenticate = &svc_set_client, /* export authentication */ |
| 123 | .pg_init_request = svc_generic_init_request, | 135 | .pg_init_request = svc_generic_init_request, |
| 124 | .pg_rpcbind_set = svc_generic_rpcbind_set, | 136 | .pg_rpcbind_set = nfsd_rpcbind_set, |
| 125 | }; | 137 | }; |
| 126 | 138 | ||
| 127 | static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = { | 139 | static bool nfsd_supported_minorversions[NFSD_SUPPORTED_MINOR_VERSION + 1] = { |
| @@ -670,6 +682,38 @@ out: | |||
| 670 | return error; | 682 | return error; |
| 671 | } | 683 | } |
| 672 | 684 | ||
| 685 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | ||
| 686 | static bool | ||
| 687 | nfsd_support_acl_version(int vers) | ||
| 688 | { | ||
| 689 | if (vers >= NFSD_ACL_MINVERS && vers < NFSD_ACL_NRVERS) | ||
| 690 | return nfsd_acl_version[vers] != NULL; | ||
| 691 | return false; | ||
| 692 | } | ||
| 693 | |||
| 694 | static int | ||
| 695 | nfsd_acl_rpcbind_set(struct net *net, const struct svc_program *progp, | ||
| 696 | u32 version, int family, unsigned short proto, | ||
| 697 | unsigned short port) | ||
| 698 | { | ||
| 699 | if (!nfsd_support_acl_version(version) || | ||
| 700 | !nfsd_vers(version, NFSD_TEST)) | ||
| 701 | return 0; | ||
| 702 | return svc_generic_rpcbind_set(net, progp, version, family, | ||
| 703 | proto, port); | ||
| 704 | } | ||
| 705 | #endif | ||
| 706 | |||
| 707 | static int | ||
| 708 | nfsd_rpcbind_set(struct net *net, const struct svc_program *progp, | ||
| 709 | u32 version, int family, unsigned short proto, | ||
| 710 | unsigned short port) | ||
| 711 | { | ||
| 712 | if (!nfsd_vers(version, NFSD_TEST)) | ||
| 713 | return 0; | ||
| 714 | return svc_generic_rpcbind_set(net, progp, version, family, | ||
| 715 | proto, port); | ||
| 716 | } | ||
| 673 | 717 | ||
| 674 | /* | 718 | /* |
| 675 | * This is the NFS server kernel thread | 719 | * This is the NFS server kernel thread |
