aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ.Bruce Fields <bfields@fieldses.org>2006-12-13 03:35:43 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:54 -0500
commit27d630ece08ae15e35d54201665c247a9fae584c (patch)
treef679628de2d82d809303d1ca838afececed4ebaf /fs
parenteeac294ebd9254a937d90b00c48863e3af229047 (diff)
[PATCH] knfsd: nfsd4: simplify filehandle check
Kill another big "if" clause. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4proc.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 3a652e741374..8522729830db 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -802,8 +802,10 @@ typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
802struct nfsd4_operation { 802struct nfsd4_operation {
803 nfsd4op_func op_func; 803 nfsd4op_func op_func;
804 u32 op_flags; 804 u32 op_flags;
805/* Most ops require a valid current filehandle; a few don't: */
806#define ALLOWED_WITHOUT_FH 1
805/* GETATTR and ops not listed as returning NFS4ERR_MOVED: */ 807/* GETATTR and ops not listed as returning NFS4ERR_MOVED: */
806#define ALLOWED_ON_ABSENT_FS 1 808#define ALLOWED_ON_ABSENT_FS 2
807}; 809};
808 810
809static struct nfsd4_operation nfsd4_ops[]; 811static struct nfsd4_operation nfsd4_ops[];
@@ -874,18 +876,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
874 876
875 opdesc = &nfsd4_ops[op->opnum]; 877 opdesc = &nfsd4_ops[op->opnum];
876 878
877 /* All operations except RENEW, SETCLIENTID, RESTOREFH
878 * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH
879 * require a valid current filehandle
880 */
881 if (!cstate->current_fh.fh_dentry) { 879 if (!cstate->current_fh.fh_dentry) {
882 if (!((op->opnum == OP_PUTFH) || 880 if (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {
883 (op->opnum == OP_PUTROOTFH) ||
884 (op->opnum == OP_SETCLIENTID) ||
885 (op->opnum == OP_SETCLIENTID_CONFIRM) ||
886 (op->opnum == OP_RENEW) ||
887 (op->opnum == OP_RESTOREFH) ||
888 (op->opnum == OP_RELEASE_LOCKOWNER))) {
889 op->status = nfserr_nofilehandle; 881 op->status = nfserr_nofilehandle;
890 goto encode_op; 882 goto encode_op;
891 } 883 }
@@ -981,14 +973,15 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
981 }, 973 },
982 [OP_PUTFH] = { 974 [OP_PUTFH] = {
983 .op_func = (nfsd4op_func)nfsd4_putfh, 975 .op_func = (nfsd4op_func)nfsd4_putfh,
976 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
984 }, 977 },
985 [OP_PUTPUBFH] = { 978 [OP_PUTPUBFH] = {
986 /* unsupported; just for future reference: */ 979 /* unsupported; just for future reference: */
987 .op_flags = ALLOWED_ON_ABSENT_FS, 980 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
988 }, 981 },
989 [OP_PUTROOTFH] = { 982 [OP_PUTROOTFH] = {
990 .op_func = (nfsd4op_func)nfsd4_putrootfh, 983 .op_func = (nfsd4op_func)nfsd4_putrootfh,
991 .op_flags = ALLOWED_ON_ABSENT_FS, 984 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
992 }, 985 },
993 [OP_READ] = { 986 [OP_READ] = {
994 .op_func = (nfsd4op_func)nfsd4_read, 987 .op_func = (nfsd4op_func)nfsd4_read,
@@ -1007,10 +1000,11 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1007 }, 1000 },
1008 [OP_RENEW] = { 1001 [OP_RENEW] = {
1009 .op_func = (nfsd4op_func)nfsd4_renew, 1002 .op_func = (nfsd4op_func)nfsd4_renew,
1010 .op_flags = ALLOWED_ON_ABSENT_FS, 1003 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
1011 }, 1004 },
1012 [OP_RESTOREFH] = { 1005 [OP_RESTOREFH] = {
1013 .op_func = (nfsd4op_func)nfsd4_restorefh, 1006 .op_func = (nfsd4op_func)nfsd4_restorefh,
1007 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
1014 }, 1008 },
1015 [OP_SAVEFH] = { 1009 [OP_SAVEFH] = {
1016 .op_func = (nfsd4op_func)nfsd4_savefh, 1010 .op_func = (nfsd4op_func)nfsd4_savefh,
@@ -1020,10 +1014,11 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1020 }, 1014 },
1021 [OP_SETCLIENTID] = { 1015 [OP_SETCLIENTID] = {
1022 .op_func = (nfsd4op_func)nfsd4_setclientid, 1016 .op_func = (nfsd4op_func)nfsd4_setclientid,
1023 .op_flags = ALLOWED_ON_ABSENT_FS, 1017 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
1024 }, 1018 },
1025 [OP_SETCLIENTID_CONFIRM] = { 1019 [OP_SETCLIENTID_CONFIRM] = {
1026 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm, 1020 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm,
1021 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
1027 }, 1022 },
1028 [OP_VERIFY] = { 1023 [OP_VERIFY] = {
1029 .op_func = (nfsd4op_func)nfsd4_verify, 1024 .op_func = (nfsd4op_func)nfsd4_verify,
@@ -1033,7 +1028,7 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1033 }, 1028 },
1034 [OP_RELEASE_LOCKOWNER] = { 1029 [OP_RELEASE_LOCKOWNER] = {
1035 .op_func = (nfsd4op_func)nfsd4_release_lockowner, 1030 .op_func = (nfsd4op_func)nfsd4_release_lockowner,
1036 .op_flags = ALLOWED_ON_ABSENT_FS, 1031 .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_ON_ABSENT_FS,
1037 }, 1032 },
1038}; 1033};
1039 1034