summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src
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
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')
-rw-r--r--xlators/nfs/server/src/mount3.c15
-rw-r--r--xlators/nfs/server/src/nfs-fops.c432
-rw-r--r--xlators/nfs/server/src/nfs-fops.h115
-rw-r--r--xlators/nfs/server/src/nfs-generics.c904
-rw-r--r--xlators/nfs/server/src/nfs-generics.h88
-rw-r--r--xlators/nfs/server/src/nfs-inodes.c115
-rw-r--r--xlators/nfs/server/src/nfs-inodes.h28
-rw-r--r--xlators/nfs/server/src/nfs.c36
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c40
-rw-r--r--xlators/nfs/server/src/nfs3.c120
10 files changed, 475 insertions, 1418 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index dc8805085..db4a88e3d 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -219,7 +219,6 @@ mnt3svc_lookup_mount_cbk (call_frame_t *frame, void *cookie,
rpcsvc_request_t *req = NULL;
struct nfs3_fh fh = {{0}, };
struct mount3_state *ms = NULL;
- xlator_t *exportxl = NULL;
mountstat3 status = 0;
int autharr[10];
int autharrlen = 0;
@@ -243,15 +242,13 @@ mnt3svc_lookup_mount_cbk (call_frame_t *frame, void *cookie,
if (status != MNT3_OK)
goto xmit_res;
- exportxl = (xlator_t *)cookie;
- fh = nfs3_fh_build_root_fh (ms->nfsx->children, exportxl, *buf);
- mnt3svc_update_mountlist (ms, req, exportxl);
+ fh = nfs3_fh_build_root_fh (ms->nfsx->children, this, *buf);
+ mnt3svc_update_mountlist (ms, req, this);
xmit_res:
gf_log (GF_MNT, GF_LOG_DEBUG, "Mount reply status: %d", status);
if (op_ret == 0) {
svc = rpcsvc_request_service (req);
- autharrlen = rpcsvc_auth_array (svc, exportxl->name, autharr,
- 10);
+ autharrlen = rpcsvc_auth_array (svc, this->name, autharr, 10);
}
res = mnt3svc_set_mountres3 (status, &fh, autharr, autharrlen);
@@ -263,7 +260,7 @@ xmit_res:
int
-mnt3svc_mount (rpcsvc_request_t *req, xlator_t * xl)
+mnt3svc_mount (rpcsvc_request_t *req, xlator_t *nfsx, xlator_t * xl)
{
loc_t oploc = {0, };
int ret = -1;
@@ -279,7 +276,7 @@ mnt3svc_mount (rpcsvc_request_t *req, xlator_t * xl)
* used to build the root fh sent to the client.
*/
nfs_request_user_init (&nfu, req);
- ret = nfs_lookup (xl, &nfu, &oploc, mnt3svc_lookup_mount_cbk,
+ ret = nfs_lookup (nfsx, xl, &nfu, &oploc, mnt3svc_lookup_mount_cbk,
(void *)req);
nfs_loc_wipe (&oploc);
@@ -346,7 +343,7 @@ mnt3svc_mnt (rpcsvc_request_t *req)
goto rpcerr;
}
- mnt3svc_mount (req, targetxl);
+ mnt3svc_mount (req, ms->nfsx, targetxl);
mnterr:
if (ret == -1) {
mnt3svc_mnt_error_reply (req, mntstat);
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c
index 3d4968a8b..e7505b5dc 100644
--- a/xlators/nfs/server/src/nfs-fops.c
+++ b/xlators/nfs/server/src/nfs-fops.c
@@ -43,29 +43,28 @@
struct nfs_fop_local *
-nfs_fop_local_init (xlator_t *xl)
+nfs_fop_local_init (xlator_t *nfsx)
{
struct nfs_fop_local *l = NULL;
- struct nfs_state *nfs = NULL;
- if (!xl)
+
+ if (!nfsx)
return NULL;
- nfs = xlator_top_private (xl);
- l = mem_get (nfs->foppool);
+ l = mem_get (nfs_fop_mempool (nfsx));
memset (l, 0, sizeof (*l));
return l;
}
void
-nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l)
+nfs_fop_local_wipe (xlator_t *nfsx, struct nfs_fop_local *l)
{
struct nfs_state *nfs = NULL;
- if ((!xl) || (!l))
+ if ((!nfsx) || (!l))
return;
- nfs = xlator_top_private (xl);
+ nfs = nfsx->private;
if (l->iobref)
iobref_unref (l->iobref);
@@ -211,17 +210,6 @@ err:
* callback is responsible for doing the relevant GlusterFS state
* maintenance operations on the data returned in the callbacks.
*
- * nfs_fop_<fopname>_sync
- * These are synchronous versions of the above fops. The idea is that
- * if the user wants to wait for the fop to complete, this is the interface to
- * use. The caller is responsible for doing the relevant GlusterFS
- * state maintenance operations on the call_stub_t that is returned, including
- * calling call_stub_destroy.
- *
- * nfs_<fopname>_sync
- * This is help callers avoid the need to pass a pathloc to the
- * nfs_fop_<fopname>_sync versions of the same fops.
- *
* nfs_<fopname>
* Unlike the nfs_fop_<fopname> variety, this is the stateful type of fop, in
* that it silently performs all the relevant GlusterFS state maintainence
@@ -243,7 +231,7 @@ nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *local = NULL;
fop_lookup_cbk_t progcbk;
- nfl_to_prog_data (this, local, progcbk, frame);
+ nfl_to_prog_data (local, progcbk, frame);
nfs_fop_restore_root_ino (local, buf, NULL, NULL, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
@@ -255,7 +243,7 @@ nfs_fop_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_lookup (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
fop_lookup_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
@@ -267,11 +255,11 @@ nfs_fop_lookup (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
gf_log (GF_NFS, GF_LOG_TRACE, "Lookup: %s", loc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, loc);
- STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, xl, xl, xl->fops->lookup,
- loc, NULL);
+ STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, nfsx, xl,
+ xl->fops->lookup, loc, NULL);
ret = 0;
err:
@@ -291,7 +279,7 @@ nfs_fop_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_stat_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, buf);
@@ -302,7 +290,7 @@ nfs_fop_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_stat (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+nfs_fop_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
fop_stat_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
@@ -314,10 +302,10 @@ nfs_fop_stat (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
gf_log (GF_NFS, GF_LOG_TRACE, "Stat: %s", loc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, loc);
- STACK_WIND_COOKIE (frame, nfs_fop_stat_cbk, xl, xl, xl->fops->stat,
+ STACK_WIND_COOKIE (frame, nfs_fop_stat_cbk, nfsx, xl, xl->fops->stat,
loc);
ret = 0;
err:
@@ -337,7 +325,7 @@ nfs_fop_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_fstat_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, buf);
@@ -348,22 +336,22 @@ nfs_fop_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_fstat (xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+nfs_fop_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
fop_fstat_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!fd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!fd) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "FStat");
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_fd_ino (nfl, fd);
- STACK_WIND_COOKIE (frame, nfs_fop_fstat_cbk, xl, xl, xl->fops->fstat,
+ STACK_WIND_COOKIE (frame, nfs_fop_fstat_cbk, nfsx, xl, xl->fops->fstat,
fd);
ret = 0;
@@ -384,7 +372,7 @@ nfs_fop_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_opendir_cbk_t progcbk = NULL;
- 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);
nfs_stack_destroy (frame);
@@ -393,21 +381,21 @@ nfs_fop_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_opendir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,fd_t *dirfd,
- fop_opendir_cbk_t cbk, void *local)
+nfs_fop_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ fd_t *dirfd, fop_opendir_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!dirfd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!dirfd) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Opendir: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
- STACK_WIND_COOKIE (frame, nfs_fop_opendir_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_opendir_cbk, nfsx, xl,
xl->fops->opendir, pathloc, dirfd);
ret = 0;
@@ -427,7 +415,7 @@ nfs_fop_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_flush_cbk_t progcbk = NULL;
- 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);
@@ -437,20 +425,20 @@ nfs_fop_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_flush (xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+nfs_fop_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
fop_flush_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!fd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!fd) || (!nfu))
return ret;
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
- STACK_WIND_COOKIE (frame, nfs_fop_flush_cbk, xl, xl, xl->fops->flush,
+ STACK_WIND_COOKIE (frame, nfs_fop_flush_cbk, nfsx, xl, xl->fops->flush,
fd);
ret = 0;
err:
@@ -470,7 +458,7 @@ nfs_fop_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_readdirp_cbk_t progcbk = NULL;
- 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, entries);
@@ -481,7 +469,7 @@ nfs_fop_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_readdirp (xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
+nfs_fop_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
size_t bufsize, off_t offset, fop_readdirp_cbk_t cbk,
void *local)
{
@@ -489,14 +477,14 @@ nfs_fop_readdirp (xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!dirfd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!dirfd) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "readdir");
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
- STACK_WIND_COOKIE (frame, nfs_fop_readdirp_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_readdirp_cbk, nfsx, xl,
xl->fops->readdirp, dirfd, bufsize, offset);
ret = 0;
@@ -518,7 +506,7 @@ nfs_fop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_statfs_cbk_t progcbk = NULL;
- 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);
@@ -528,22 +516,22 @@ nfs_fop_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_statfs (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_statfs_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Statfs: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
- STACK_WIND_COOKIE (frame, nfs_fop_statfs_cbk, xl, xl, xl->fops->statfs
- ,pathloc);
+ STACK_WIND_COOKIE (frame, nfs_fop_statfs_cbk, nfsx, xl,
+ xl->fops->statfs, pathloc);
ret = 0;
err:
if (ret < 0) {
@@ -564,7 +552,7 @@ nfs_fop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_create_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, fd, inode, buf,
@@ -576,22 +564,23 @@ nfs_fop_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
- mode_t mode, fd_t *fd, fop_create_cbk_t cbk, void *local)
+nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk,
+ void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Create: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_create_cbk, xl, xl, xl->fops->create
+ STACK_WIND_COOKIE (frame, nfs_fop_create_cbk, nfsx, xl,xl->fops->create
, pathloc, flags, mode, fd);
ret = 0;
err:
@@ -612,7 +601,7 @@ nfs_fop_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_setattr_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, pre, post, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, pre, post);
@@ -623,7 +612,7 @@ nfs_fop_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_setattr (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk,
void *local)
{
@@ -631,15 +620,15 @@ nfs_fop_setattr (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Setattr: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_setattr_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_setattr_cbk, nfsx, xl,
xl->fops->setattr, pathloc, buf, valid);
ret = 0;
err:
@@ -661,7 +650,7 @@ nfs_fop_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_mkdir_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
@@ -672,22 +661,22 @@ nfs_fop_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_mkdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- fop_mkdir_cbk_t cbk, void *local)
+nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ mode_t mode, fop_mkdir_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Mkdir: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_mkdir_cbk, xl, xl, xl->fops->mkdir,
+ STACK_WIND_COOKIE (frame, nfs_fop_mkdir_cbk, nfsx, xl, xl->fops->mkdir,
pathloc, mode);
ret = 0;
err:
@@ -709,7 +698,7 @@ nfs_fop_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_symlink_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
@@ -719,22 +708,22 @@ nfs_fop_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
int
-nfs_fop_symlink (xlator_t *xl, nfs_user_t *nfu, char *target,
+nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
loc_t *pathloc, fop_symlink_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!target) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!target) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Symlink: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, nfsx, xl,
xl->fops->symlink, target, pathloc);
ret = 0;
err:
@@ -755,7 +744,7 @@ nfs_fop_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_readlink_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, path, buf);
@@ -765,22 +754,22 @@ nfs_fop_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_readlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
size_t size, fop_readlink_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Readlink: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_readlink_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_readlink_cbk, nfsx, xl,
xl->fops->readlink, pathloc, size);
ret = 0;
err:
@@ -802,7 +791,7 @@ nfs_fop_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_mknod_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
@@ -813,22 +802,22 @@ nfs_fop_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_mknod (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- dev_t dev, fop_mknod_cbk_t cbk, void *local)
+nfs_fop_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)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Mknod: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_mknod_cbk, xl, xl, xl->fops->mknod,
+ STACK_WIND_COOKIE (frame, nfs_fop_mknod_cbk, nfsx, xl, xl->fops->mknod,
pathloc, mode, dev);
ret = 0;
err:
@@ -838,7 +827,6 @@ err:
}
return ret;
-
}
int32_t
@@ -849,7 +837,7 @@ nfs_fop_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = frame->local;
fop_rmdir_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, NULL, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, preparent,
@@ -861,22 +849,22 @@ nfs_fop_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_rmdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_rmdir_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Rmdir: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_rmdir_cbk, xl, xl, xl->fops->rmdir,
+ STACK_WIND_COOKIE (frame, nfs_fop_rmdir_cbk, nfsx, xl, xl->fops->rmdir,
pathloc);
ret = 0;
err:
@@ -898,7 +886,7 @@ nfs_fop_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = frame->local;
fop_unlink_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, NULL, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, preparent,
@@ -909,23 +897,23 @@ nfs_fop_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_unlink_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Unlink: %s", pathloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
- STACK_WIND_COOKIE (frame, nfs_fop_unlink_cbk, xl, xl, xl->fops->unlink,
- pathloc);
+ STACK_WIND_COOKIE (frame, nfs_fop_unlink_cbk, nfsx, xl,
+ xl->fops->unlink, pathloc);
ret = 0;
err:
if (ret < 0) {
@@ -947,7 +935,7 @@ nfs_fop_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_link_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, buf, NULL, preparent, postparent);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
@@ -959,23 +947,23 @@ nfs_fop_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_link (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_link_cbk_t cbk, void *local)
+nfs_fop_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_link_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!oldloc) || (!newloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Link: %s -> %s", newloc->path,
oldloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, newloc);
- STACK_WIND_COOKIE (frame, nfs_fop_link_cbk, xl, xl, xl->fops->link,
+ STACK_WIND_COOKIE (frame, nfs_fop_link_cbk, nfsx, xl, xl->fops->link,
oldloc, newloc);
ret = 0;
err:
@@ -998,7 +986,7 @@ nfs_fop_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_rename_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
/* The preattr arg needs to be NULL instead of @buf because it is
* possible that the new parent is not root whereas the source dir
* could've been. That is handled in the next macro.
@@ -1016,25 +1004,25 @@ nfs_fop_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_rename (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+nfs_fop_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
loc_t *newloc, fop_rename_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!oldloc) || (!newloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Rename: %s -> %s", oldloc->path,
newloc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, oldloc);
nfs_fop_newloc_save_root_ino (nfl, newloc);
- STACK_WIND_COOKIE (frame, nfs_fop_rename_cbk, xl, xl, xl->fops->rename,
- oldloc, newloc);
+ STACK_WIND_COOKIE (frame, nfs_fop_rename_cbk, nfsx, xl,
+ xl->fops->rename, oldloc, newloc);
ret = 0;
err:
if (ret < 0) {
@@ -1053,7 +1041,7 @@ nfs_fop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_open_cbk_t progcbk = NULL;
- 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);
nfs_stack_destroy (frame);
@@ -1062,21 +1050,22 @@ nfs_fop_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
int
-nfs_fop_open (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, int32_t flags,
- fd_t *fd, int32_t wbflags, fop_open_cbk_t cbk, void *local)
+nfs_fop_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ int32_t flags, fd_t *fd, int32_t wbflags, fop_open_cbk_t cbk,
+ void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!loc) || (!fd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!loc) || (!fd) || (!nfu))
return ret;
gf_log (GF_NFS, GF_LOG_TRACE, "Open: %s", loc->path);
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
- STACK_WIND_COOKIE (frame, nfs_fop_open_cbk, xl, xl, xl->fops->open,
+ STACK_WIND_COOKIE (frame, nfs_fop_open_cbk, nfsx, xl, xl->fops->open,
loc, flags, fd, wbflags);
ret = 0;
err:
@@ -1086,7 +1075,6 @@ err:
}
return ret;
-
}
@@ -1098,7 +1086,7 @@ nfs_fop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_writev_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, prebuf, postbuf, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, prebuf,postbuf);
@@ -1110,19 +1098,19 @@ nfs_fop_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_write (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
- struct iovec *vector, int32_t count, off_t offset,
- fop_writev_cbk_t cbk, void *local)
+nfs_fop_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ struct iobuf *srciob, struct iovec *vector, int32_t count,
+ off_t offset, fop_writev_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!fd) || (!vector) || (!nfu) || (!srciob))
+ if ((!nfsx) || (!xl) || (!fd) || (!vector) || (!nfu) || (!srciob))
return ret;
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_fd_ino (nfl, fd);
nfl->iobref = iobref_new ();
@@ -1133,14 +1121,14 @@ nfs_fop_write (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
}
iobref_add (nfl->iobref, srciob);
- STACK_WIND_COOKIE (frame, nfs_fop_writev_cbk, xl, xl, xl->fops->writev
+ STACK_WIND_COOKIE (frame, nfs_fop_writev_cbk, nfsx, xl,xl->fops->writev
, fd, vector, count, offset, nfl->iobref);
ret = 0;
err:
if (ret < 0) {
if (frame)
nfs_stack_destroy (frame);
- nfs_fop_local_wipe (xl, nfl);
+ nfs_fop_local_wipe (nfsx, nfl);
}
return ret;
@@ -1155,7 +1143,7 @@ nfs_fop_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_fsync_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, prebuf, postbuf, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, prebuf,postbuf);
@@ -1166,21 +1154,21 @@ nfs_fop_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_fsync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync,
- fop_fsync_cbk_t cbk, void *local)
+nfs_fop_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ int32_t datasync, fop_fsync_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!fd))
+ if ((!nfsx) || (!xl) || (!fd))
return ret;
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_fd_ino (nfl, fd);
- STACK_WIND_COOKIE (frame, nfs_fop_fsync_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_fsync_cbk, nfsx, xl,
xl->fops->fsync, fd, datasync);
ret = 0;
err:
@@ -1201,7 +1189,7 @@ nfs_fop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_readv_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, stbuf, NULL, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, vector, count,
@@ -1213,8 +1201,8 @@ nfs_fop_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_read (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
- off_t offset, fop_readv_cbk_t cbk, void *local)
+nfs_fop_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ size_t size, off_t offset, fop_readv_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
@@ -1224,11 +1212,11 @@ nfs_fop_read (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
return ret;
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_fd_ino (nfl, fd);
- STACK_WIND_COOKIE (frame, nfs_fop_readv_cbk, xl, xl, xl->fops->readv, fd
- , size, offset);
+ STACK_WIND_COOKIE (frame, nfs_fop_readv_cbk, nfsx, xl, xl->fops->readv,
+ fd, size, offset);
ret = 0;
err:
if (ret < 0) {
@@ -1248,7 +1236,7 @@ nfs_fop_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct nfs_fop_local *nfl = NULL;
fop_truncate_cbk_t progcbk = NULL;
- nfl_to_prog_data (this, nfl, progcbk, frame);
+ nfl_to_prog_data (nfl, progcbk, frame);
nfs_fop_restore_root_ino (nfl, prebuf, postbuf, NULL, NULL);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, prebuf,postbuf);
@@ -1259,21 +1247,21 @@ nfs_fop_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-nfs_fop_truncate (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, off_t offset,
- fop_truncate_cbk_t cbk, void *local)
+nfs_fop_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ off_t offset, fop_truncate_cbk_t cbk, void *local)
{
call_frame_t *frame = NULL;
int ret = -EFAULT;
struct nfs_fop_local *nfl = NULL;
- if ((!xl) || (!loc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!loc) || (!nfu))
return ret;
nfs_fop_handle_frame_create (frame, xl, nfu, ret, err);
- nfs_fop_handle_local_init (frame, xl, nfl, cbk, local, ret, err);
+ nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, loc);
- STACK_WIND_COOKIE (frame, nfs_fop_truncate_cbk, xl, xl,
+ STACK_WIND_COOKIE (frame, nfs_fop_truncate_cbk, nfsx, xl,
xl->fops->truncate, loc, offset);
ret = 0;
@@ -1285,157 +1273,3 @@ err:
return ret;
}
-
-
-int
-nfs_fop_lookup_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, inode_t *inode,
- struct iatt *buf, dict_t *xattr,
- struct iatt *postparent)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync lookup failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync lookup done");
-
- sf->replystub = fop_lookup_cbk_stub (frame, NULL, op_ret, op_errno,
- inode, buf, xattr, postparent);
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-call_stub_t *
-nfs_fop_lookup_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *loc)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!loc) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_fop_lookup (xl, nfu, loc, nfs_fop_lookup_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync lookup failed");
- goto err;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- return reply;
-}
-
-
-
-int32_t
-nfs_fop_readdirp_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno,
- gf_dirent_t *entries)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync readdir failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync readdir done");
-
- sf->replystub = fop_readdirp_cbk_stub (frame, NULL, op_ret, op_errno,
- entries);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-/* This function does not update or map the st_dev in the d_stat of all the
- * entries that were read. That mapping for the sync version of readdiring
- * happens in the dcache.
- */
-call_stub_t *
-nfs_fop_readdirp_sync (xlator_t *fopxl, nfs_user_t *nfu, fd_t *dirfd,
- off_t offset, size_t bufsize)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!fopxl) || (!nfu) || (!dirfd))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "sync fop local init failed");
- goto ret;
- }
-
- ret = nfs_fop_readdirp (fopxl, nfu, dirfd, bufsize, offset,
- nfs_fop_readdirp_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Fop readdir failed: %s",
- strerror (-ret));
- goto ret;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-ret:
- return reply;
-}
-
-
-
-nfs_syncfop_t *
-nfs_syncfop_init ()
-{
- nfs_syncfop_t *sfl = NULL;
-
- sfl = CALLOC (1, sizeof (*sfl));
- if (!sfl) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Memory allocation failed");
- return NULL;
- }
-
- sem_init (&sfl->replysig, 0, 0);
-
- return sfl;
-}
-
-
-call_stub_t *
-nfs_syncfop_wait (nfs_syncfop_t *s)
-{
- call_stub_t *replystub = NULL;
-
- gf_log (GF_NFS, GF_LOG_TRACE, "Waiting for sync fop");
- sem_wait (&s->replysig);
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync fop notification received");
- replystub = s->replystub;
- FREE (s);
- return replystub;
-}
-
-
-void
-nfs_syncfop_notify (nfs_syncfop_t *s)
-{
- sem_post (&s->replysig);
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync fop notified");
-}
-
-
-
diff --git a/xlators/nfs/server/src/nfs-fops.h b/xlators/nfs/server/src/nfs-fops.h
index 8b12777d7..24fa0b99b 100644
--- a/xlators/nfs/server/src/nfs-fops.h
+++ b/xlators/nfs/server/src/nfs-fops.h
@@ -98,6 +98,7 @@ struct nfs_fop_local {
char path[NFS_NAME_MAX];
char newpath[NFS_NAME_MAX];
+ xlator_t *nfsx;
};
extern struct nfs_fop_local *
@@ -106,32 +107,34 @@ nfs_fop_local_init (xlator_t *xl);
extern void
nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l);
-#define xlator_top_private(xl) ((struct nfs_state *)((xlator_t *)(xl)->ctx->top)->private)
+#define nfs_state(nfsxl) (nfsxl)->private
+#define nfs_fop_mempool(nfxl) (((struct nfs_state *)nfs_state(nfxl))->foppool)
-#define prog_data_to_nfl(xla, nflocal, fram, pcbk, plocal) \
+#define prog_data_to_nfl(nf,nflocal, fram, pcbk, plocal) \
do { \
- nflocal = nfs_fop_local_init (xla); \
+ nflocal = nfs_fop_local_init (nf); \
if (nflocal) { \
nflocal->proglocal = plocal; \
nflocal->progcbk = pcbk; \
+ nflocal->nfsx = nf; \
if (fram) \
- ((call_frame_t *)fram)->local = nflocal; \
+ ((call_frame_t *)fram)->local = nflocal;\
} \
} while (0) \
-#define nfl_to_prog_data(xla, nflocal, pcbk, fram) \
+#define nfl_to_prog_data(nflocal, pcbk, fram) \
do { \
nflocal = fram->local; \
fram->local = nflocal->proglocal; \
pcbk = nflocal->progcbk; \
- nfs_fop_local_wipe (xla, nflocal); \
+ nfs_fop_local_wipe (nflocal->nfsx, nflocal); \
} while (0) \
-#define nfs_fop_handle_local_init(fram, xla, nfloc, cbck,prgloc,retval,lab) \
+#define nfs_fop_handle_local_init(fram,nfx, nfloc, cbck,prgloc,retval,lab) \
do { \
- prog_data_to_nfl (xla, nfloc, fram, cbck, prgloc); \
+ prog_data_to_nfl (nfx, nfloc, fram, cbck, prgloc); \
if (!nfloc) { \
gf_log (GF_NFS,GF_LOG_ERROR,"Failed to init local");\
retval = -ENOMEM; \
@@ -140,120 +143,94 @@ nfs_fop_local_wipe (xlator_t *xl, struct nfs_fop_local *l);
} while (0) \
extern int
-nfs_fop_fstat (xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+nfs_fop_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
fop_stat_cbk_t cbk, void *local);
extern int
-nfs_fop_readdirp (xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
+nfs_fop_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
size_t bufsize, off_t offset, fop_readdir_cbk_t cbk,
void *local);
extern int
-nfs_fop_lookup (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
fop_lookup_cbk_t cbk, void *local);
extern int
-nfs_fop_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
- mode_t mode, fd_t *fd, fop_create_cbk_t cbk, void *local);
+nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int flags, mode_t mode, fd_t *fd, fop_create_cbk_t cbk,
+ void *local);
extern int
-nfs_fop_flush (xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+nfs_fop_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
fop_flush_cbk_t cbk, void *local);
extern int
-nfs_fop_mkdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- fop_mkdir_cbk_t cbk, void *local);
+nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ mode_t mode, fop_mkdir_cbk_t cbk, void *local);
extern int
-nfs_fop_truncate (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, off_t offset,
- fop_truncate_cbk_t cbk, void *local);
+nfs_fop_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ off_t offset, fop_truncate_cbk_t cbk, void *local);
extern int
-nfs_fop_read (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
- off_t offset, fop_readv_cbk_t cbk, void *local);
+nfs_fop_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ size_t size, off_t offset, fop_readv_cbk_t cbk, void *local);
extern int
-nfs_fop_fsync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync,
- fop_fsync_cbk_t cbk, void *local);
+nfs_fop_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ int32_t datasync, fop_fsync_cbk_t cbk, void *local);
extern int
-nfs_fop_write (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
- struct iovec *vector, int32_t count, off_t offset,
- fop_writev_cbk_t cbk, void *local);
+nfs_fop_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ struct iobuf *srciob, struct iovec *vector, int32_t count,
+ off_t offset, fop_writev_cbk_t cbk, void *local);
extern int
-nfs_fop_open (xlator_t *xl, nfs_user_t *nfu, loc_t *loc, int32_t flags,
- fd_t *fd, int32_t wbflags, fop_open_cbk_t cbk, void *local);
+nfs_fop_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+ int32_t flags, fd_t *fd, int32_t wbflags, fop_open_cbk_t cbk,
+ void *local);
extern int
-nfs_fop_rename (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+nfs_fop_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
loc_t *newloc, fop_rename_cbk_t cbk, void *local);
extern int
-nfs_fop_link (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_link_cbk_t cbk, void *local);
+nfs_fop_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_link_cbk_t cbk, void *local);
extern int
-nfs_fop_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_unlink_cbk_t cbk, void *local);
extern int
-nfs_fop_rmdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_rmdir_cbk_t cbk, void *local);
extern int
-nfs_fop_mknod (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- dev_t dev, fop_mknod_cbk_t cbk, void *local);
+nfs_fop_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);
extern int
-nfs_fop_readlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
size_t size, fop_readlink_cbk_t cbk, void *local);
extern int
-nfs_fop_symlink (xlator_t *xl, nfs_user_t *nfu, char *target,
+nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
loc_t *pathloc, fop_symlink_cbk_t cbk, void *local);
extern int
-nfs_fop_setattr (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk,
void *local);
extern int
-nfs_fop_statfs (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_fop_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_statfs_cbk_t cbk, void *local);
extern int
-nfs_fop_opendir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,fd_t *dirfd,
- fop_opendir_cbk_t cbk, void *local);
+nfs_fop_opendir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ fd_t *dirfd, fop_opendir_cbk_t cbk, void *local);
extern int
-nfs_fop_stat (xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
+nfs_fop_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
fop_stat_cbk_t cbk, void *local);
-/* Synchronous equivalents of some of the fops above.
- */
-
-/* sfl = sync fop local
- * Structure used to turn async fops into sync calls for certain NFS ops
- * that need blocking operations.
- */
-typedef struct nfs_syncfop {
- sem_t replysig;
- call_stub_t *replystub;
-} nfs_syncfop_t;
-
-extern nfs_syncfop_t *
-nfs_syncfop_init ();
-
-extern call_stub_t *
-nfs_syncfop_wait (nfs_syncfop_t *s);
-
-extern void
-nfs_syncfop_notify (nfs_syncfop_t *s);
-
-extern call_stub_t *
-nfs_fop_lookup_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *loc);
-
-extern call_stub_t *
-nfs_fop_readdirp_sync (xlator_t *fopxl, nfs_user_t *nfu, fd_t *dirfd,
- off_t offset, size_t bufsize);
-
#endif
diff --git a/xlators/nfs/server/src/nfs-generics.c b/xlators/nfs/server/src/nfs-generics.c
index f83a7c868..b248c2875 100644
--- a/xlators/nfs/server/src/nfs-generics.c
+++ b/xlators/nfs/server/src/nfs-generics.c
@@ -34,184 +34,182 @@
int
-nfs_fstat (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, fop_stat_cbk_t cbk,
- void *local)
+nfs_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ fop_stat_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!fd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!fd) || (!nfu))
return ret;
- ret = nfs_fop_fstat (xl, nfu, fd, cbk, local);
+ ret = nfs_fop_fstat (nfsx, xl, nfu, fd, cbk, local);
return ret;
}
int
-nfs_stat (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, fop_stat_cbk_t cbk,
- void *local)
+nfs_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ fop_stat_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_fop_stat (xl, nfu, pathloc, cbk, local);
+ ret = nfs_fop_stat (nfsx, xl, nfu, pathloc, cbk, local);
return ret;
}
-
int
-nfs_readdirp (xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, size_t bufsize,
- off_t offset, fop_readdir_cbk_t cbk, void *local)
+nfs_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
+ size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local)
{
- if ((!xl) || (!dirfd) || (!nfu))
+ if ((!nfsx) || (!xl) || (!dirfd) || (!nfu))
return -EFAULT;
- return nfs_fop_readdirp (xl, nfu, dirfd, bufsize, offset, cbk,
+ return nfs_fop_readdirp (nfsx, xl, nfu, dirfd, bufsize, offset, cbk,
local);
}
-
int
-nfs_lookup (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_lookup_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_fop_lookup (xl, nfu, pathloc, cbk, local);
+ ret = nfs_fop_lookup (nfsx, xl, nfu, pathloc, cbk, local);
return ret;
}
int
-nfs_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
- mode_t mode, fop_create_cbk_t cbk, void *local)
+nfs_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int flags, mode_t mode, fop_create_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_inode_create (xl, nfu, pathloc, flags, mode, cbk,local);
+ ret = nfs_inode_create (nfsx, xl, nfu, pathloc, flags, mode, cbk,local);
return ret;
}
int
-nfs_flush (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, fop_flush_cbk_t cbk,
- void *local)
+nfs_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ fop_flush_cbk_t cbk, void *local)
{
- return nfs_fop_flush (xl, nfu, fd, cbk, local);
+ return nfs_fop_flush (nfsx, xl, nfu, fd, cbk, local);
}
int
-nfs_mkdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- fop_mkdir_cbk_t cbk, void *local)
+nfs_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ mode_t mode, fop_mkdir_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_inode_mkdir (xl, nfu, pathloc, mode, cbk, local);
+ ret = nfs_inode_mkdir (nfsx, xl, nfu, pathloc, mode, cbk, local);
return ret;
}
int
-nfs_truncate (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, off_t offset,
- fop_truncate_cbk_t cbk, void *local)
+nfs_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ off_t offset, fop_truncate_cbk_t cbk, void *local)
{
int ret = -EFAULT;
if ((!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_fop_truncate (xl, nfu, pathloc, offset, cbk, local);
+ ret = nfs_fop_truncate (nfsx, xl, nfu, pathloc, offset, cbk, local);
return ret;
}
int
-nfs_read (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
+nfs_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
off_t offset, fop_readv_cbk_t cbk, void *local)
{
- return nfs_fop_read (xl, nfu, fd, size, offset, cbk, local);
+ return nfs_fop_read (nfsx, xl, nfu, fd, size, offset, cbk, local);
}
int
-nfs_fsync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync,
- fop_fsync_cbk_t cbk, void *local)
+nfs_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ int32_t datasync, fop_fsync_cbk_t cbk, void *local)
{
- return nfs_fop_fsync (xl, nfu, fd, datasync, cbk, local);
+ return nfs_fop_fsync (nfsx, xl, nfu, fd, datasync, cbk, local);
}
int
-nfs_write (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
- struct iovec *vector, int32_t count, off_t offset,
- fop_writev_cbk_t cbk, void *local)
+nfs_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ struct iobuf *srciob, struct iovec *vector, int32_t count,
+ off_t offset, fop_writev_cbk_t cbk, void *local)
{
- return nfs_fop_write (xl, nfu, fd, srciob, vector, count, offset, cbk,
- local);
+ return nfs_fop_write (nfsx, xl, nfu, fd, srciob, vector, count, offset,
+ cbk, local);
}
int
-nfs_open (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int32_t flags,
- fop_open_cbk_t cbk, void *local)
+nfs_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int32_t flags, fop_open_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_inode_open (xl, nfu, pathloc, flags, GF_OPEN_NOWB, cbk,
+ ret = nfs_inode_open (nfsx, xl, nfu, pathloc, flags, GF_OPEN_NOWB, cbk,
local);
return ret;
}
int
-nfs_rename (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_rename_cbk_t cbk, void *local)
+nfs_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_rename_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!oldloc) || (!newloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu))
return ret;
- ret = nfs_inode_rename (xl, nfu, oldloc, newloc, cbk, local);
+ ret = nfs_inode_rename (nfsx, xl, nfu, oldloc, newloc, cbk, local);
return ret;
}
int
-nfs_link (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_link_cbk_t cbk, void *local)
+nfs_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_link_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!oldloc) || (!newloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!oldloc) || (!newloc) || (!nfu))
return ret;
- ret = nfs_inode_link (xl, nfu, oldloc, newloc, cbk, local);
+ ret = nfs_inode_link (nfsx, xl, nfu, oldloc, newloc, cbk, local);
return ret;
}
int
-nfs_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_unlink_cbk_t cbk, void *local)
{
int ret = -EFAULT;
@@ -219,849 +217,103 @@ nfs_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
if ((!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_inode_unlink (xl, nfu, pathloc, cbk, local);
+ ret = nfs_inode_unlink (nfsx, xl, nfu, pathloc, cbk, local);
return ret;
}
int
-nfs_rmdir (xlator_t *xl, nfs_user_t *nfu, loc_t *path, fop_rmdir_cbk_t cbk,
- void *local)
+nfs_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *path,
+ fop_rmdir_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!path) || (!nfu))
+ if ((!nfsx) || (!xl) || (!path) || (!nfu))
return ret;
- ret = nfs_inode_rmdir (xl, nfu, path, cbk, local);
+ ret = nfs_inode_rmdir (nfsx, xl, nfu, path, cbk, local);
return ret;
}
int
-nfs_mknod (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- dev_t dev, fop_mknod_cbk_t cbk, void *local)
+nfs_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)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_inode_mknod (xl, nfu, pathloc, mode, dev, cbk, local);
+ ret = nfs_inode_mknod (nfsx, xl, nfu, pathloc, mode, dev, cbk, local);
return ret;
}
int
-nfs_readlink (xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc,
+nfs_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc,
fop_readlink_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!linkloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!linkloc) || (!nfu))
return ret;
- ret = nfs_fop_readlink (xl, nfu, linkloc, NFS_PATH_MAX, cbk, local);
+ ret = nfs_fop_readlink (nfsx, xl, nfu, linkloc, NFS_PATH_MAX, cbk,
+ local);
return ret;
}
-
int
-nfs_symlink (xlator_t *xl, nfs_user_t *nfu, char *target, loc_t *linkloc,
- fop_symlink_cbk_t cbk, void *local)
+nfs_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
+ loc_t *linkloc, fop_symlink_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!linkloc) || (!target) || (!nfu))
+ if ((!nfsx) || (!xl) || (!linkloc) || (!target) || (!nfu))
return ret;
- ret = nfs_inode_symlink (xl, nfu, target, linkloc, cbk, local);
+ ret = nfs_inode_symlink (nfsx, xl, nfu, target, linkloc, cbk, local);
return ret;
}
int
-nfs_setattr (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk,
void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_fop_setattr (xl, nfu, pathloc, buf, valid, cbk, local);
+ ret = nfs_fop_setattr (nfsx, xl, nfu, pathloc, buf, valid, cbk, local);
return ret;
}
int
-nfs_statfs (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_statfs_cbk_t cbk, void *local)
{
int ret = -EFAULT;
- if ((!xl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!xl) || (!pathloc) || (!nfu))
return ret;
- ret = nfs_fop_statfs (xl, nfu, pathloc, cbk, local);
+ ret = nfs_fop_statfs (nfsx, xl, nfu, pathloc, cbk, local);
return ret;
}
-
-int
-nfs_open_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync open failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync open done");
-
- sf->replystub = fop_open_cbk_stub (frame, NULL, op_ret, op_errno, fd);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-call_stub_t *
-nfs_open_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int32_t flags)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!pathloc) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_open (xl, nfu, pathloc, flags, nfs_open_sync_cbk, sf);
- if (ret < 0)
- goto err;
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-
-
int
-nfs_fdctx_alloc (fd_t *fd, xlator_t *xl)
-{
- nfs_fdctx_t *fdctx = NULL;
- int ret = -EFAULT;
-
- if ((!fd) || (!xl))
- return ret;
-
- fdctx = CALLOC (1, sizeof (*fdctx));
- if (!fdctx) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Memory allocation failure");
- ret = -ENOMEM;
- goto err;
- }
-
- pthread_mutex_init (&fdctx->lock, NULL);
-
- ret = fd_ctx_set (fd, xl, (uint64_t)fdctx);
- if (ret == -1) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to set fd context");
- ret = -EFAULT;
- goto free_ctx;
- }
-
- ret = 0;
-
-free_ctx:
- if (ret < 0)
- FREE (fdctx);
-
-err:
- return ret;
-}
-
-
-void
-nfs_fdctx_del (fd_t *fd, xlator_t *xl)
-{
- nfs_fdctx_t *fdctx = NULL;
- uint64_t ctxaddr = 0;
- int ret = -1;
-
- if ((!fd) || (!xl))
- return;
-
- ret = fd_ctx_del (fd, xl, &ctxaddr);
- if (ret == -1)
- goto err;
-
- fdctx = (nfs_fdctx_t *)ctxaddr;
- FREE (fdctx);
-
-err:
- return;
-}
-
-
-nfs_fdctx_t *
-nfs_fdctx_get (fd_t *fd, xlator_t *xl)
-{
- nfs_fdctx_t *fdctx = NULL;
- int ret = -1;
- uint64_t ctxptr = 0;
-
- if ((!fd) || (!xl))
- return NULL;
-
- ret = fd_ctx_get (fd, xl, &ctxptr);
- if (ret == -1) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to get fd context");
- goto err;
- }
-
- fdctx = (nfs_fdctx_t *)ctxptr;
-err:
- return fdctx;
-}
-
-
-int
-nfs_dir_fdctx_init (fd_t *dirfd, xlator_t *xl, xlator_t *fopxl, size_t bufsize)
-{
- int ret = -EFAULT;
- nfs_fdctx_t *fdctx = NULL;
-
- if ((!dirfd) || (!xl))
- return ret;
-
- ret = nfs_fdctx_alloc (dirfd, xl);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to alloc dir fd context");
- goto err;
- }
-
- fdctx = nfs_fdctx_get (dirfd, xl);
- if (!fdctx) {
- ret = -EFAULT;
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to get dir fd context");
- goto err;
- }
-
- fdctx->dcache = CALLOC (1, sizeof (struct nfs_direntcache));
- if (!fdctx->dcache) {
- ret = -ENOMEM;
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to allocate dirent"
- " cache");
- goto free_ctx;
- }
-
- INIT_LIST_HEAD (&fdctx->dcache->entries.list);
- fdctx->dirent_bufsize = bufsize;
- fdctx->dirvol = fopxl;
-
- ret = 0;
-
-free_ctx:
- if (ret < 0)
- nfs_fdctx_del (dirfd, xl);
-err:
- return ret;
-}
-
-
-
-
-/* Dirent caching code copied from libglusterfsclient.
- * Please duplicate enhancements and bug fixes there too.
- */
-void
-nfs_dcache_invalidate (xlator_t *nfsx, fd_t *fd)
-{
- nfs_fdctx_t *fd_ctx = NULL;
-
- if (!fd)
- return;
-
- fd_ctx = nfs_fdctx_get (fd, nfsx);
- if (!fd_ctx) {
- gf_log (GF_NFS, GF_LOG_ERROR, "No fd context present");
- return;
- }
-
- if (!fd_ctx->dcache) {
- gf_log (GF_NFS, GF_LOG_TRACE, "No dirent cache present");
- return;
- }
-
- if (!list_empty (&fd_ctx->dcache->entries.list)) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Freeing dirents");
- gf_dirent_free (&fd_ctx->dcache->entries);
- }
-
- INIT_LIST_HEAD (&fd_ctx->dcache->entries.list);
-
- fd_ctx->dcache->next = NULL;
- fd_ctx->dcache->prev_off = 0;
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache invalidated");
-
- return;
-}
-
-/* Dirent caching code copied from libglusterfsclient.
- * Please duplicate enhancements and bug fixes there too.
- */
-/* The first entry in the entries is always a placeholder
- * or the list head. The real entries begin from entries->next.
- */
-int
-nfs_dcache_update (xlator_t *nfsx, fd_t *fd, gf_dirent_t *entries)
-{
- nfs_fdctx_t *fdctx = NULL;
- int ret = -EFAULT;
-
- if ((!fd) || (!entries))
- return ret;
-
- fdctx = nfs_fdctx_get (fd, nfsx);
- if (!fdctx) {
- gf_log (GF_NFS, GF_LOG_ERROR, "No fd context present");
- return ret;
- }
-
- /* dcache is not enabled. */
- if (!fdctx->dcache) {
- gf_log (GF_NFS, GF_LOG_TRACE, "No dirent cache present");
- return ret;
- }
-
- /* If we're updating, we must begin with invalidating any previous
- * entries.
- */
- nfs_dcache_invalidate (nfsx, fd);
-
- fdctx->dcache->next = entries->next;
- /* We still need to store a pointer to the head
- * so we start free'ing from the head when invalidation
- * is required.
- *
- * Need to delink the entries from the list
- * given to us by an underlying translators. Most translators will
- * free this list after this call so we must preserve the dirents in
- * order to cache them.
- */
- list_splice_init (&entries->list, &fdctx->dcache->entries.list);
- ret = 0;
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache updated");
-
- return ret;
-}
-
-/* Dirent caching code copied from libglusterfsclient.
- * Please duplicate enhancements and bug fixes there too.
- */
-int
-nfs_dcache_readdir (xlator_t *nfsx, fd_t *fd, gf_dirent_t *dirp, off_t *offset)
-{
- nfs_fdctx_t *fdctx = NULL;
- int cachevalid = 0;
-
- if ((!fd) || (!dirp) || (!offset))
- return 0;
-
- fdctx = nfs_fdctx_get (fd, nfsx);
- if (!fdctx) {
- gf_log (GF_NFS, GF_LOG_ERROR, "No fd context present");
- goto out;
- }
-
- if (!fdctx->dcache) {
- gf_log (GF_NFS, GF_LOG_TRACE, "No dirent cache present");
- goto out;
- }
-
- /* We've either run out of entries in the cache
- * or the cache is empty.
- */
- if (!fdctx->dcache->next) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache is empty");
- goto out;
- }
-
- /* The dirent list is created as a circular linked list
- * so this check is needed to ensure, we dont start
- * reading old entries again.
- * If we're reached this situation, the cache is exhausted
- * and we'll need to pre-fetch more entries to continue serving.
- */
- if (fdctx->dcache->next == &fdctx->dcache->entries) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache was exhausted");
- goto out;
- }
-
- /* During sequential reading we generally expect that the offset
- * requested is the same as the offset we served in the previous call
- * to readdir. But, seekdir, rewinddir and libgf_dcache_invalidate
- * require special handling because seekdir/rewinddir change the offset
- * in the fd_ctx and libgf_dcache_invalidate changes the prev_off.
- */
- if (*offset != fdctx->dcache->prev_off) {
- /* For all cases of the if branch above, we know that the
- * cache is now invalid except for the case below. It handles
- * the case where the two offset values above are different
- * but different because the previous readdir block was
- * exhausted, resulting in a prev_off being set to 0 in
- * libgf_dcache_invalidate, while the requested offset is non
- * zero because that is what we returned for the last dirent
- * of the previous readdir block.
- */
- if ((*offset != 0) && (fdctx->dcache->prev_off == 0)) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache was"
- " exhausted");
- cachevalid = 1;
- } else
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache is"
- " invalid");
- } else {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent cache is valid");
- cachevalid = 1;
- }
-
- if (!cachevalid)
- goto out;
-
- dirp->d_ino = fdctx->dcache->next->d_ino;
- strncpy (dirp->d_name, fdctx->dcache->next->d_name,
- fdctx->dcache->next->d_len + 1);
- dirp->d_len = fdctx->dcache->next->d_len;
- dirp->d_stat = fdctx->dcache->next->d_stat;
-// nfs_map_dev (fdctx->dirvol, &dirp->d_stat.st_dev);
-
- *offset = fdctx->dcache->next->d_off;
- dirp->d_off = *offset;
- fdctx->dcache->prev_off = fdctx->dcache->next->d_off;
- fdctx->dcache->next = fdctx->dcache->next->next;
-
-out:
- return cachevalid;
-}
-
-int
-__nfs_readdir_sync (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu,
- fd_t *dirfd, off_t *offset, gf_dirent_t *entry,
- size_t bufsize)
-{
- int ret = -1;
- call_stub_t *reply = NULL;
-
- if ((!fopxl) || (!dirfd) || (!entry))
- return ret;
-
- ret = nfs_dcache_readdir (nfsx, dirfd, entry, offset);
- if (ret) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent served from cache");
- ret = 0;
- goto err;
- }
-
- reply = nfs_fop_readdirp_sync (fopxl, nfu, dirfd, *offset,bufsize);
- if (!reply) {
- ret = -1;
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync readdir failed");
- goto err;
- }
-
- if (reply->args.readdir_cbk.op_ret <= 0) {
- ret = -1;
- goto err;
- }
-
- ret = nfs_dcache_update (nfsx, dirfd, &reply->args.readdir_cbk.entries);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to update dirent cache");
- goto err;
- }
-
- ret = nfs_dcache_readdir (nfsx, dirfd, entry, offset);
- if (ret) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent served from cache,"
- " after updating from server");
- ret = 0;
- } else {
- gf_log (GF_NFS, GF_LOG_TRACE, "Dirent still not served from"
- " cache, even after updating from server");
- ret = -1;
- }
-
-err:
- if (reply)
- call_stub_destroy (reply);
- return ret;
-}
-
-
-
-int
-nfs_readdir_sync (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu,
- fd_t *dirfd, gf_dirent_t *entry)
-{
- int ret = -EFAULT;
- nfs_fdctx_t *fdctx = NULL;
-
- if ((!nfsx) || (!fopxl) || (!dirfd) || (!entry) || (!nfu))
- return ret;
-
- fdctx = nfs_fdctx_get (dirfd, nfsx);
- if (!fdctx) {
- gf_log (GF_NFS, GF_LOG_ERROR, "No fd context present");
- goto err;
- }
-
- pthread_mutex_lock (&fdctx->lock);
- {
- ret = __nfs_readdir_sync (nfsx, fopxl, nfu, dirfd,
- &fdctx->offset, entry,
- fdctx->dirent_bufsize);
- }
- pthread_mutex_unlock (&fdctx->lock);
-
- if (ret < 0)
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync readdir failed: %s",
- strerror (-ret));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Entry read: %s: len %d, ino %"
- PRIu64", igen: %"PRIu64, entry->d_name, entry->d_len,
- entry->d_ino, entry->d_stat.ia_dev);
-
-err:
- return ret;
-}
-
-
-int32_t
-nfs_flush_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync open failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync open done");
-
- sf->replystub = fop_flush_cbk_stub (frame, NULL, op_ret, op_errno);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-call_stub_t *
-nfs_flush_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!fd) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_flush (xl, nfu, fd, nfs_flush_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync flush failed: %s",
- strerror (-ret));
- goto err;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-
-int32_t
-nfs_writev_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync write failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync write done");
-
- sf->replystub = fop_writev_cbk_stub (frame, NULL, op_ret, op_errno,
- prebuf, postbuf);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-
-call_stub_t *
-nfs_write_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
- struct iovec *vec, int count, off_t offset)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!fd) || (!vec) || (!nfu) || (!srciob))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_write (xl, nfu, fd, srciob, vec, count, offset,
- nfs_writev_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync flush failed: %s",
- strerror (-ret));
- goto err;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-
-
-int32_t
-nfs_fsync_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
- struct iatt *postbuf)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync fsync failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync fsync done");
-
- sf->replystub = fop_fsync_cbk_stub (frame, NULL, op_ret, op_errno,
- prebuf, postbuf);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-
-call_stub_t *
-nfs_fsync_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!fd) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_fsync (xl, nfu, fd, datasync, nfs_fsync_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync fsync failed: %s",
- strerror (-ret));
- goto err;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-int32_t
-nfs_read_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, struct iovec *vector,
- int32_t count, struct iatt *buf, struct iobref *iobref)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync read failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync read done");
-
- sf->replystub = fop_readv_cbk_stub (frame, NULL, op_ret, op_errno,
- vector, count, buf, iobref);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-
-call_stub_t *
-nfs_read_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
- off_t offset)
-{
- nfs_syncfop_t *sf = NULL;
- call_stub_t *reply = NULL;
- int ret = -1;
-
- if ((!xl) || (!fd) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- goto err;
- }
-
- ret = nfs_read (xl, nfu, fd, size, offset, nfs_read_sync_cbk, sf);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Sync read failed: %s",
- strerror (-ret));
- goto err;
- }
-
- reply = nfs_syncfop_wait (sf);
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-
-int32_t
-nfs_opendir_sync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
- int32_t op_ret, int32_t op_errno, fd_t *fd)
-{
- nfs_syncfop_t *sf = frame->local;
-
- if (!sf)
- return -1;
-
- if (op_ret == -1)
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync opendir failed: %s",
- strerror (op_errno));
- else
- gf_log (GF_NFS, GF_LOG_TRACE, "Sync opendir done");
-
- sf->replystub = fop_opendir_cbk_stub (frame, NULL, op_ret, op_errno,fd);
-
- nfs_syncfop_notify (sf);
- return 0;
-}
-
-
-call_stub_t *
-nfs_opendir_sync (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu,
- loc_t *pathloc, size_t bufsize)
-{
- int ret = -EFAULT;
- call_stub_t *reply = NULL;
- nfs_syncfop_t *sf = NULL;
- fd_t *dirfd = NULL;
-
- if ((!nfsx) || (!fopxl) || (!pathloc) || (!nfu))
- return NULL;
-
- sf = nfs_syncfop_init ();
- if (!sf) {
- gf_log (GF_NFS, GF_LOG_ERROR, "synclocal init failed");
- ret = -ENOMEM;
- goto err;
- }
-
- ret = nfs_inode_opendir (fopxl, nfu, pathloc, nfs_opendir_sync_cbk, sf);
- if (ret < 0)
- goto err;
-
- reply = nfs_syncfop_wait (sf);
- if (!reply) {
- ret = -EFAULT;
- goto err;
- }
-
- dirfd = reply->args.opendir_cbk.fd;
- ret = nfs_dir_fdctx_init (dirfd, nfsx, fopxl, bufsize);
- if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "fd context allocation failed");
- goto err;
- }
-
- ret = 0;
-
-err:
- if (ret < 0)
- FREE (sf);
-
- return reply;
-}
-
-
-int
-nfs_opendir (xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_opendir (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc,
fop_opendir_cbk_t cbk, void *local)
{
- if ((!fopxl) || (!pathloc) || (!nfu))
+ if ((!nfsx) || (!fopxl) || (!pathloc) || (!nfu))
return -EFAULT;
- return nfs_inode_opendir (fopxl, nfu, pathloc, cbk, local);
+ return nfs_inode_opendir (nfsx, fopxl, nfu, pathloc, cbk, local);
}
diff --git a/xlators/nfs/server/src/nfs-generics.h b/xlators/nfs/server/src/nfs-generics.h
index 980e73020..55740f7b2 100644
--- a/xlators/nfs/server/src/nfs-generics.h
+++ b/xlators/nfs/server/src/nfs-generics.h
@@ -54,91 +54,91 @@ typedef struct nfs_fop_fdcontext {
} nfs_fdctx_t;
extern int
-nfs_fstat (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, fop_stat_cbk_t cbk,
- void *local);
+nfs_fstat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ fop_stat_cbk_t cbk, void *local);
extern int
-nfs_readdirp (xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd, size_t bufsize,
- off_t offset, fop_readdir_cbk_t cbk, void *local);
+nfs_readdirp (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *dirfd,
+ size_t bufsize, off_t offset, fop_readdir_cbk_t cbk, void *local);
extern int
-nfs_lookup (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_lookup_cbk_t cbk, void *local);
extern int
-nfs_create (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int flags,
- mode_t mode, fop_create_cbk_t cbk, void *local);
+nfs_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int flags, mode_t mode, fop_create_cbk_t cbk, void *local);
extern int
-nfs_flush (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, fop_flush_cbk_t cbk,
- void *local);
+nfs_flush (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ fop_flush_cbk_t cbk, void *local);
extern int
-nfs_mkdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- fop_mkdir_cbk_t cbk, void *local);
+nfs_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ mode_t mode, fop_mkdir_cbk_t cbk, void *local);
extern int
-nfs_truncate (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, off_t offset,
- fop_truncate_cbk_t cbk, void *local);
+nfs_truncate (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ off_t offset, fop_truncate_cbk_t cbk, void *local);
extern int
-nfs_read (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
+nfs_read (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
off_t offset, fop_readv_cbk_t cbk, void *local);
extern int
-nfs_fsync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync,
- fop_fsync_cbk_t cbk, void *local);
+nfs_fsync (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ int32_t datasync, fop_fsync_cbk_t cbk, void *local);
extern int
-nfs_write (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
- struct iovec *vector, int32_t count, off_t offset,
- fop_writev_cbk_t cbk, void *local);
+nfs_write (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, fd_t *fd,
+ struct iobuf *srciob, struct iovec *vector, int32_t count,
+ off_t offset, fop_writev_cbk_t cbk, void *local);
extern int
-nfs_open (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, int32_t flags,
- fop_open_cbk_t cbk, void *local);
+nfs_open (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ int32_t flags, fop_open_cbk_t cbk, void *local);
extern int
-nfs_rename (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_rename_cbk_t cbk, void *local);
+nfs_rename (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_rename_cbk_t cbk, void *local);
extern int
-nfs_link (xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc, loc_t *newloc,
- fop_link_cbk_t cbk, void *local);
+nfs_link (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *oldloc,
+ loc_t *newloc, fop_link_cbk_t cbk, void *local);
extern int
-nfs_unlink (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_unlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_unlink_cbk_t cbk, void *local);
extern int
-nfs_rmdir (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_rmdir_cbk_t cbk, void *local);
extern int
-nfs_mknod (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, mode_t mode,
- dev_t dev, fop_mknod_cbk_t cbk, void *local);
+nfs_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);
extern int
-nfs_readlink (xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc,
+nfs_readlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *linkloc,
fop_readlink_cbk_t cbk, void *local);
extern int
-nfs_setattr (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_setattr (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
struct iatt *buf, int32_t valid, fop_setattr_cbk_t cbk,
void *local);
extern int
-nfs_statfs (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_statfs (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
fop_statfs_cbk_t cbk, void *local);
extern int
-nfs_stat (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc, fop_stat_cbk_t cbk
- , void *local);
+nfs_stat (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
+ fop_stat_cbk_t cbk, void *local);
extern int
-nfs_symlink (xlator_t *xl, nfs_user_t *nfu, char *target, loc_t *linkloc,
- fop_symlink_cbk_t cbk, void *local);
+nfs_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
+ loc_t *linkloc, fop_symlink_cbk_t cbk, void *local);
/* Synchronous equivalents */
@@ -146,29 +146,15 @@ extern call_stub_t *
nfs_open_sync (xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
int32_t flags);
-extern int
-nfs_readdir_sync (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu,
- fd_t *dirfd, gf_dirent_t *entry);
-
-extern call_stub_t *
-nfs_flush_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd);
-
extern call_stub_t *
nfs_write_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, struct iobuf *srciob,
struct iovec *vec, int count, off_t offset);
extern call_stub_t *
-nfs_fsync_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, int32_t datasync);
-
-extern call_stub_t *
nfs_read_sync (xlator_t *xl, nfs_user_t *nfu, fd_t *fd, size_t size,
off_t offset);
-extern call_stub_t *
-nfs_opendir_sync (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu,
- loc_t *dirloc, size_t bufsize);
-
extern int
-nfs_opendir (xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc,
+nfs_opendir (xlator_t *nfsx, xlator_t *fopxl, nfs_user_t *nfu, loc_t *pathloc,
fop_opendir_cbk_t cbk, void *local);
#endif
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c
index 69bad0724..4b8bad717 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) {
diff --git a/xlators/nfs/server/src/nfs-inodes.h b/xlators/nfs/server/src/nfs-inodes.h
index 04d3eba66..51a23faef 100644
--- a/xlators/nfs/server/src/nfs-inodes.h
+++ b/xlators/nfs/server/src/nfs-inodes.h
@@ -38,43 +38,45 @@ nfs_link_inode (inode_t *newi, inode_t *parent, char *name,
struct iatt *newstat);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern 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);
extern int
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;
}
diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c
index 5b2fdaca4..04454ee19 100644
--- a/xlators/nfs/server/src/nfs3-helpers.c
+++ b/xlators/nfs/server/src/nfs3-helpers.c
@@ -1664,8 +1664,8 @@ __nfs3_dir_open_and_resume (nfs3_call_state_t *cs)
return ret;
nfs_user_root_create (&nfu);
- ret = nfs_opendir (cs->vol, &nfu, &cs->resolvedloc, nfs3_dir_open_cbk,
- cs);
+ ret = nfs_opendir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_dir_open_cbk, cs);
return ret;
}
@@ -1963,7 +1963,7 @@ __nfs3_file_open_and_resume (nfs3_call_state_t *cs)
nfs_user_root_create (&nfu);
gf_log (GF_NFS3, GF_LOG_TRACE, "Opening uncached fd");
- ret = nfs_open (cs->vol, &nfu, &cs->resolvedloc, O_RDWR,
+ ret = nfs_open (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc, O_RDWR,
nfs3_file_open_cbk, cs);
out:
return ret;
@@ -2383,9 +2383,9 @@ nfs3_fh_resolve_found_entry (nfs3_call_state_t *cs, gf_dirent_t *candidate)
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry not in itable, needs"
" lookup");
nfs_user_root_create (&nfu);
- ret = nfs_fop_lookup (cs->vol, &nfu, &cs->resolvedloc,
- nfs3_fh_resolve_entry_lookup_cbk,
- cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fh_resolve_entry_lookup_cbk,
+ cs);
} else {
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry got from itable");
nfs3_call_resume (cs);
@@ -2445,9 +2445,9 @@ nfs3_fh_resolve_found_parent (nfs3_call_state_t *cs, gf_dirent_t *candidate)
NFS_RESOLVE_CREATE);
if (ret == -ENOENT) {
nfs_user_root_create (&nfu);
- ret = nfs_fop_lookup (cs->vol, &nfu, &cs->resolvedloc,
- nfs3_fh_resolve_parent_lookup_cbk,
- cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fh_resolve_parent_lookup_cbk,
+ cs);
} else
nfs3_fh_resolve_entry_hard (cs);
@@ -2505,7 +2505,7 @@ nfs3_fh_resolve_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
fd_unref (cs->resolve_dir_fd);
cs->resolve_dir_fd = fd_ref (fd);
- ret = nfs_readdirp (cs->vol, &nfu, fd, GF_NFS3_DTPREF, 0,
+ ret = nfs_readdirp (cs->nfsx, cs->vol, &nfu, fd, GF_NFS3_DTPREF, 0,
nfs3_fh_resolve_readdir_cbk, cs);
err:
@@ -2536,7 +2536,7 @@ nfs3_fh_resolve_dir_lookup_cbk (call_frame_t *frame, void *cookie,
nfs_user_root_create (&nfu);
inode_link (inode, cs->resolvedloc.parent, cs->resolvedloc.name, buf);
- nfs_opendir (cs->vol, &nfu, &cs->resolvedloc,
+ nfs_opendir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3_fh_resolve_opendir_cbk, cs);
err:
@@ -2575,13 +2575,13 @@ nfs3_fh_resolve_dir_hard (nfs3_call_state_t *cs, uint64_t ino, uint64_t gen,
if (ret == 0) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Dir will be opened: %s",
cs->resolvedloc.path);
- ret = nfs_opendir (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_opendir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3_fh_resolve_opendir_cbk, cs);
} else if (ret == -ENOENT) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Dir needs lookup: %s",
cs->resolvedloc.path);
- ret = nfs_fop_lookup (cs->vol, &nfu, &cs->resolvedloc,
- nfs3_fh_resolve_dir_lookup_cbk, cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fh_resolve_dir_lookup_cbk, cs);
}
out:
return ret;
@@ -2610,7 +2610,7 @@ nfs3_fh_resolve_check_response (nfs3_call_state_t *cs, gf_dirent_t *candidate,
nfs3_fh_resolve_found (cs, candidate);
else if (response == GF_NFS3_FHRESOLVE_NOTFOUND) {
nfs_user_root_create (&nfu);
- ret = nfs_readdirp (cs->vol, &nfu, cs->resolve_dir_fd,
+ ret = nfs_readdirp (cs->nfsx, cs->vol, &nfu, cs->resolve_dir_fd,
GF_NFS3_DTPREF, last_offt,
nfs3_fh_resolve_readdir_cbk, cs);
}
@@ -2702,13 +2702,13 @@ nfs3_fh_resolve_inode_hard (nfs3_call_state_t *cs)
if (ret == 0) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Dir will be opened: %s",
cs->resolvedloc.path);
- ret = nfs_opendir (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_opendir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3_fh_resolve_opendir_cbk, cs);
} else if (ret == -ENOENT) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Dir needs lookup: %s",
cs->resolvedloc.path);
- ret = nfs_fop_lookup (cs->vol, &nfu, &cs->resolvedloc,
- nfs3_fh_resolve_dir_lookup_cbk, cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fh_resolve_dir_lookup_cbk, cs);
}
out:
@@ -2739,8 +2739,8 @@ nfs3_fh_resolve_entry_hard (nfs3_call_state_t *cs)
if (ret == -2) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry needs lookup: %s",
cs->resolvedloc.path);
- ret = nfs_fop_lookup (cs->vol, &nfu, &cs->resolvedloc,
- nfs3_fh_resolve_entry_lookup_cbk, cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fh_resolve_entry_lookup_cbk, cs);
ret = 0;
} else if (ret == -1) {
gf_log (GF_NFS3, GF_LOG_TRACE, "Entry needs parent lookup: %s",
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 41e474b39..4129a1880 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -466,10 +466,10 @@ nfs3_getattr_resume (void *carg)
* expects even the root inode to have been looked up.
*/
if (cs->resolvedloc.inode->ino == 1)
- ret = nfs_lookup (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_getattr_lookup_cbk, cs);
else
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_getattr_stat_cbk, cs);
if (ret < 0) {
@@ -642,7 +642,7 @@ nfs3svc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((gf_attr_size_set (cs->setattr_valid)) &&
(!IA_ISDIR (postop->ia_type))) {
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_truncate (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_truncate (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
cs->stbuf.ia_size, nfs3svc_truncate_cbk,cs);
if (ret < 0)
@@ -690,7 +690,7 @@ nfs3svc_setattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* Not a clean way but no motivation to add a new member to local. */
cs->preparent = *buf;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_setattr (cs->vol, &nfu, &cs->resolvedloc, &cs->stbuf,
+ ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,&cs->stbuf,
cs->setattr_valid, nfs3svc_setattr_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -723,11 +723,12 @@ nfs3_setattr_resume (void *carg)
nfs_request_user_init (&nfu, cs->req);
/* If no ctime check is required, head straight to setting the attrs. */
if (cs->sattrguardcheck)
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_setattr_stat_cbk, cs);
else
- ret = nfs_setattr (cs->vol, &nfu, &cs->resolvedloc, &cs->stbuf,
- cs->setattr_valid, nfs3svc_setattr_cbk, cs);
+ ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ &cs->stbuf, cs->setattr_valid,
+ nfs3svc_setattr_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -933,7 +934,7 @@ nfs3_lookup_parentdir_resume (void *carg)
if (ret < 0)
goto errtostat;
- ret = nfs_lookup (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_lookup_parentdir_cbk, cs);
errtostat:
if (ret < 0)
@@ -969,8 +970,8 @@ nfs3_lookup_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
cs->parent = cs->resolvefh;
- ret = nfs_lookup (cs->vol, &nfu, &cs->resolvedloc, nfs3svc_lookup_cbk,
- cs);
+ ret = nfs_lookup (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3svc_lookup_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -1133,7 +1134,8 @@ nfs3_access_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
cs->fh = cs->resolvefh;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc, nfs3svc_access_cbk,cs);
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3svc_access_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -1271,7 +1273,7 @@ nfs3_readlink_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_readlink (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_readlink (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_readlink_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -1433,8 +1435,8 @@ nfs3_read_fd_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_read (cs->vol, &nfu, cs->fd, cs->datacount, cs->dataoffset,
- nfs3svc_read_cbk, cs);
+ ret = nfs_read (cs->nfsx, cs->vol, &nfu, cs->fd, cs->datacount,
+ cs->dataoffset, nfs3svc_read_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
nfs3err:
@@ -1620,7 +1622,8 @@ nfs3svc_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
* the write fop happened before the fsync.
*/
cs->stbuf = *prebuf;
- ret = nfs_fsync (cs->vol, &nfu, cs->fd, 0, nfs3svc_write_fsync_cbk, cs);
+ ret = nfs_fsync (cs->nfsx, cs->vol, &nfu, cs->fd, 0,
+ nfs3svc_write_fsync_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -1661,8 +1664,8 @@ __nfs3_write_resume (nfs3_call_state_t *cs)
* opaque data buffers to multiples of 4 bytes.
*/
cs->datavec.iov_len = cs->datacount;
- ret = nfs_write (cs->vol, &nfu, cs->fd, cs->iob, &cs->datavec, 1,
- cs->dataoffset, nfs3svc_write_cbk, cs);
+ ret = nfs_write (cs->nfsx, cs->vol, &nfu, cs->fd, cs->iob, &cs->datavec,
+ 1, cs->dataoffset, nfs3svc_write_cbk, cs);
return ret;
}
@@ -1960,7 +1963,7 @@ nfs3svc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs->preparent = *preparent;
cs->postparent = *postparent;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_setattr (cs->vol, &nfu, &cs->resolvedloc, &cs->stbuf,
+ ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,&cs->stbuf,
cs->setattr_valid, nfs3svc_create_setattr_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -1999,12 +2002,12 @@ nfs3_create_common (nfs3_call_state_t *cs)
*/
if (cs->setattr_valid & GF_SET_ATTR_MODE) {
cs->setattr_valid &= ~GF_SET_ATTR_MODE;
- ret = nfs_create (cs->vol, &nfu, &cs->resolvedloc, flags,
- cs->mode, nfs3svc_create_cbk, cs);
+ ret = nfs_create (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ flags, cs->mode, nfs3svc_create_cbk, cs);
} else
- ret = nfs_create (cs->vol, &nfu, &cs->resolvedloc, flags,
- NFS_DEFAULT_CREATE_MODE, nfs3svc_create_cbk,
- cs);
+ ret = nfs_create (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ flags, NFS_DEFAULT_CREATE_MODE,
+ nfs3svc_create_cbk, cs);
return ret;
}
@@ -2064,17 +2067,17 @@ nfs3_create_exclusive (nfs3_call_state_t *cs)
*/
if ((cs->resolve_ret == 0) ||
((cs->resolve_ret == -1) && (cs->resolve_errno != ENOENT))) {
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_create_stat_cbk, cs);
goto nfs3err;
}
if (cs->setattr_valid & GF_SET_ATTR_MODE) {
cs->setattr_valid &= ~GF_SET_ATTR_MODE;
- ret = nfs_create (cs->vol, &nfu, &cs->resolvedloc, O_RDWR,
- cs->mode, nfs3svc_create_cbk, cs);
+ ret = nfs_create (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ O_RDWR, cs->mode, nfs3svc_create_cbk, cs);
} else
- ret = nfs_create (cs->vol, &nfu, &cs->oploc, O_RDWR,
+ ret = nfs_create (cs->nfsx, cs->vol, &nfu, &cs->oploc, O_RDWR,
NFS_DEFAULT_CREATE_MODE, nfs3svc_create_cbk,
cs);
@@ -2259,7 +2262,7 @@ nfs3svc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs->preparent = *preparent;
cs->postparent = *postparent;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_setattr (cs->vol, &nfu, &cs->resolvedloc, &cs->stbuf,
+ ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,&cs->stbuf,
cs->setattr_valid, nfs3svc_mkdir_setattr_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -2294,10 +2297,10 @@ nfs3_mkdir_resume (void *carg)
if (gf_attr_mode_set (cs->setattr_valid)) {
cs->setattr_valid &= ~GF_SET_ATTR_MODE;
- ret = nfs_mkdir (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_mkdir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
cs->mode, nfs3svc_mkdir_cbk, cs);
} else
- ret = nfs_mkdir (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_mkdir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
cs->mode, nfs3svc_mkdir_cbk, cs);
if (ret < 0)
@@ -2445,8 +2448,8 @@ nfs3_symlink_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_new_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_symlink (cs->vol, &nfu, cs->pathname, &cs->resolvedloc,
- nfs3svc_symlink_cbk, cs);
+ ret = nfs_symlink (cs->nfsx, cs->vol, &nfu, cs->pathname,
+ &cs->resolvedloc, nfs3svc_symlink_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -2612,7 +2615,7 @@ nfs3svc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs->preparent = *preparent;
cs->postparent = *postparent;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_setattr (cs->vol, &nfu, &cs->resolvedloc, &cs->stbuf,
+ ret = nfs_setattr (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,&cs->stbuf,
cs->setattr_valid, nfs3svc_mknod_setattr_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -2650,11 +2653,11 @@ nfs3_mknod_device (nfs3_call_state_t *cs)
if (gf_attr_mode_set (cs->setattr_valid)) {
cs->setattr_valid &= ~GF_SET_ATTR_MODE;
mode |= cs->mode;
- ret = nfs_mknod (cs->vol, &nfu, &cs->resolvedloc, mode, devnum,
- nfs3svc_mknod_cbk, cs);
+ ret = nfs_mknod (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ mode, devnum, nfs3svc_mknod_cbk, cs);
} else
- ret = nfs_mknod (cs->vol, &nfu, &cs->resolvedloc, mode, devnum,
- nfs3svc_mknod_cbk, cs);
+ ret = nfs_mknod (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ mode, devnum, nfs3svc_mknod_cbk, cs);
return ret;
}
@@ -2674,12 +2677,11 @@ nfs3_mknod_fifo (nfs3_call_state_t *cs)
if (gf_attr_mode_set (cs->setattr_valid)) {
cs->setattr_valid &= ~GF_SET_ATTR_MODE;
mode |= cs->mode;
- ret = nfs_mknod (cs->vol, &nfu, &cs->resolvedloc, mode, 0,
- nfs3svc_mknod_cbk, cs);
+ ret = nfs_mknod (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ mode, 0, nfs3svc_mknod_cbk, cs);
} else
- ret = nfs_mknod (cs->vol, &nfu, &cs->resolvedloc, mode, 0,
- nfs3svc_mknod_cbk, cs);
-
+ ret = nfs_mknod (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ mode, 0, nfs3svc_mknod_cbk, cs);
return ret;
}
@@ -2886,10 +2888,10 @@ __nfs3_remove (nfs3_call_state_t *cs)
type = cs->resolvedloc.inode->ia_type;
nfs_request_user_init (&nfu, cs->req);
if (IA_ISDIR (type))
- ret = nfs_rmdir (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_rmdir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_remove_cbk, cs);
else
- ret = nfs_unlink (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_unlink (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_remove_cbk, cs);
return ret;
@@ -3048,7 +3050,8 @@ nfs3_rmdir_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_rmdir (cs->vol, &nfu, &cs->resolvedloc, nfs3svc_rmdir_cbk,cs);
+ ret = nfs_rmdir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3svc_rmdir_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -3197,7 +3200,7 @@ nfs3_rename_resume_dst (void *carg)
nfs3_check_new_fh_resolve_status (cs, stat, nfs3err);
cs->parent = cs->resolvefh;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_rename (cs->vol, &nfu, &cs->oploc, &cs->resolvedloc,
+ ret = nfs_rename (cs->nfsx, cs->vol, &nfu, &cs->oploc, &cs->resolvedloc,
nfs3svc_rename_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -3394,7 +3397,7 @@ nfs3_link_resume_lnk (void *carg)
nfs3_check_new_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_link (cs->vol, &nfu, &cs->oploc, &cs->resolvedloc,
+ ret = nfs_link (cs->nfsx, cs->vol, &nfu, &cs->oploc, &cs->resolvedloc,
nfs3svc_link_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -3629,7 +3632,8 @@ nfs3svc_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs->operrno = op_errno;
list_splice_init (&entries->list, &cs->entries.list);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_fstat (cs->vol, &nfu, cs->fd, nfs3svc_readdir_fstat_cbk, cs);
+ ret = nfs_fstat (cs->nfsx, cs->vol, &nfu, cs->fd,
+ nfs3svc_readdir_fstat_cbk, cs);
if (ret < 0) {
op_ret = -1;
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -3671,8 +3675,8 @@ nfs3_readdir_process (nfs3_call_state_t *cs)
return ret;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_readdirp (cs->vol, &nfu, cs->fd, cs->dircount, cs->cookie,
- nfs3svc_readdir_cbk, cs);
+ ret = nfs_readdirp (cs->nfsx, cs->vol, &nfu, cs->fd, cs->dircount,
+ cs->cookie, nfs3svc_readdir_cbk, cs);
return ret;
}
@@ -3926,8 +3930,8 @@ nfs3_fsstat_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
*/
cs->fsstat = *buf;
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc, nfs3_fsstat_stat_cbk,
- cs);
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3_fsstat_stat_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -3958,7 +3962,7 @@ nfs3_fsstat_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
/* First, we need to get the statvfs for the subvol */
- ret = nfs_statfs (cs->vol, &nfu, &cs->resolvedloc,
+ ret = nfs_statfs (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3_fsstat_statfs_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -4101,7 +4105,8 @@ nfs3_fsinfo_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc,nfs3svc_fsinfo_cbk, cs);
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3svc_fsinfo_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
@@ -4239,8 +4244,8 @@ nfs3_pathconf_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_stat (cs->vol, &nfu, &cs->resolvedloc, nfs3svc_pathconf_cbk,
- cs);
+ ret = nfs_stat (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
+ nfs3svc_pathconf_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);
nfs3err:
@@ -4375,7 +4380,8 @@ nfs3_commit_resume (void *carg)
cs = (nfs3_call_state_t *)carg;
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
nfs_request_user_init (&nfu, cs->req);
- ret = nfs_fsync (cs->vol, &nfu, cs->fd, 0, nfs3svc_commit_cbk, cs);
+ ret = nfs_fsync (cs->nfsx, cs->vol, &nfu, cs->fd, 0,
+ nfs3svc_commit_cbk, cs);
if (ret < 0)
stat = nfs3_errno_to_nfsstat3 (-ret);