diff options
| author | Gaurav <gaurav@gluster.com> | 2011-04-27 03:20:11 +0000 | 
|---|---|---|
| committer | Anand Avati <avati@gluster.com> | 2011-05-03 12:13:04 -0700 | 
| commit | 27deebbf6c67f5076cae241e98043aa8b8b57ff8 (patch) | |
| tree | ae0aa3ea5746ffeb30353e815b5080fcfb46f71e | |
| parent | 7e8da0f5a8bfdd2d1db084fb508b417194754bff (diff) | |
NFS : Maintain common state for MOUNT1 and MOUNT3.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2695 (Mac host showmount -a not working.)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2695
| -rw-r--r-- | xlators/nfs/server/src/mount3.c | 38 | ||||
| -rw-r--r-- | xlators/nfs/server/src/mount3.h | 3 | ||||
| -rw-r--r-- | xlators/nfs/server/src/nfs.c | 7 | ||||
| -rw-r--r-- | 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 295b4e830d8..c358651ff68 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 ad4f21c98db..fede8122f49 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 081414607c2..c2dd16b6b56 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 7b93cd56eec..01ad705b61f 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;  | 
