Commit ecf84026 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

pNFS: When updating the stateid in layoutreturn, also update the recall range

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: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 8618289c
...@@ -3263,6 +3263,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) ...@@ -3263,6 +3263,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
break; break;
case -NFS4ERR_OLD_STATEID: case -NFS4ERR_OLD_STATEID:
if (nfs4_layoutreturn_refresh_stateid(&calldata->arg.lr_args->stateid, if (nfs4_layoutreturn_refresh_stateid(&calldata->arg.lr_args->stateid,
&calldata->arg.lr_args->range,
calldata->inode)) calldata->inode))
goto lr_restart; goto lr_restart;
/* Fallthrough */ /* Fallthrough */
...@@ -6001,6 +6002,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) ...@@ -6001,6 +6002,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata)
break; break;
case -NFS4ERR_OLD_STATEID: case -NFS4ERR_OLD_STATEID:
if (nfs4_layoutreturn_refresh_stateid(&data->args.lr_args->stateid, if (nfs4_layoutreturn_refresh_stateid(&data->args.lr_args->stateid,
&data->args.lr_args->range,
data->inode)) data->inode))
goto lr_restart; goto lr_restart;
/* Fallthrough */ /* Fallthrough */
...@@ -8952,6 +8954,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) ...@@ -8952,6 +8954,7 @@ static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
switch (task->tk_status) { switch (task->tk_status) {
case -NFS4ERR_OLD_STATEID: case -NFS4ERR_OLD_STATEID:
if (nfs4_layoutreturn_refresh_stateid(&lrp->args.stateid, if (nfs4_layoutreturn_refresh_stateid(&lrp->args.stateid,
&lrp->args.range,
lrp->args.inode)) lrp->args.inode))
goto out_restart; goto out_restart;
/* Fallthrough */ /* Fallthrough */
......
...@@ -361,7 +361,9 @@ pnfs_clear_lseg_state(struct pnfs_layout_segment *lseg, ...@@ -361,7 +361,9 @@ pnfs_clear_lseg_state(struct pnfs_layout_segment *lseg,
/* /*
* Update the seqid of a layout stateid * 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_hdr *lo;
struct pnfs_layout_range range = { struct pnfs_layout_range range = {
...@@ -379,6 +381,7 @@ bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst, struct inode *inode) ...@@ -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); err = pnfs_mark_matching_lsegs_return(lo, &head, &range, 0);
if (err != -EBUSY) { if (err != -EBUSY) {
dst->seqid = lo->plh_stateid.seqid; dst->seqid = lo->plh_stateid.seqid;
*dst_range = range;
ret = true; ret = true;
} }
} }
......
...@@ -259,7 +259,9 @@ int pnfs_destroy_layouts_byfsid(struct nfs_client *clp, ...@@ -259,7 +259,9 @@ int pnfs_destroy_layouts_byfsid(struct nfs_client *clp,
bool is_recall); bool is_recall);
int pnfs_destroy_layouts_byclid(struct nfs_client *clp, int pnfs_destroy_layouts_byclid(struct nfs_client *clp,
bool is_recall); 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_put_layout_hdr(struct pnfs_layout_hdr *lo);
void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, void pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo,
const nfs4_stateid *new, const nfs4_stateid *new,
...@@ -781,6 +783,7 @@ static inline void nfs4_pnfs_v3_ds_connect_unload(void) ...@@ -781,6 +783,7 @@ static inline void nfs4_pnfs_v3_ds_connect_unload(void)
} }
static inline bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst, static inline bool nfs4_layoutreturn_refresh_stateid(nfs4_stateid *dst,
struct pnfs_layout_range *dst_range,
struct inode *inode) struct inode *inode)
{ {
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment