[pnfs] [PATCH] when nfsd is stopped tell fs when layout is destroyed.
Marc Eshel
eshel at almaden.ibm.com
Wed Jul 25 15:55:27 EDT 2007
From: Marc Eshel <eshel at almaden.ibm.com>
---
fs/nfsd/nfs4state.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index b73c928..a5b03bf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -91,7 +91,7 @@ #if defined(CONFIG_PNFS)
*/
static kmem_cache_t *pnfs_layout_slab = NULL;
static kmem_cache_t *pnfs_layoutrecall_slab = NULL;
-static void destroy_layout(struct nfs4_layout *lp);
+static void destroy_layout(struct nfs4_layout *lp, struct nfsd4_pnfs_layoutreturn *lrp);
static inline void layoutrecall_done(struct nfs4_layoutrecall *clr);
static void release_pnfs_ds_dev_list(struct nfs4_stateid *stp);
#endif /* CONFIG_PNFS */
@@ -627,7 +627,7 @@ #if defined(CONFIG_PNFS)
dprintk("NFSD: expire client. lp %p, fp %p\n", lp,
lp->lo_file);
BUG_ON(lp->lo_client != clp);
- destroy_layout(lp);
+ destroy_layout(lp, NULL);
}
while (!list_empty(&clp->cl_layoutrecalls)) {
lrp = list_entry(clp->cl_layoutrecalls.next,
@@ -4051,8 +4051,9 @@ alloc_init_layout(struct nfs4_layout *lp
}
static void
-destroy_layout(struct nfs4_layout *lp)
+destroy_layout(struct nfs4_layout *lp, struct nfsd4_pnfs_layoutreturn *lrp)
{
+ struct nfsd4_pnfs_layoutreturn lr;
struct nfs4_client *clp;
struct nfs4_file *fp;
@@ -4063,6 +4064,20 @@ destroy_layout(struct nfs4_layout *lp)
dprintk("pNFS %s: lp %p clp %p fp %p ino %p\n", __FUNCTION__,
lp, clp, fp, fp->fi_inode);
+ /* call exported filesystem layout_return */
+ if (!lrp) {
+ if (fp->fi_inode->i_sb->s_export_op->layout_return) {
+ lr.lr_return_type = RETURN_FILE;
+ lr.lr_reclaim = 0;
+ lr.lr_flags = 0;
+ lr.lr_seg.clientid = 0;
+ lr.lr_seg.layout_type = LAYOUT_NFSV4_FILES;
+ lr.lr_seg.iomode = IOMODE_ANY;
+ lr.lr_seg.offset = 0;
+ lr.lr_seg.length = -1;
+ fp->fi_inode->i_sb->s_export_op->layout_return(fp->fi_inode, &lr);
+ }
+ }
kmem_cache_free(pnfs_layout_slab, lp);
put_nfs4_file(fp);
}
@@ -4502,7 +4517,7 @@ int nfs4_pnfs_return_layout(struct super
layouts_found++;
trim_layout(&lp->lo_seg, &lrp->lr_seg);
if (!lp->lo_seg.length)
- destroy_layout(lp);
+ destroy_layout(lp, lrp);
}
} else list_for_each_entry_safe (lp, nextlp, &clp->cl_layouts, lo_perclnt) {
if (lrp->lr_seg.layout_type != lp->lo_seg.layout_type ||
@@ -4515,7 +4530,7 @@ int nfs4_pnfs_return_layout(struct super
continue;
layouts_found++;
- destroy_layout(lp);
+ destroy_layout(lp, lrp);
}
/* update layoutrecalls */
@@ -4810,6 +4825,9 @@ int nfsd_layout_recall_cb(struct inode *
cbl->cbl_seg.iomode != IOMODE_RW &&
cbl->cbl_seg.iomode != IOMODE_ANY);
+ if (nfsd_serv == NULL)
+ return -ENOENT;
+
clr = alloc_init_layoutrecall(NULL);
if (!clr)
return -ENOMEM;
More information about the pNFS
mailing list