aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-07-07 20:59:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:24:10 -0400
commit3a4f98bbf481cb9f755005ac569ceb5303e1b69f (patch)
treea3dfac239801fd5d96222f48a1f2caf59a650826 /fs
parentf8816512fcfde986326a2eb0f5a58e463d9904d8 (diff)
[PATCH] nfsd4: clean up nfs4_preprocess_seqid_op
As long as we're here, do some miscellaneous cleanup. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> 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/nfs4state.c56
1 files changed, 22 insertions, 34 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 67e03b5d0d83..59b214f01b6d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2165,7 +2165,6 @@ out:
2165static int 2165static int
2166nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid) 2166nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, clientid_t *lockclid)
2167{ 2167{
2168 int status;
2169 struct nfs4_stateid *stp; 2168 struct nfs4_stateid *stp;
2170 struct nfs4_stateowner *sop; 2169 struct nfs4_stateowner *sop;
2171 2170
@@ -2173,19 +2172,17 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2173 "stateid = (%08x/%08x/%08x/%08x)\n", seqid, 2172 "stateid = (%08x/%08x/%08x/%08x)\n", seqid,
2174 stateid->si_boot, stateid->si_stateownerid, stateid->si_fileid, 2173 stateid->si_boot, stateid->si_stateownerid, stateid->si_fileid,
2175 stateid->si_generation); 2174 stateid->si_generation);
2176 2175
2177 *stpp = NULL; 2176 *stpp = NULL;
2178 *sopp = NULL; 2177 *sopp = NULL;
2179 2178
2180 status = nfserr_bad_stateid;
2181 if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) { 2179 if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) {
2182 printk("NFSD: preprocess_seqid_op: magic stateid!\n"); 2180 printk("NFSD: preprocess_seqid_op: magic stateid!\n");
2183 goto out; 2181 return nfserr_bad_stateid;
2184 } 2182 }
2185 2183
2186 status = nfserr_stale_stateid;
2187 if (STALE_STATEID(stateid)) 2184 if (STALE_STATEID(stateid))
2188 goto out; 2185 return nfserr_stale_stateid;
2189 /* 2186 /*
2190 * We return BAD_STATEID if filehandle doesn't match stateid, 2187 * We return BAD_STATEID if filehandle doesn't match stateid,
2191 * the confirmed flag is incorrecly set, or the generation 2188 * the confirmed flag is incorrecly set, or the generation
@@ -2204,8 +2201,6 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2204 goto check_replay; 2201 goto check_replay;
2205 } 2202 }
2206 2203
2207 status = nfserr_bad_stateid;
2208
2209 /* for new lock stateowners: 2204 /* for new lock stateowners:
2210 * check that the lock->v.new.open_stateid 2205 * check that the lock->v.new.open_stateid
2211 * refers to an open stateowner 2206 * refers to an open stateowner
@@ -2218,14 +2213,14 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2218 struct nfs4_client *clp = sop->so_client; 2213 struct nfs4_client *clp = sop->so_client;
2219 2214
2220 if (!sop->so_is_open_owner) 2215 if (!sop->so_is_open_owner)
2221 goto out; 2216 return nfserr_bad_stateid;
2222 if (!cmp_clid(&clp->cl_clientid, lockclid)) 2217 if (!cmp_clid(&clp->cl_clientid, lockclid))
2223 goto out; 2218 return nfserr_bad_stateid;
2224 } 2219 }
2225 2220
2226 if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) { 2221 if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) {
2227 printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n"); 2222 printk("NFSD: preprocess_seqid_op: fh-stateid mismatch!\n");
2228 goto out; 2223 return nfserr_bad_stateid;
2229 } 2224 }
2230 2225
2231 *stpp = stp; 2226 *stpp = stp;
@@ -2239,45 +2234,38 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
2239 if (seqid != sop->so_seqid) 2234 if (seqid != sop->so_seqid)
2240 goto check_replay; 2235 goto check_replay;
2241 2236
2242 if (sop->so_confirmed) { 2237 if (sop->so_confirmed && flags & CONFIRM) {
2243 if (flags & CONFIRM) { 2238 printk("NFSD: preprocess_seqid_op: expected"
2244 printk("NFSD: preprocess_seqid_op: expected unconfirmed stateowner!\n"); 2239 " unconfirmed stateowner!\n");
2245 goto out; 2240 return nfserr_bad_stateid;
2246 }
2247 } 2241 }
2248 else { 2242 if (!sop->so_confirmed && !(flags & CONFIRM)) {
2249 if (!(flags & CONFIRM)) { 2243 printk("NFSD: preprocess_seqid_op: stateowner not"
2250 printk("NFSD: preprocess_seqid_op: stateowner not confirmed yet!\n"); 2244 " confirmed yet!\n");
2251 goto out; 2245 return nfserr_bad_stateid;
2252 }
2253 } 2246 }
2254 if (stateid->si_generation > stp->st_stateid.si_generation) { 2247 if (stateid->si_generation > stp->st_stateid.si_generation) {
2255 printk("NFSD: preprocess_seqid_op: future stateid?!\n"); 2248 printk("NFSD: preprocess_seqid_op: future stateid?!\n");
2256 goto out; 2249 return nfserr_bad_stateid;
2257 } 2250 }
2258 2251
2259 status = nfserr_old_stateid;
2260 if (stateid->si_generation < stp->st_stateid.si_generation) { 2252 if (stateid->si_generation < stp->st_stateid.si_generation) {
2261 printk("NFSD: preprocess_seqid_op: old stateid!\n"); 2253 printk("NFSD: preprocess_seqid_op: old stateid!\n");
2262 goto out; 2254 return nfserr_old_stateid;
2263 } 2255 }
2264 renew_client(sop->so_client); 2256 renew_client(sop->so_client);
2265 status = nfs_ok; 2257 return nfs_ok;
2266 2258
2267out:
2268 return status;
2269check_replay: 2259check_replay:
2270 if (seqid == sop->so_seqid - 1) { 2260 if (seqid == sop->so_seqid - 1) {
2271 printk("NFSD: preprocess_seqid_op: retransmission?\n"); 2261 printk("NFSD: preprocess_seqid_op: retransmission?\n");
2272 /* indicate replay to calling function */ 2262 /* indicate replay to calling function */
2273 status = NFSERR_REPLAY_ME; 2263 return NFSERR_REPLAY_ME;
2274 } else {
2275 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d\n", sop->so_seqid, seqid);
2276
2277 *sopp = NULL;
2278 status = nfserr_bad_seqid;
2279 } 2264 }
2280 goto out; 2265 printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n",
2266 sop->so_seqid, seqid);
2267 *sopp = NULL;
2268 return nfserr_bad_seqid;
2281} 2269}
2282 2270
2283int 2271int