diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 76 |
1 files changed, 32 insertions, 44 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ace39349670a..c560af8c69d2 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1950,6 +1950,17 @@ fail: | |||
1950 | return -EINVAL; | 1950 | return -EINVAL; |
1951 | } | 1951 | } |
1952 | 1952 | ||
1953 | static void | ||
1954 | nfsd4_encode_stateid(struct nfsd4_compoundres *resp, stateid_t *sid) | ||
1955 | { | ||
1956 | ENCODE_HEAD; | ||
1957 | |||
1958 | RESERVE_SPACE(sizeof(stateid_t)); | ||
1959 | WRITE32(sid->si_generation); | ||
1960 | WRITEMEM(&sid->si_opaque, sizeof(stateid_opaque_t)); | ||
1961 | ADJUST_ARGS(); | ||
1962 | } | ||
1963 | |||
1953 | static __be32 | 1964 | static __be32 |
1954 | nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access) | 1965 | nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access) |
1955 | { | 1966 | { |
@@ -1969,12 +1980,9 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_c | |||
1969 | { | 1980 | { |
1970 | ENCODE_SEQID_OP_HEAD; | 1981 | ENCODE_SEQID_OP_HEAD; |
1971 | 1982 | ||
1972 | if (!nfserr) { | 1983 | if (!nfserr) |
1973 | RESERVE_SPACE(sizeof(stateid_t)); | 1984 | nfsd4_encode_stateid(resp, &close->cl_stateid); |
1974 | WRITE32(close->cl_stateid.si_generation); | 1985 | |
1975 | WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
1976 | ADJUST_ARGS(); | ||
1977 | } | ||
1978 | ENCODE_SEQID_OP_TAIL(close->cl_stateowner); | 1986 | ENCODE_SEQID_OP_TAIL(close->cl_stateowner); |
1979 | return nfserr; | 1987 | return nfserr; |
1980 | } | 1988 | } |
@@ -2074,12 +2082,9 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lo | |||
2074 | { | 2082 | { |
2075 | ENCODE_SEQID_OP_HEAD; | 2083 | ENCODE_SEQID_OP_HEAD; |
2076 | 2084 | ||
2077 | if (!nfserr) { | 2085 | if (!nfserr) |
2078 | RESERVE_SPACE(4 + sizeof(stateid_t)); | 2086 | nfsd4_encode_stateid(resp, &lock->lk_resp_stateid); |
2079 | WRITE32(lock->lk_resp_stateid.si_generation); | 2087 | else if (nfserr == nfserr_denied) |
2080 | WRITEMEM(&lock->lk_resp_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
2081 | ADJUST_ARGS(); | ||
2082 | } else if (nfserr == nfserr_denied) | ||
2083 | nfsd4_encode_lock_denied(resp, &lock->lk_denied); | 2088 | nfsd4_encode_lock_denied(resp, &lock->lk_denied); |
2084 | 2089 | ||
2085 | ENCODE_SEQID_OP_TAIL(lock->lk_replay_owner); | 2090 | ENCODE_SEQID_OP_TAIL(lock->lk_replay_owner); |
@@ -2099,13 +2104,9 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_l | |||
2099 | { | 2104 | { |
2100 | ENCODE_SEQID_OP_HEAD; | 2105 | ENCODE_SEQID_OP_HEAD; |
2101 | 2106 | ||
2102 | if (!nfserr) { | 2107 | if (!nfserr) |
2103 | RESERVE_SPACE(sizeof(stateid_t)); | 2108 | nfsd4_encode_stateid(resp, &locku->lu_stateid); |
2104 | WRITE32(locku->lu_stateid.si_generation); | 2109 | |
2105 | WRITEMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
2106 | ADJUST_ARGS(); | ||
2107 | } | ||
2108 | |||
2109 | ENCODE_SEQID_OP_TAIL(locku->lu_stateowner); | 2110 | ENCODE_SEQID_OP_TAIL(locku->lu_stateowner); |
2110 | return nfserr; | 2111 | return nfserr; |
2111 | } | 2112 | } |
@@ -2133,9 +2134,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op | |||
2133 | if (nfserr) | 2134 | if (nfserr) |
2134 | goto out; | 2135 | goto out; |
2135 | 2136 | ||
2136 | RESERVE_SPACE(40 + sizeof(stateid_t)); | 2137 | nfsd4_encode_stateid(resp, &open->op_stateid); |
2137 | WRITE32(open->op_stateid.si_generation); | 2138 | RESERVE_SPACE(40); |
2138 | WRITEMEM(&open->op_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
2139 | WRITECINFO(open->op_cinfo); | 2139 | WRITECINFO(open->op_cinfo); |
2140 | WRITE32(open->op_rflags); | 2140 | WRITE32(open->op_rflags); |
2141 | WRITE32(2); | 2141 | WRITE32(2); |
@@ -2148,10 +2148,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op | |||
2148 | case NFS4_OPEN_DELEGATE_NONE: | 2148 | case NFS4_OPEN_DELEGATE_NONE: |
2149 | break; | 2149 | break; |
2150 | case NFS4_OPEN_DELEGATE_READ: | 2150 | case NFS4_OPEN_DELEGATE_READ: |
2151 | RESERVE_SPACE(20 + sizeof(stateid_t)); | 2151 | nfsd4_encode_stateid(resp, &open->op_delegate_stateid); |
2152 | WRITE32(open->op_delegate_stateid.si_generation); | 2152 | RESERVE_SPACE(20); |
2153 | WRITEMEM(&open->op_delegate_stateid.si_opaque, | ||
2154 | sizeof(stateid_opaque_t)); | ||
2155 | WRITE32(open->op_recall); | 2153 | WRITE32(open->op_recall); |
2156 | 2154 | ||
2157 | /* | 2155 | /* |
@@ -2164,10 +2162,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_op | |||
2164 | ADJUST_ARGS(); | 2162 | ADJUST_ARGS(); |
2165 | break; | 2163 | break; |
2166 | case NFS4_OPEN_DELEGATE_WRITE: | 2164 | case NFS4_OPEN_DELEGATE_WRITE: |
2167 | RESERVE_SPACE(32 + sizeof(stateid_t)); | 2165 | nfsd4_encode_stateid(resp, &open->op_delegate_stateid); |
2168 | WRITE32(open->op_delegate_stateid.si_generation); | 2166 | RESERVE_SPACE(32); |
2169 | WRITEMEM(&open->op_delegate_stateid.si_opaque, | ||
2170 | sizeof(stateid_opaque_t)); | ||
2171 | WRITE32(0); | 2167 | WRITE32(0); |
2172 | 2168 | ||
2173 | /* | 2169 | /* |
@@ -2199,13 +2195,9 @@ static __be32 | |||
2199 | nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc) | 2195 | nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc) |
2200 | { | 2196 | { |
2201 | ENCODE_SEQID_OP_HEAD; | 2197 | ENCODE_SEQID_OP_HEAD; |
2202 | 2198 | ||
2203 | if (!nfserr) { | 2199 | if (!nfserr) |
2204 | RESERVE_SPACE(sizeof(stateid_t)); | 2200 | nfsd4_encode_stateid(resp, &oc->oc_resp_stateid); |
2205 | WRITE32(oc->oc_resp_stateid.si_generation); | ||
2206 | WRITEMEM(&oc->oc_resp_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
2207 | ADJUST_ARGS(); | ||
2208 | } | ||
2209 | 2201 | ||
2210 | ENCODE_SEQID_OP_TAIL(oc->oc_stateowner); | 2202 | ENCODE_SEQID_OP_TAIL(oc->oc_stateowner); |
2211 | return nfserr; | 2203 | return nfserr; |
@@ -2215,13 +2207,9 @@ static __be32 | |||
2215 | nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od) | 2207 | nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od) |
2216 | { | 2208 | { |
2217 | ENCODE_SEQID_OP_HEAD; | 2209 | ENCODE_SEQID_OP_HEAD; |
2218 | 2210 | ||
2219 | if (!nfserr) { | 2211 | if (!nfserr) |
2220 | RESERVE_SPACE(sizeof(stateid_t)); | 2212 | nfsd4_encode_stateid(resp, &od->od_stateid); |
2221 | WRITE32(od->od_stateid.si_generation); | ||
2222 | WRITEMEM(&od->od_stateid.si_opaque, sizeof(stateid_opaque_t)); | ||
2223 | ADJUST_ARGS(); | ||
2224 | } | ||
2225 | 2213 | ||
2226 | ENCODE_SEQID_OP_TAIL(od->od_stateowner); | 2214 | ENCODE_SEQID_OP_TAIL(od->od_stateowner); |
2227 | return nfserr; | 2215 | return nfserr; |