pNFS: When updating the stateid in layoutreturn, also update the recall range
authorTrond Myklebust <trondmy@gmail.com>
Thu, 16 Aug 2018 01:35:46 +0000 (21:35 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 16 Aug 2018 17:29:36 +0000 (13:29 -0400)
When we update the layout stateid in nfs4_layoutreturn_refresh_stateid, we
should also update the range in order to let the server know we're actually
returning everything.

Fixes: 16c278dbfa63 ("pnfs: Fix handling of NFS4ERR_OLD_STATEID replies...")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4proc.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h

index 7071acb4422269ef4fbc4be24cb1587c51c5309f..df60dce935f36231c4993dda2ccfec3e282770a0 100644 (file)
@@ -3263,6 +3263,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
                        break;
                case -NFS4ERR_OLD_STATEID:
                        if (nfs4_layoutreturn_refresh_stateid(&calldata->arg.lr_args->stateid,
+                                               &calldata->arg.lr_args->range,
                                                calldata->inode))
                                goto lr_restart;
                        /* Fallthrough */
@@ -6001,6 +6002,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
                        break;
                case -NFS4ERR_OLD_STATEID:
                        if (nfs4_layoutreturn_refresh_stateid(&data->args.lr_args->stateid,
+                                               &data->args.lr_args->range,
                                                data->inode))
                                goto lr_restart;
                        /* Fallthrough */
@@ -8952,6 +8954,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
        switch (task->tk_status) {
        case -NFS4ERR_OLD_STATEID:
                if (nfs4_layoutreturn_refresh_stateid(&lrp->args.stateid,
+                                       &lrp->args.range,
                                        lrp->args.inode))
                        goto out_restart;
                /* Fallthrough */
index 20b3f9f80d74493bfe1c84fb5d31bcaba7293ae4..cf9912a95f5df792bc097e1fcc670120cf55ef7b 100644 (file)
@@ -361,7 +361,9 @@ pnfs_clear_lseg_state(struct pnfs_layout_segment *lseg,
 /*
  * Update the seqid of a layout stateid
  */
-bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst, struct inode *inode)
+bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst,
+               struct pnfs_layout_range *dst_range,
+               struct inode *inode)
 {
        struct pnfs_layout_hdr *lo;
        struct pnfs_layout_range range = {
@@ -379,6 +381,7 @@ bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst, struct inode *inode)
                err = pnfs_mark_matching_lsegs_return(lo, &head, &range, 0);
                if (err != -EBUSY) {
                        dst->seqid = lo->plh_stateid.seqid;
+                       *dst_range = range;
                        ret = true;
                }
        }
index 1a38a3b533b5625c04c8916dc5c02f05c2ed1a63..ece367ebde6928204418e51321401e06bc4fe9aa 100644 (file)
@@ -259,7 +259,9 @@ int pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
                bool is_recall);
 int pnfs_destroy_layouts_byclid(struct nfs_client *clp,
                bool is_recall);
-bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst, struct inode *inode);
+bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst,
+               struct pnfs_layout_range *dst_range,
+               struct inode *inode);
 void pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo);
 void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
                             const nfs4_stateid *new,
@@ -781,6 +783,7 @@ static inline void nfs4_pnfs_v3_ds_connect_unload(void)
 }
 
 static inline bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst,
+               struct pnfs_layout_range *dst_range,
                struct inode *inode)
 {
        return false;