diff options
| -rw-r--r-- | fs/nfsd/nfs4proc.c | 254 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 14 | ||||
| -rw-r--r-- | include/linux/nfsd/state.h | 1 | ||||
| -rw-r--r-- | include/linux/nfsd/xdr4.h | 5 |
4 files changed, 144 insertions, 130 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 8fc2cab9d76a..e1c463bad124 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -258,7 +258,8 @@ out: | |||
| 258 | * filehandle-manipulating ops. | 258 | * filehandle-manipulating ops. |
| 259 | */ | 259 | */ |
| 260 | static __be32 | 260 | static __be32 |
| 261 | nfsd4_getfh(struct nfsd4_compound_state *cstate, struct svc_fh **getfh) | 261 | nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
| 262 | struct svc_fh **getfh) | ||
| 262 | { | 263 | { |
| 263 | if (!cstate->current_fh.fh_dentry) | 264 | if (!cstate->current_fh.fh_dentry) |
| 264 | return nfserr_nofilehandle; | 265 | return nfserr_nofilehandle; |
| @@ -279,7 +280,8 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 279 | } | 280 | } |
| 280 | 281 | ||
| 281 | static __be32 | 282 | static __be32 |
| 282 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate) | 283 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
| 284 | void *arg) | ||
| 283 | { | 285 | { |
| 284 | __be32 status; | 286 | __be32 status; |
| 285 | 287 | ||
| @@ -290,7 +292,8 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate) | |||
| 290 | } | 292 | } |
| 291 | 293 | ||
| 292 | static __be32 | 294 | static __be32 |
| 293 | nfsd4_restorefh(struct nfsd4_compound_state *cstate) | 295 | nfsd4_restorefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
| 296 | void *arg) | ||
| 294 | { | 297 | { |
| 295 | if (!cstate->save_fh.fh_dentry) | 298 | if (!cstate->save_fh.fh_dentry) |
| 296 | return nfserr_restorefh; | 299 | return nfserr_restorefh; |
| @@ -300,7 +303,8 @@ nfsd4_restorefh(struct nfsd4_compound_state *cstate) | |||
| 300 | } | 303 | } |
| 301 | 304 | ||
| 302 | static __be32 | 305 | static __be32 |
| 303 | nfsd4_savefh(struct nfsd4_compound_state *cstate) | 306 | nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
| 307 | void *arg) | ||
| 304 | { | 308 | { |
| 305 | if (!cstate->current_fh.fh_dentry) | 309 | if (!cstate->current_fh.fh_dentry) |
| 306 | return nfserr_nofilehandle; | 310 | return nfserr_nofilehandle; |
| @@ -463,7 +467,8 @@ nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 463 | } | 467 | } |
| 464 | 468 | ||
| 465 | static __be32 | 469 | static __be32 |
| 466 | nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate) | 470 | nfsd4_lookupp(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
| 471 | void *arg) | ||
| 467 | { | 472 | { |
| 468 | struct svc_fh tmp_fh; | 473 | struct svc_fh tmp_fh; |
| 469 | __be32 ret; | 474 | __be32 ret; |
| @@ -791,6 +796,16 @@ static struct nfsd4_compound_state *cstate_alloc(void) | |||
| 791 | return cstate; | 796 | return cstate; |
| 792 | } | 797 | } |
| 793 | 798 | ||
| 799 | typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *, | ||
| 800 | void *); | ||
| 801 | |||
| 802 | struct nfsd4_operation { | ||
| 803 | nfsd4op_func op_func; | ||
| 804 | u32 op_flags; | ||
| 805 | }; | ||
| 806 | |||
| 807 | static struct nfsd4_operation nfsd4_ops[]; | ||
| 808 | |||
| 794 | /* | 809 | /* |
| 795 | * COMPOUND call. | 810 | * COMPOUND call. |
| 796 | */ | 811 | */ |
| @@ -800,6 +815,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 800 | struct nfsd4_compoundres *resp) | 815 | struct nfsd4_compoundres *resp) |
| 801 | { | 816 | { |
| 802 | struct nfsd4_op *op; | 817 | struct nfsd4_op *op; |
| 818 | struct nfsd4_operation *opdesc; | ||
| 803 | struct nfsd4_compound_state *cstate = NULL; | 819 | struct nfsd4_compound_state *cstate = NULL; |
| 804 | int slack_bytes; | 820 | int slack_bytes; |
| 805 | __be32 status; | 821 | __be32 status; |
| @@ -854,6 +870,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 854 | goto encode_op; | 870 | goto encode_op; |
| 855 | } | 871 | } |
| 856 | 872 | ||
| 873 | opdesc = &nfsd4_ops[op->opnum]; | ||
| 874 | |||
| 857 | /* All operations except RENEW, SETCLIENTID, RESTOREFH | 875 | /* All operations except RENEW, SETCLIENTID, RESTOREFH |
| 858 | * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH | 876 | * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH |
| 859 | * require a valid current filehandle | 877 | * require a valid current filehandle |
| @@ -883,127 +901,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 883 | op->status = nfserr_moved; | 901 | op->status = nfserr_moved; |
| 884 | goto encode_op; | 902 | goto encode_op; |
| 885 | } | 903 | } |
| 886 | switch (op->opnum) { | 904 | |
| 887 | case OP_ACCESS: | 905 | if (opdesc->op_func) |
| 888 | op->status = nfsd4_access(rqstp, cstate, | 906 | op->status = opdesc->op_func(rqstp, cstate, &op->u); |
| 889 | &op->u.access); | 907 | else |
| 890 | break; | ||
| 891 | case OP_CLOSE: | ||
| 892 | op->status = nfsd4_close(rqstp, cstate, | ||
| 893 | &op->u.close); | ||
| 894 | break; | ||
| 895 | case OP_COMMIT: | ||
| 896 | op->status = nfsd4_commit(rqstp, cstate, | ||
| 897 | &op->u.commit); | ||
| 898 | break; | ||
| 899 | case OP_CREATE: | ||
| 900 | op->status = nfsd4_create(rqstp, cstate, | ||
| 901 | &op->u.create); | ||
| 902 | break; | ||
| 903 | case OP_DELEGRETURN: | ||
| 904 | op->status = nfsd4_delegreturn(rqstp, cstate, | ||
| 905 | &op->u.delegreturn); | ||
| 906 | break; | ||
| 907 | case OP_GETATTR: | ||
| 908 | op->status = nfsd4_getattr(rqstp, cstate, | ||
| 909 | &op->u.getattr); | ||
| 910 | break; | ||
| 911 | case OP_GETFH: | ||
| 912 | op->status = nfsd4_getfh(cstate, &op->u.getfh); | ||
| 913 | break; | ||
| 914 | case OP_LINK: | ||
| 915 | op->status = nfsd4_link(rqstp, cstate, &op->u.link); | ||
| 916 | break; | ||
| 917 | case OP_LOCK: | ||
| 918 | op->status = nfsd4_lock(rqstp, cstate, &op->u.lock); | ||
| 919 | break; | ||
| 920 | case OP_LOCKT: | ||
| 921 | op->status = nfsd4_lockt(rqstp, cstate, &op->u.lockt); | ||
| 922 | break; | ||
| 923 | case OP_LOCKU: | ||
| 924 | op->status = nfsd4_locku(rqstp, cstate, &op->u.locku); | ||
| 925 | break; | ||
| 926 | case OP_LOOKUP: | ||
| 927 | op->status = nfsd4_lookup(rqstp, cstate, | ||
| 928 | &op->u.lookup); | ||
| 929 | break; | ||
| 930 | case OP_LOOKUPP: | ||
| 931 | op->status = nfsd4_lookupp(rqstp, cstate); | ||
| 932 | break; | ||
| 933 | case OP_NVERIFY: | ||
| 934 | op->status = nfsd4_nverify(rqstp, cstate, | ||
| 935 | &op->u.nverify); | ||
| 936 | break; | ||
| 937 | case OP_OPEN: | ||
| 938 | op->status = nfsd4_open(rqstp, cstate, | ||
| 939 | &op->u.open); | ||
| 940 | break; | ||
| 941 | case OP_OPEN_CONFIRM: | ||
| 942 | op->status = nfsd4_open_confirm(rqstp, cstate, | ||
| 943 | &op->u.open_confirm); | ||
| 944 | break; | ||
| 945 | case OP_OPEN_DOWNGRADE: | ||
| 946 | op->status = nfsd4_open_downgrade(rqstp, cstate, | ||
| 947 | &op->u.open_downgrade); | ||
| 948 | break; | ||
| 949 | case OP_PUTFH: | ||
| 950 | op->status = nfsd4_putfh(rqstp, cstate, &op->u.putfh); | ||
| 951 | break; | ||
| 952 | case OP_PUTROOTFH: | ||
| 953 | op->status = nfsd4_putrootfh(rqstp, cstate); | ||
| 954 | break; | ||
| 955 | case OP_READ: | ||
| 956 | op->status = nfsd4_read(rqstp, cstate, &op->u.read); | ||
| 957 | break; | ||
| 958 | case OP_READDIR: | ||
| 959 | op->status = nfsd4_readdir(rqstp, cstate, | ||
| 960 | &op->u.readdir); | ||
| 961 | break; | ||
| 962 | case OP_READLINK: | ||
| 963 | op->status = nfsd4_readlink(rqstp, cstate, | ||
| 964 | &op->u.readlink); | ||
| 965 | break; | ||
| 966 | case OP_REMOVE: | ||
| 967 | op->status = nfsd4_remove(rqstp, cstate, | ||
| 968 | &op->u.remove); | ||
| 969 | break; | ||
| 970 | case OP_RENAME: | ||
| 971 | op->status = nfsd4_rename(rqstp, cstate, | ||
| 972 | &op->u.rename); | ||
| 973 | break; | ||
