Patchwork [BUG:1410,12/12] nfs, mount3: Fix assumptions of this being child xl

login
register
Submitter Shehjar Tikoo
Date 2010-08-31 12:20:37
Message ID <1283257237-18659-12-git-send-email-shehjart@gluster.com>
Download mbox | patch
Permalink /patch/4427/
State Accepted
Delegated to: Anand Avati
Headers show

Comments

Shehjar Tikoo - 2010-08-31 12:20:37
From: Shehjar Tikoo <shehjart@gluster.com>

This is plain wrong. this must always be the xlator that receives the callback.
Use cookie to access the child subvolume on which the fop was issued.

Signed-off-by: Shehjar Tikoo <shehjart@gluster.com>
---
 xlators/nfs/server/src/mount3.c |   13 ++++++++-----
 xlators/nfs/server/src/nfs.c    |    2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

Patch

diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index ca94b25..2a7a36c 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -225,12 +225,14 @@  mnt3svc_lookup_mount_cbk (call_frame_t *frame, void  *cookie,
         int                     autharr[10];
         int                     autharrlen = 0;
         rpcsvc_t                *svc = NULL;
+        xlator_t                *mntxl = NULL;
 
         req = (rpcsvc_request_t *)frame->local;
 
         if (!req)
                 return -1;
 
+        mntxl = (xlator_t *)cookie;
         ms = (struct mount3_state *)nfs_rpcsvc_request_program_private (req);
         if (!ms) {
                 gf_log (GF_MNT, GF_LOG_ERROR, "mount state not found");
@@ -244,13 +246,13 @@  mnt3svc_lookup_mount_cbk (call_frame_t *frame, void  *cookie,
         if (status != MNT3_OK)
                 goto xmit_res;
 
-        fh = nfs3_fh_build_root_fh (ms->nfsx->children, this);
-        mnt3svc_update_mountlist (ms, req, this->name);
+        fh = nfs3_fh_build_root_fh (ms->nfsx->children, mntxl);
+        mnt3svc_update_mountlist (ms, req, mntxl->name);
 xmit_res:
         gf_log (GF_MNT, GF_LOG_DEBUG, "Mount reply status: %d", status);
         if (op_ret == 0) {
                 svc = nfs_rpcsvc_request_service (req);
-                autharrlen = nfs_rpcsvc_auth_array (svc, this->name, autharr,
+                autharrlen = nfs_rpcsvc_auth_array (svc, mntxl->name, autharr,
                                                     10);
         }
 
@@ -480,9 +482,10 @@  mnt3_resolve_subdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
         int                     autharrlen = 0;
         rpcsvc_t                *svc = NULL;
         mountres3               res = {0, };
+        xlator_t                *mntxl = NULL;
 
         mres = frame->local;
-
+        mntxl = (xlator_t *)cookie;
         if (op_ret == -1) {
                 mntstat = mnt3svc_errno_to_mnterr (op_errno);
                 goto err;
@@ -509,7 +512,7 @@  err:
                 gf_log (GF_MNT, GF_LOG_DEBUG, "Mount reply status: %d",
                         mntstat);
                 svc = nfs_rpcsvc_request_service (mres->req);
-                autharrlen = nfs_rpcsvc_auth_array (svc, this->name, autharr,
+                autharrlen = nfs_rpcsvc_auth_array (svc, mntxl->name, autharr,
                                                     10);
 
                 res = mnt3svc_set_mountres3 (mntstat, &fh, autharr, autharrlen);
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index 033a60b..8f3c8b2 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -233,7 +233,7 @@  nfs_start_subvol_lookup_cbk (call_frame_t *frame, void *cookie,
                 goto err;
         }
 
-        gf_log (GF_NFS, GF_LOG_TRACE, "Started %s", this->name);
+        gf_log (GF_NFS, GF_LOG_TRACE, "Started %s", ((xlator_t *)cookie)->name);
 err:
         return 0;
 }