summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-04-02 04:32:30 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-04-02 04:14:32 -0700
commitd9b34f3f2c5de8cdde6dd8c24fade839b7727ab2 (patch)
tree70281f962fd742b099a10b8ad5ce7bbcc3f1ce5f /xlators/nfs/server/src/nfs.c
parent8d2342b19c715f2d6ecb024eace8102e2c5e3a29 (diff)
nfs: Redesign fop argument passing to support single volfile use
The current design of the interaction between the generic NFS layer and the protocol handlers like mount3 and nfs3 is such that it does not allow using a single volume file which contains the nfs/server and the protocol/server. This is because the common nfs-fops layer assumes that ctx->top is always the nfs/server. This is wrong. The fops layer needs access to top because top or rather the generic NFS xlator's private state has a mem-pool. The fops layer needs this mem-pool to get memory for storing per-fop state. Since the fops layer cannot anymore take ctx->top be the nfs/server, all layers need to start passing the nfs/server xlator_t right down to the fops layer. I am also taking this chance to remove the synchronous equivalents of the fops and also remove the dirent caching directory operations. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 770 (NFS Xlator - Crash when both GlusterFS server/NFS Server are in the same file) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=770
Diffstat (limited to 'xlators/nfs/server/src/nfs.c')
-rw-r--r--xlators/nfs/server/src/nfs.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index 488ece419..14d82fc28 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -225,41 +225,36 @@ nfs_start_subvol_lookup_cbk (call_frame_t *frame, void *cookie,
inode_t *inode, struct iatt *buf, dict_t *xattr,
struct iatt *postparent)
{
- struct nfs_state *nfs = NULL;
- xlator_t *startedxl = NULL;
-
if (op_ret == -1) {
gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to lookup root: %s",
strerror (op_errno));
goto err;
}
- nfs = frame->local;
- startedxl = cookie;
- gf_log (GF_NFS, GF_LOG_TRACE, "Started %s", startedxl->name);
+ gf_log (GF_NFS, GF_LOG_TRACE, "Started %s", this->name);
err:
return 0;
}
int
-nfs_startup_subvolume (struct nfs_state *nfs, xlator_t *xl)
+nfs_startup_subvolume (xlator_t *nfsx, xlator_t *xl)
{
int ret = -1;
loc_t rootloc = {0, };
nfs_user_t nfu = {0, };
- if ((!nfs) || (!xl))
+ if ((!nfsx) || (!xl))
return -1;
- if (nfs_subvolume_started (nfs, xl)) {
+ if (nfs_subvolume_started (nfsx->private, xl)) {
gf_log (GF_NFS,GF_LOG_TRACE, "Subvolume already started: %s",
xl->name);
ret = 0;
goto err;
}
- nfs_subvolume_set_started (nfs, xl);
+ nfs_subvolume_set_started (nfsx->private, xl);
ret = nfs_inode_loc_fill (xl->itable->root, &rootloc);
if (ret == -1) {
gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to init root loc");
@@ -267,8 +262,9 @@ nfs_startup_subvolume (struct nfs_state *nfs, xlator_t *xl)
}
nfs_user_root_create (&nfu);
- ret = nfs_fop_lookup (xl, &nfu, &rootloc, nfs_start_subvol_lookup_cbk,
- (void *)nfs);
+ ret = nfs_fop_lookup (nfsx, xl, &nfu, &rootloc,
+ nfs_start_subvol_lookup_cbk,
+ (void *)nfsx->private);
if (ret < 0) {
gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to lookup root: %s",
strerror (-ret));
@@ -282,18 +278,21 @@ err:
}
int
-nfs_startup_subvolumes (struct nfs_state *nfs)
+nfs_startup_subvolumes (xlator_t *nfsx)
{
- int ret = -1;
- xlator_list_t *cl = NULL;
- if (!nfs)
+ int ret = -1;
+ xlator_list_t *cl = NULL;
+ struct nfs_state *nfs = NULL;
+
+ if (!nfsx)
return -1;
+ nfs = nfsx->private;
cl = nfs->subvols;
while (cl) {
gf_log (GF_NFS, GF_LOG_DEBUG, "Starting subvolume: %s",
cl->xlator->name);
- ret = nfs_startup_subvolume (nfs, cl->xlator);
+ ret = nfs_startup_subvolume (nfsx, cl->xlator);
if (ret == -1) {
gf_log (GF_NFS, GF_LOG_CRITICAL, "Failed to start-up "
"xlator: %s", cl->xlator->name);
@@ -519,7 +518,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
{
case GF_EVENT_CHILD_UP:
{
- nfs_startup_subvolume (nfs, subvol);
+ nfs_startup_subvolume (this, subvol);
if ((nfs->upsubvols == nfs->allsubvols) &&
(!nfs->subvols_started)) {
nfs->subvols_started = 1;
@@ -540,6 +539,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
break;
}
}
+
return 0;
}