The patch titled

     nfsd4: clarify close_lru handling

has been added to the -mm tree.  Its filename is

     nfsd4-clarify-close_lru-handling.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

coverity-sunrpc-xprt-task-null-check.patch
nfsd4-reboot-recovery-fix.patch
nfsd4-fix-syncing-of-recovery-directory.patch
nfsd4-lookup_one_len-takes-i_sem.patch
nfsd4-prevent-multiple-unlinks-of-recovery-directories.patch
nfsd4-fix-release_lockowner.patch
nfsd4-err_grace-should-bump-seqid-on-open.patch
nfsd4-err_grace-should-bump-seqid-on-lock.patch
nfsd4-stop-overusing-reclaim_bad.patch
nfsd4-comment-indentation.patch
nfsd4-fix-open_reclaim-seqid.patch
nfsd4-seqid-comments.patch
nfsd4-relax-new-lock-seqid-check.patch
nfsd4-always-update-stateid-on-open.patch
nfsd4-return-better-error-on-io-incompatible-with-open-mode.patch
nfsd4-renew-lease-on-seqid-modifying-operations.patch
nfsd4-clarify-close_lru-handling.patch
nfsd4-clean-up-nfs4_preprocess_seqid_op.patch
nfsd4-check-lock-type-against-openmode.patch
nfsd4-fix-fh_expire_type.patch
xdr-input-validation.patch



From: NeilBrown <[EMAIL PROTECTED]>

The handling of close_lru in preprocess_stateid_op was a source of some
confusion here recently.  Try to make the logic a little clearer, by renaming
find_openstateowner_id to make its purpose clearer and untangling some
unnecessarily complicated goto's.

Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 fs/nfsd/nfs4state.c |   40 ++++++++++++++--------------------------
 1 files changed, 14 insertions(+), 26 deletions(-)

diff -puN fs/nfsd/nfs4state.c~nfsd4-clarify-close_lru-handling 
fs/nfsd/nfs4state.c
--- 25/fs/nfsd/nfs4state.c~nfsd4-clarify-close_lru-handling     Wed Jul  6 
13:09:22 2005
+++ 25-akpm/fs/nfsd/nfs4state.c Wed Jul  6 13:09:22 2005
@@ -1988,14 +1988,11 @@ laundromat_main(void *not_used)
        queue_delayed_work(laundry_wq, &laundromat_work, t*HZ);
 }
 
-/* search ownerid_hashtbl[] and close_lru for stateid owner
- * (stateid->si_stateownerid)
- */
 static struct nfs4_stateowner *
-find_openstateowner_id(u32 st_id, int flags) {
+search_close_lru(u32 st_id, int flags)
+{
        struct nfs4_stateowner *local = NULL;
 
-       dprintk("NFSD: find_openstateowner_id %d\n", st_id);
        if (flags & CLOSE_STATE) {
                list_for_each_entry(local, &close_lru, so_close_lru) {
                        if (local->so_id == st_id)
@@ -2193,13 +2190,19 @@ nfs4_preprocess_seqid_op(struct svc_fh *
        * We return BAD_STATEID if filehandle doesn't match stateid, 
        * the confirmed flag is incorrecly set, or the generation 
        * number is incorrect.  
-       * If there is no entry in the openfile table for this id, 
-       * we can't always return BAD_STATEID;
-       * this might be a retransmitted CLOSE which has arrived after 
-       * the openfile has been released.
        */
-       if (!(stp = find_stateid(stateid, flags)))
-               goto no_nfs4_stateid;
+       stp = find_stateid(stateid, flags);
+       if (stp == NULL) {
+               /*
+                * Also, we should make sure this isn't just the result of
+                * a replayed close:
+                */
+               sop = search_close_lru(stateid->si_stateownerid, flags);
+               if (sop == NULL)
+                       return nfserr_bad_stateid;
+               *sopp = sop;
+               goto check_replay;
+       }
 
        status = nfserr_bad_stateid;
 
@@ -2263,21 +2266,6 @@ nfs4_preprocess_seqid_op(struct svc_fh *
 
 out:
        return status;
-
-no_nfs4_stateid:
-
-       /*
-       * We determine whether this is a bad stateid or a replay, 
-       * starting by trying to look up the stateowner.
-       * If stateowner is not found - stateid is bad.
-       */
-       if (!(sop = find_openstateowner_id(stateid->si_stateownerid, flags))) {
-               printk("NFSD: preprocess_seqid_op: no stateowner or 
nfs4_stateid!\n");
-               status = nfserr_bad_stateid;
-               goto out;
-       }
-       *sopp = sop;
-
 check_replay:
        if (seqid == sop->so_seqid - 1) {
                printk("NFSD: preprocess_seqid_op: retransmission?\n");
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to