summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-09-03 14:00:32 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-04 01:45:29 -0700
commit8a5e677bbd8bdec555e6699ec5b8b1a66fe8096d (patch)
tree13039297cdc0818f9a817dea9459604476ca6ec6 /xlators/mount/fuse/src
parenta7fd7dbed9b995c173664bcadf3d2e5b6131e4ea (diff)
gfid: set request gfids for new entries in fuse
Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Anand V. Avati <avati@blackhole.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/mount/fuse/src')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c34
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h3
-rw-r--r--xlators/mount/fuse/src/fuse-resolve.c25
3 files changed, 54 insertions, 8 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 069135d57b3..cd2df760771 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -240,8 +240,6 @@ fuse_lookup_resume (fuse_state_t *state)
if (!state->loc.inode)
state->loc.inode = inode_new (state->loc.parent->table);
- state->dict = dict_new ();
-
FUSE_FOP (state, fuse_lookup_cbk, GF_FOP_LOOKUP,
lookup, &state->loc, state->dict);
}
@@ -255,6 +253,8 @@ fuse_lookup (xlator_t *this, fuse_in_header_t *finh, void *msg)
GET_STATE (this, finh, state);
+ uuid_generate (state->gfid);
+
ret = fuse_loc_fill (&state->loc, state, 0, finh->nodeid, name);
if (ret < 0) {
@@ -459,6 +459,8 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
GET_STATE (this, finh, state);
if (finh->nodeid == 1) {
+ state->gfid[15] = 1;
+
ret = fuse_loc_fill (&state->loc, state, finh->nodeid, 0, NULL);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -469,7 +471,7 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
return;
}
- state->dict = dict_new ();
+ fuse_gfid_set (state);
FUSE_FOP (state, fuse_root_lookup_cbk, GF_FOP_LOOKUP,
lookup, &state->loc, state->dict);
@@ -501,6 +503,10 @@ fuse_getattr (xlator_t *this, fuse_in_header_t *finh, void *msg)
free_fuse_state (state);
return;
}
+
+ if (state->fd)
+ fd_unref (state->fd);
+
state->fd = NULL;
}
@@ -1019,7 +1025,7 @@ fuse_mknod_resume (fuse_state_t *state)
state->loc.path);
FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKNOD,
- mknod, &state->loc, state->mode, state->rdev, NULL);
+ mknod, &state->loc, state->mode, state->rdev, state->dict);
}
@@ -1040,6 +1046,9 @@ fuse_mknod (xlator_t *this, fuse_in_header_t *finh, void *msg)
#endif
GET_STATE (this, finh, state);
+
+ uuid_generate (state->gfid);
+
ret = fuse_loc_fill (&state->loc, state, 0, finh->nodeid, name);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -1079,7 +1088,7 @@ fuse_mkdir_resume (fuse_state_t *state)
state->loc.path);
FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_MKDIR,
- mkdir, &state->loc, state->mode, NULL);
+ mkdir, &state->loc, state->mode, state->dict);
}
static void
@@ -1092,6 +1101,9 @@ fuse_mkdir (xlator_t *this, fuse_in_header_t *finh, void *msg)
int32_t ret = -1;
GET_STATE (this, finh, state);
+
+ uuid_generate (state->gfid);
+
ret = fuse_loc_fill (&state->loc, state, 0, finh->nodeid, name);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -1213,7 +1225,7 @@ fuse_symlink_resume (fuse_state_t *state)
state->loc.path, state->name);
FUSE_FOP (state, fuse_newentry_cbk, GF_FOP_SYMLINK,
- symlink, state->name, &state->loc, NULL);
+ symlink, state->name, &state->loc, state->dict);
}
static void
@@ -1226,6 +1238,9 @@ fuse_symlink (xlator_t *this, fuse_in_header_t *finh, void *msg)
int32_t ret = -1;
GET_STATE (this, finh, state);
+
+ uuid_generate (state->gfid);
+
ret = fuse_loc_fill (&state->loc, state, 0, finh->nodeid, name);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -1520,7 +1535,7 @@ fuse_create_resume (fuse_state_t *state)
FUSE_FOP (state, fuse_create_cbk, GF_FOP_CREATE,
create, &state->loc, state->flags, state->mode,
- fd, NULL);
+ fd, state->dict);
}
@@ -1546,6 +1561,8 @@ fuse_create (xlator_t *this, fuse_in_header_t *finh, void *msg)
GET_STATE (this, finh, state);
+ uuid_generate (state->gfid);
+
ret = fuse_loc_fill (&state->loc, state, 0, finh->nodeid, name);
if (ret < 0) {
gf_log ("glusterfs-fuse", GF_LOG_WARNING,
@@ -2915,6 +2932,7 @@ fuse_first_lookup (xlator_t *this)
dict_t *dict = NULL;
struct fuse_first_lookup stub;
uuid_t gfid;
+ int ret;
priv = this->private;
@@ -2938,7 +2956,7 @@ fuse_first_lookup (xlator_t *this)
memset (gfid, 0, 16);
gfid[15] = 1;
-
+ ret = dict_set_static_bin (dict, "gfid-req", gfid, 16);
STACK_WIND (frame, fuse_first_lookup_cbk, xl, xl->fops->lookup,
&loc, dict);
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index 547cc895268..53a2cc59814 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -267,6 +267,8 @@ typedef struct {
struct iatt attr;
struct flock lk_lock;
struct iovec vector;
+
+ uuid_t gfid;
} fuse_state_t;
typedef void (*fuse_resume_fn_t) (fuse_state_t *state);
@@ -285,4 +287,5 @@ inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse);
int fuse_resolve_and_resume (fuse_state_t *state, fuse_resume_fn_t fn);
int is_gf_log_command (xlator_t *this, const char *name, char *value);
int send_fuse_err (xlator_t *this, fuse_in_header_t *finh, int error);
+int fuse_gfid_set (fuse_state_t *state);
#endif /* _GF_FUSE_BRIDGE_H_ */
diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c
index 77a55cd701f..3bdc0b9293e 100644
--- a/xlators/mount/fuse/src/fuse-resolve.c
+++ b/xlators/mount/fuse/src/fuse-resolve.c
@@ -689,11 +689,36 @@ gf_resolve_all (fuse_state_t *state)
int
+fuse_gfid_set (fuse_state_t *state)
+{
+ int ret = 0;
+
+ if (uuid_is_null (state->gfid))
+ goto out;
+
+ if (!state->dict)
+ state->dict = dict_new ();
+
+ if (!state->dict) {
+ ret = -1;
+ goto out;
+ }
+
+ ret = dict_set_static_bin (state->dict, "gfid-req",
+ state->gfid, sizeof (state->gfid));
+out:
+ return ret;
+}
+
+
+int
fuse_resolve_and_resume (fuse_state_t *state, fuse_resume_fn_t fn)
{
xlator_t *inode_xl = NULL;
xlator_t *active_xl = NULL;
+ fuse_gfid_set (state);
+
state->resume_fn = fn;
active_xl = fuse_active_subvol (state->this);