[pnfs] [PATCH] update ds statid from mds
Marc Eshel
eshel at almaden.ibm.com
Mon May 12 20:27:46 EDT 2008
From: Marc Eshel <eshel at almaden.ibm.com>
---
fs/nfsd/nfs4pnfsds.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/fs/nfsd/nfs4pnfsds.c b/fs/nfsd/nfs4pnfsds.c
index 2ed98f1..d1b06e5 100644
--- a/fs/nfsd/nfs4pnfsds.c
+++ b/fs/nfsd/nfs4pnfsds.c
@@ -272,6 +272,19 @@ alloc_init_ds_stateid(struct svc_fh *cfh, struct pnfs_get_state *gsp)
return dsp;
}
+static void
+update_ds_stateid(struct pnfs_ds_stateid *dsp, struct svc_fh *cfh, struct pnfs_get_state *gsp)
+{
+ dprintk("pNFSD: %s\n", __func__);
+
+ dsp->ds_access = gsp->access;
+ dsp->ds_status = 0;
+ dsp->ds_verifier[0] = gsp->verifier[0];
+ dsp->ds_verifier[1] = gsp->verifier[1];
+
+ return;
+}
+
struct pnfs_ds_stateid *
nfsv4_ds_get_state(struct svc_fh *cfh, stateid_t *stidp)
{
@@ -286,8 +299,10 @@ nfsv4_ds_get_state(struct svc_fh *cfh, stateid_t *stidp)
dprintk("pNFSD: %s\n", __func__);
dsp = find_pnfs_ds_stateid(stidp);
- if (dsp)
- return dsp;
+ if (dsp) {
+ if (stidp->si_generation == dsp->ds_stid.si_generation)
+ return dsp;
+ }
memcpy(&gs.stid, stidp, sizeof(stateid_t));
sb = ino->i_sb;
if (sb && sb->s_export_op->get_state) {
@@ -298,8 +313,12 @@ nfsv4_ds_get_state(struct svc_fh *cfh, stateid_t *stidp)
}
if (status)
return NULL;
- /* create new pnfs_ds_stateid */
- dsp = alloc_init_ds_stateid(cfh, &gs);
+ if (dsp)
+ update_ds_stateid(dsp, cfh, &gs);
+ else
+ /* create new pnfs_ds_stateid */
+ dsp = alloc_init_ds_stateid(cfh, &gs);
+
return dsp;
}
More information about the pNFS
mailing list