summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-inodes.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-inodes.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-inodes.c')
-rw-r--r--xlators/nfs/server/src/nfs-inodes.c115
1 files changed, 59 insertions, 56 deletions
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c
index 69bad072484..4b8bad71789 100644
--- a/xlators/nfs/server/src/nfs-inodes.c
+++ b/xlators/nfs/server/src/nfs-inodes.c
@@ -78,7 +78,7 @@ do_not_link:
*/
fd_unref (fd);
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, fd, inode, buf,
preparent, postparent);
@@ -87,17 +87,18 @@ do_not_link:
int
-nfs_inode_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
- int mode, fop_create_cbk_t cbk, void *local)
+nfs_inode_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu,
+ loc_t *pathloc, int flags, int mode, fop_create_cbk_t cbk,
+ void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
fd_t *newfd = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
newfd = fd_create (pathloc->inode, 0);
if (!newfd) {
@@ -111,7 +112,7 @@ nfs_inode_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
*/
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_create (xl, nfu, pathloc, flags, mode, newfd,
+ ret = nfs_fop_create (nfsx, xl, nfu, pathloc, flags, mode, newfd,
nfs_inode_create_cbk, nfl);
wipe_nfl:
if (ret < 0)
@@ -137,7 +138,7 @@ nfs_inode_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
@@ -145,23 +146,24 @@ do_not_link:
return 0;
}
+
int
-nfs_inode_mkdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int mode,
- fop_mkdir_cbk_t cbk, void *local)
+nfs_inode_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int mode, fop_mkdir_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_mkdir (xl, nfu, pathloc, mode, nfs_inode_mkdir_cbk,
+ ret = nfs_fop_mkdir (nfsx, xl, nfu, pathloc, mode, nfs_inode_mkdir_cbk,
nfl);
if (ret < 0)
- nfs_fop_local_wipe (xl, nfl);
+ nfs_fop_local_wipe (nfsx, nfl);
err:
return ret;
@@ -184,7 +186,7 @@ nfs_inode_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* else
fd_bind (fd);
*/
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, fd);
return 0;
@@ -192,14 +194,14 @@ nfs_inode_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_inode_open (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, int32_t flags,
- int32_t wbflags, fop_open_cbk_t cbk, void *local)
+nfs_inode_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ int32_t flags, int32_t wbflags, fop_open_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
fd_t *newfd = NULL;
int ret = -EFAULT;
- if ((!xl) || (!loc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!loc) || (!nfu))
return ret;
newfd = fd_create (loc->inode, 0);
@@ -209,8 +211,8 @@ nfs_inode_open (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, int32_t flags,
goto err;
}
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, fd_err);
- ret = nfs_fop_open (xl, nfu, loc, flags, newfd, wbflags,
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, fd_err);
+ ret = nfs_fop_open (nfsx, xl, nfu, loc, flags, newfd, wbflags,
nfs_inode_open_cbk, nfl);
if (ret < 0)
@@ -245,7 +247,7 @@ nfs_inode_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
nfl->newpath, nfl->inode, buf);
do_not_link:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, buf,
preoldparent, postoldparent, prenewparent,
@@ -255,19 +257,19 @@ do_not_link:
int
-nfs_inode_rename (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+nfs_inode_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
loc_t *newloc, fop_rename_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!oldloc) || (!newloc))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, oldloc->inode, oldloc->parent, newloc->parent,
oldloc->name, newloc->name);
- ret = nfs_fop_rename (xl, nfu, oldloc, newloc, nfs_inode_rename_cbk
+ ret = nfs_fop_rename (nfsx,xl, nfu, oldloc, newloc, nfs_inode_rename_cbk
, nfl);
err:
@@ -294,7 +296,7 @@ nfs_inode_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_link (inode, nfl->newparent, nfl->path, buf);
do_not_link:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
@@ -303,18 +305,18 @@ do_not_link:
int
-nfs_inode_link (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+nfs_inode_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
loc_t *newloc, fop_link_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!oldloc) || (!newloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu))
return -EFAULT;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, NULL, NULL, newloc->parent, newloc->name, NULL);
- ret = nfs_fop_link (xl, nfu, oldloc, newloc, nfs_inode_link_cbk,
+ ret = nfs_fop_link (nfsx, xl, nfu, oldloc, newloc, nfs_inode_link_cbk,
nfl);
err:
@@ -341,7 +343,7 @@ nfs_inode_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_unlink (nfl->inode, nfl->parent, nfl->path);
do_not_unlink:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, preparent,
postparent);
@@ -350,19 +352,19 @@ do_not_unlink:
int
-nfs_inode_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_inode_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_unlink_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return -EFAULT;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_unlink (xl, nfu, pathloc, nfs_inode_unlink_cbk, nfl);
+ ret = nfs_fop_unlink (nfsx, xl, nfu, pathloc, nfs_inode_unlink_cbk,nfl);
err:
if (ret < 0)
@@ -388,7 +390,7 @@ nfs_inode_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_unlink (nfl->inode, nfl->parent, nfl->path);
do_not_unlink:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, preparent,
postparent);
@@ -398,20 +400,20 @@ do_not_unlink:
int
-nfs_inode_rmdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_inode_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_rmdir_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_rmdir (xl, nfu, pathloc, nfs_inode_rmdir_cbk, nfl);
+ ret = nfs_fop_rmdir (nfsx, xl, nfu, pathloc, nfs_inode_rmdir_cbk, nfl);
err:
if (ret < 0)
@@ -437,7 +439,7 @@ nfs_inode_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
@@ -446,21 +448,21 @@ do_not_link:
int
-nfs_inode_mknod (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_inode_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
mode_t mode, dev_t dev, fop_mknod_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_mknod (xl, nfu, pathloc, mode, dev, nfs_inode_mknod_cbk,
- nfl);
+ ret = nfs_fop_mknod (nfsx, xl, nfu, pathloc, mode, dev,
+ nfs_inode_mknod_cbk, nfl);
err:
if (ret < 0)
@@ -486,7 +488,7 @@ nfs_inode_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
@@ -496,20 +498,20 @@ do_not_link:
int
-nfs_inode_symlink (xlator_t *xl, nfs_user_t *nfu, char *target,
+nfs_inode_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
loc_t *pathloc, fop_symlink_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
int ret = -EFAULT;
- if ((!xl) || (!target) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!target) || (!pathloc) || (!nfu))
return ret;
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
nfl_inodes_init (nfl, pathloc->inode, pathloc->parent, NULL,
pathloc->name, NULL);
- ret = nfs_fop_symlink (xl, nfu, target, pathloc, nfs_inode_symlink_cbk,
- nfl);
+ ret = nfs_fop_symlink (nfsx, xl, nfu, target, pathloc,
+ nfs_inode_symlink_cbk, nfl);
err:
if (ret < 0)
@@ -531,7 +533,7 @@ nfs_inode_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
else
fd_bind (fd);
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, fd);
@@ -540,14 +542,14 @@ nfs_inode_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_inode_opendir (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+nfs_inode_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
fop_opendir_cbk_t cbk, void *local)
{
struct nfs_fop_local *nfl = NULL;
fd_t *newfd = NULL;
int ret = -EFAULT;
- if ((!xl) || (!loc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!loc) || (!nfu))
return ret;
newfd = fd_create (loc->inode, 0);
@@ -557,8 +559,9 @@ nfs_inode_opendir (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
goto err;
}
- nfs_fop_handle_local_init (NULL, xl, nfl, cbk, local, ret, err);
- ret = nfs_fop_opendir (xl, nfu, loc, newfd, nfs_inode_opendir_cbk, nfl);
+ nfs_fop_handle_local_init (NULL, nfsx, nfl, cbk, local, ret, err);
+ ret = nfs_fop_opendir (nfsx, xl, nfu, loc, newfd,
+ nfs_inode_opendir_cbk, nfl);
err:
if (ret < 0) {