]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
NFSv4.1: Defer bumping the slot sequence number until we free the slot
authorTrond Myklebust <trond.myklebust@primarydata.com>
Sun, 28 Aug 2016 14:28:25 +0000 (10:28 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 15 Sep 2017 03:27:50 +0000 (20:27 -0700)
For operations like OPEN or LAYOUTGET, which return recallable state
(i.e. delegations and layouts) we want to enable the mechanism for
resolving recall races in RFC5661 Section 2.10.6.3.
To do so, we will want to defer bumping the slot's sequence number until
we have finished processing the RPC results.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
(cherry picked from commit 07e8dcbda71ef87e9cbdc42b5bb16a44c1ab839b)

orabug: 25513155
Signed-off-by: Todd Vierling <todd.vierling@oracle.com>
Reviewed-By: Jack Vogel <jack.vogel@oracle.com>
Tested-by: xuan.qi@oracle.com
Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4session.h

index 319ee18da70489ce5119a38a5335969ee627d51f..907de70afe25f248f6f39c6da0dc07ff389140b7 100644 (file)
@@ -573,6 +573,11 @@ static void nfs41_sequence_free_slot(struct nfs4_sequence_res *res)
        tbl = slot->table;
        session = tbl->session;
 
+       /* Bump the slot sequence number */
+       if (slot->seq_done)
+               slot->seq_nr++;
+       slot->seq_done = 0;
+
        spin_lock(&tbl->slot_tbl_lock);
        /* Be nice to the server: try to ensure that the last transmitted
         * value for highest_user_slotid <= target_highest_slotid
@@ -621,7 +626,7 @@ int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
        switch (res->sr_status) {
        case 0:
                /* Update the slot's sequence and clientid lease timer */
-               ++slot->seq_nr;
+               slot->seq_done = 1;
                clp = session->clp;
                do_renew_lease(clp, res->sr_timestamp);
                /* Check sequence flags */
@@ -676,7 +681,7 @@ int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
                goto retry_nowait;
        default:
                /* Just update the slot sequence no. */
-               ++slot->seq_nr;
+               slot->seq_done = 1;
        }
 out:
        /* The session may be reset by one of the error handlers. */
index e3ea2c5324d68e92591058e896bf478538302a5a..c3597b033fd8223466d8b97ac38e45b9de924e01 100644 (file)
@@ -21,7 +21,8 @@ struct nfs4_slot {
        unsigned long           generation;
        u32                     slot_nr;
        u32                     seq_nr;
-       unsigned int            interrupted : 1;
+       unsigned int            interrupted : 1,
+                               seq_done : 1;
 };
 
 /* Sessions */