| Submitter | Gaurav |
|---|---|
| Date | 2011-04-27 08:50:11 |
| Message ID | <1303894211-17310-1-git-send-email-gaurav@gluster.com> |
| Download | mbox | patch |
| Permalink | /patch/7056/ |
| State | Accepted |
| Headers | show |
Comments
Reviewed OK. Please send for release 3.1 also. Thanks gaurav@gluster.com wrote: > From: Gaurav <gaurav@gluster.com> > > > Signed-off-by: Gaurav <gaurav@gluster.com> > --- > xlators/nfs/server/src/mount3.c | 38 +++++++++++++++++++++++++++++++++----- > xlators/nfs/server/src/mount3.h | 3 +++ > xlators/nfs/server/src/nfs.c | 7 +++++++ > xlators/nfs/server/src/nfs.h | 1 + > 4 files changed, 44 insertions(+), 5 deletions(-) > > diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c > index 295b4e8..c358651 100644 > --- a/xlators/nfs/server/src/mount3.c > +++ b/xlators/nfs/server/src/mount3.c > @@ -1037,7 +1037,7 @@ mnt3svc_dump (rpcsvc_request_t *req) > sfunc = (mnt3_serializer)xdr_serialize_mountlist; > mlist = mnt3svc_build_mountlist (ms, &ret); > arg = mlist; > - > + > if (!mlist) { > if (ret != 0) { > nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); > @@ -1713,6 +1713,28 @@ mnt3_init_state (xlator_t *nfsx) > return ms; > } > > +int > +mount_init_state (xlator_t *nfsx) > +{ > + int ret = -1; > + struct nfs_state *nfs = NULL; > + > + if (!nfsx) > + goto out; > + > + nfs = (struct nfs_state *)nfs_state (nfsx); > + /*Maintaining global state for MOUNT1 and MOUNT3*/ > + nfs->mstate = mnt3_init_state (nfsx); > + if (!nfs->mstate) { > + gf_log (GF_NFS, GF_LOG_ERROR, "Failed to allocate" > + "mount state"); > + goto out; > + } > + ret = 0; > +out: > + return ret; > +} > + > rpcsvc_actor_t mnt3svc_actors[MOUNT3_PROC_COUNT] = { > {"NULL", MOUNT3_NULL, mnt3svc_null, NULL, NULL}, > {"MNT", MOUNT3_MNT, mnt3svc_mnt, NULL, NULL}, > @@ -1743,12 +1765,15 @@ rpcsvc_program_t * > mnt3svc_init (xlator_t *nfsx) > { > struct mount3_state *mstate = NULL; > + struct nfs_state *nfs = NULL; > > - if (!nfsx) > + if (!nfsx || !nfsx->private) > return NULL; > > + nfs = (struct nfs_state *)nfsx->private; > + > gf_log (GF_MNT, GF_LOG_DEBUG, "Initing Mount v3 state"); > - mstate = mnt3_init_state (nfsx); > + mstate = (struct mount3_state *)nfs->mstate; > if (!mstate) { > gf_log (GF_MNT, GF_LOG_ERROR, "Mount v3 state init failed"); > goto err; > @@ -1787,12 +1812,15 @@ rpcsvc_program_t * > mnt1svc_init (xlator_t *nfsx) > { > struct mount3_state *mstate = NULL; > + struct nfs_state *nfs = NULL; > > - if (!nfsx) > + if (!nfsx || !nfsx->private) > return NULL; > > + nfs = (struct nfs_state *)nfsx->private; > + > gf_log (GF_MNT, GF_LOG_DEBUG, "Initing Mount v1 state"); > - mstate = mnt3_init_state (nfsx); > + mstate = (struct mount3_state *)nfs->mstate; > if (!mstate) { > gf_log (GF_MNT, GF_LOG_ERROR, "Mount v3 state init failed"); > goto err; > diff --git a/xlators/nfs/server/src/mount3.h b/xlators/nfs/server/src/mount3.h > index ad4f21c..fede812 100644 > --- a/xlators/nfs/server/src/mount3.h > +++ b/xlators/nfs/server/src/mount3.h > @@ -50,6 +50,9 @@ mnt3svc_init (xlator_t *nfsx); > extern rpcsvc_program_t * > mnt1svc_init (xlator_t *nfsx); > > +extern int > +mount_init_state (xlator_t *nfsx); > + > /* Data structureused to store the list of mounts points currently > * in use by NFS clients. > */ > diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c > index 0814146..c2dd16b 100644 > --- a/xlators/nfs/server/src/nfs.c > +++ b/xlators/nfs/server/src/nfs.c > @@ -660,6 +660,13 @@ init (xlator_t *this) { > goto err; > } > > + ret = mount_init_state (this); > + if (ret == -1) { > + gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to init Mount" > + "state"); > + goto err; > + } > + > ret = nfs_init_versions (nfs, this); > if (ret == -1) { > gf_log (GF_NFS, GF_LOG_ERROR, "Failed to initialize " > diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h > index 7b93cd5..01ad705 100644 > --- a/xlators/nfs/server/src/nfs.h > +++ b/xlators/nfs/server/src/nfs.h > @@ -62,6 +62,7 @@ struct nfs_initer_list { > struct nfs_state { > rpcsvc_t *rpcsvc; > struct list_head versions; > + struct mount3_state *mstate; > struct mem_pool *foppool; > unsigned int memfactor; > xlator_list_t *subvols;
Patch
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c index 295b4e8..c358651 100644 --- a/xlators/nfs/server/src/mount3.c +++ b/xlators/nfs/server/src/mount3.c @@ -1037,7 +1037,7 @@ mnt3svc_dump (rpcsvc_request_t *req) sfunc = (mnt3_serializer)xdr_serialize_mountlist; mlist = mnt3svc_build_mountlist (ms, &ret); arg = mlist; - + if (!mlist) { if (ret != 0) { nfs_rpcsvc_request_seterr (req, SYSTEM_ERR); @@ -1713,6 +1713,28 @@ mnt3_init_state (xlator_t *nfsx) return ms; } +int +mount_init_state (xlator_t *nfsx) +{ + int ret = -1; + struct nfs_state *nfs = NULL; + + if (!nfsx) + goto out; + + nfs = (struct nfs_state *)nfs_state (nfsx); + /*Maintaining global state for MOUNT1 and MOUNT3*/ + nfs->mstate = mnt3_init_state (nfsx); + if (!nfs->mstate) { + gf_log (GF_NFS, GF_LOG_ERROR, "Failed to allocate" + "mount state"); + goto out; + } + ret = 0; +out: + return ret; +} + rpcsvc_actor_t mnt3svc_actors[MOUNT3_PROC_COUNT] = { {"NULL", MOUNT3_NULL, mnt3svc_null, NULL, NULL}, {"MNT", MOUNT3_MNT, mnt3svc_mnt, NULL, NULL}, @@ -1743,12 +1765,15 @@ rpcsvc_program_t * mnt3svc_init (xlator_t *nfsx) { struct mount3_state *mstate = NULL; + struct nfs_state *nfs = NULL; - if (!nfsx) + if (!nfsx || !nfsx->private) return NULL; + nfs = (struct nfs_state *)nfsx->private; + gf_log (GF_MNT, GF_LOG_DEBUG, "Initing Mount v3 state"); - mstate = mnt3_init_state (nfsx); + mstate = (struct mount3_state *)nfs->mstate; if (!mstate) { gf_log (GF_MNT, GF_LOG_ERROR, "Mount v3 state init failed"); goto err; @@ -1787,12 +1812,15 @@ rpcsvc_program_t * mnt1svc_init (xlator_t *nfsx) { struct mount3_state *mstate = NULL; + struct nfs_state *nfs = NULL; - if (!nfsx) + if (!nfsx || !nfsx->private) return NULL; + nfs = (struct nfs_state *)nfsx->private; + gf_log (GF_MNT, GF_LOG_DEBUG, "Initing Mount v1 state"); - mstate = mnt3_init_state (nfsx); + mstate = (struct mount3_state *)nfs->mstate; if (!mstate) { gf_log (GF_MNT, GF_LOG_ERROR, "Mount v3 state init failed"); goto err; diff --git a/xlators/nfs/server/src/mount3.h b/xlators/nfs/server/src/mount3.h index ad4f21c..fede812 100644 --- a/xlators/nfs/server/src/mount3.h +++ b/xlators/nfs/server/src/mount3.h @@ -50,6 +50,9 @@ mnt3svc_init (xlator_t *nfsx); extern rpcsvc_program_t * mnt1svc_init (xlator_t *nfsx); +extern int +mount_init_state (xlator_t *nfsx); + /* Data structureused to store the list of mounts points currently * in use by NFS clients. */ diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 0814146..c2dd16b 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -660,6 +660,13 @@ init (xlator_t *this) { goto err; } + ret = mount_init_state (this); + if (ret == -1) { + gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to init Mount" + "state"); + goto err; + } + ret = nfs_init_versions (nfs, this); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to initialize " diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index 7b93cd5..01ad705 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -62,6 +62,7 @@ struct nfs_initer_list { struct nfs_state { rpcsvc_t *rpcsvc; struct list_head versions; + struct mount3_state *mstate; struct mem_pool *foppool; unsigned int memfactor; xlator_list_t *subvols;