@@ -862,3 +862,25 @@ int nfs4_pnfs_return_layout(struct svc_rqst *rqstp,
dprintk("pNFS %s: exit status %d\n", __func__, status);
return status;
}
+
+/*
+ * Note: must be called under the state lock
+ */
+void pnfs_expire_client(struct nfs4_client *clp)
+{
+ struct nfsd4_pnfs_layoutreturn lr = {
+ .args.lr_return_type = RETURN_ALL,
+ .args.lr_seg = {
+ .iomode = IOMODE_ANY,
+ .offset = 0,
+ .length = NFS4_MAX_UINT64,
+ },
+ };
+ LIST_HEAD(lo_destroy_list);
+
+ nfs4_assert_state_locked();
+
+ pnfs_return_client_layouts(clp, &lr, 0, &lo_destroy_list);
+
+ destroy_layout_list(&lo_destroy_list);
+}
@@ -1172,6 +1172,7 @@ static struct nfs4_client *alloc_client(struct xdr_netobj name)
oo = list_entry(clp->cl_openowners.next, struct nfs4_openowner, oo_perclient);
release_openowner(oo);
}
+ pnfs_expire_client(clp);
nfsd4_shutdown_callback(clp);
if (clp->cl_cb_conn.cb_xprt)
svc_xprt_put(clp->cl_cb_conn.cb_xprt);
@@ -506,9 +506,11 @@ extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(const char *name,
#if defined(CONFIG_PNFSD)
extern int nfsd4_init_pnfs_slabs(void);
extern void nfsd4_free_pnfs_slabs(void);
+extern void pnfs_expire_client(struct nfs4_client *);
#else /* CONFIG_PNFSD */
static inline void nfsd4_free_pnfs_slabs(void) {}
static inline int nfsd4_init_pnfs_slabs(void) { return 0; }
+static inline void pnfs_expire_client(struct nfs4_client *clp) {}
#endif /* CONFIG_PNFSD */
static inline u64
Destroy the client layout state upon expiry. pnfs_return_client_layouts is used to locate the related layout state as if the client returned all of its layouts via RETURN_ALL with IOMODE_ANY. Signed-off-by: Benny Halevy <bhalevy@primarydata.com> --- fs/nfsd/nfs4pnfsd.c | 22 ++++++++++++++++++++++ fs/nfsd/nfs4state.c | 1 + fs/nfsd/state.h | 2 ++ 3 files changed, 25 insertions(+)