summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-fops.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-09-14 02:39:11 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-14 02:32:03 -0700
commit9ff89d858075d8f916c76a9ade84b9844da4d23e (patch)
tree535ea0f8456078a74eeeb920edc646cf58c9beee /xlators/nfs/server/src/nfs-fops.c
parent2152dae595438b919fbcb7349d15ead139e120d8 (diff)
nfs,nfs3,mnt3: Transition fh resolution to gfid
Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'xlators/nfs/server/src/nfs-fops.c')
-rw-r--r--xlators/nfs/server/src/nfs-fops.c61
1 files changed, 56 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c
index 544f6c9e6b1..3f342710b25 100644
--- a/xlators/nfs/server/src/nfs-fops.c
+++ b/xlators/nfs/server/src/nfs-fops.c
@@ -71,6 +71,9 @@ nfs_fop_local_wipe (xlator_t *nfsx, struct nfs_fop_local *l)
if (l->newparent)
inode_unref (l->newparent);
+ if (l->dictgfid)
+ dict_unref (l->dictgfid);
+
mem_put (nfs->foppool, l);
return;
@@ -222,6 +225,49 @@ err:
} \
} while (0) \
+dict_t *
+nfs_gfid_dict ()
+{
+ uuid_t newgfid = {0, };
+ char *dyngfid = NULL;
+ dict_t *dictgfid = NULL;
+ int ret = -1;
+
+ dyngfid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_char);
+ uuid_generate (newgfid);
+ memcpy (dyngfid, newgfid, sizeof (uuid_t));
+
+ dictgfid = dict_new ();
+ if (!dictgfid) {
+ gf_log (GF_NFS, GF_LOG_ERROR, "Failed to create gfid dict");
+ goto out;
+ }
+
+ ret = dict_set_bin (dictgfid, "gfid-req", dyngfid, sizeof (uuid_t));
+ if (ret < 0) {
+ dict_unref (dictgfid);
+ dictgfid = NULL;
+ }
+
+out:
+ return dictgfid;
+}
+
+#define nfs_fop_gfid_setup(nflcl, retval, erlbl) \
+ do { \
+ if (nflcl) { \
+ (nflcl)->dictgfid = nfs_gfid_dict (); \
+ \
+ if (!((nflcl)->dictgfid)) { \
+ retval = -EFAULT; \
+ goto erlbl; \
+ } \
+ } \
+ } while (0) \
+
+
+
+
/* Fops Layer Explained
* The fops layer has three types of functions. They can all be identified by
* their names. Here are the three patterns:
@@ -281,9 +327,10 @@ nfs_fop_lookup (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc,
nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err);
nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, loc);
+ nfs_fop_gfid_setup (nfl, ret, err);
STACK_WIND_COOKIE (frame, nfs_fop_lookup_cbk, xl, xl,
- xl->fops->lookup, loc, NULL);
+ xl->fops->lookup, loc, nfl->dictgfid);
ret = 0;
err:
@@ -603,9 +650,10 @@ nfs_fop_create (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err);
nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
+ nfs_fop_gfid_setup (nfl, ret, err);
STACK_WIND_COOKIE (frame, nfs_fop_create_cbk, xl, xl, xl->fops->create,
- pathloc, flags, mode, fd, NULL);
+ pathloc, flags, mode, fd, nfl->dictgfid);
ret = 0;
err:
@@ -700,9 +748,10 @@ nfs_fop_mkdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err);
nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
+ nfs_fop_gfid_setup (nfl, ret, err);
STACK_WIND_COOKIE (frame, nfs_fop_mkdir_cbk, xl, xl, xl->fops->mkdir,
- pathloc, mode, NULL);
+ pathloc, mode, nfl->dictgfid);
ret = 0;
err:
if (ret < 0) {
@@ -747,9 +796,10 @@ nfs_fop_symlink (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, char *target,
nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err);
nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
+ nfs_fop_gfid_setup (nfl, ret, err);
STACK_WIND_COOKIE (frame, nfs_fop_symlink_cbk, xl, xl,
- xl->fops->symlink, target, pathloc, NULL);
+ xl->fops->symlink, target, pathloc, nfl->dictgfid);
ret = 0;
err:
if (ret < 0) {
@@ -841,9 +891,10 @@ nfs_fop_mknod (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
nfs_fop_handle_frame_create (frame, nfsx, nfu, ret, err);
nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err);
nfs_fop_save_root_ino (nfl, pathloc);
+ nfs_fop_gfid_setup (nfl, ret, err);
STACK_WIND_COOKIE (frame, nfs_fop_mknod_cbk, xl, xl, xl->fops->mknod,
- pathloc, mode, dev, NULL);
+ pathloc, mode, dev, nfl->dictgfid);
ret = 0;
err:
if (ret < 0) {