Commit:     39325bd03fc16d903f1e0f51104436d939899c8c
Parent:     b7e6b86948df8d08d420558212e09eb449be9bfa
Author:     J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 17:06:39 2007 -0500
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Fri Feb 1 16:42:06 2008 -0500

    nfsd4: fix bad seqid on lock request incompatible with open mode
    The failure to return a stateowner from nfs4_preprocess_seqid_op() means
    in the case where a lock request is of a type incompatible with an open
    (due to, e.g., an application attempting a write lock on a file open for
    read), means that fs/nfsd/nfs4xdr.c:ENCODE_SEQID_OP_TAIL() never bumps
    the seqid as it should.  The client, attempting to close the file
    afterwards, then gets an (incorrect) bad sequence id error.  Worse, this
    prevents the open file from ever being closed, so we leak state.
    Thanks to Benny Halevy and Trond Myklebust for analysis, and to Steven
    Wilton for the report and extensive data-gathering.
    Cc: Benny Halevy <[EMAIL PROTECTED]>
    Cc: Steven Wilton <[EMAIL PROTECTED]>
    Cc: Trond Myklebust <[EMAIL PROTECTED]>
    Signed-off-by: J. Bruce Fields <[EMAIL PROTECTED]>
 fs/nfsd/nfs4state.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 11aa4b6..c4b10a1 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2093,8 +2093,10 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 
seqid, stateid_t *statei
                goto check_replay;
+       *stpp = stp;
+       *sopp = sop = stp->st_stateowner;
        if (lock) {
-               struct nfs4_stateowner *sop = stp->st_stateowner;
                clientid_t *lockclid = &lock->;
                struct nfs4_client *clp = sop->so_client;
                int lkflg = 0;
@@ -2124,9 +2126,6 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 
seqid, stateid_t *statei
                return nfserr_bad_stateid;
-       *stpp = stp;
-       *sopp = sop = stp->st_stateowner;
        *  We now validate the seqid and stateid generation numbers.
        *  For the moment, we ignore the possibility of 
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to