summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src
diff options
context:
space:
mode:
authorVikas Gorur <vikas@zresearch.com>2009-03-12 16:21:51 +0530
committerAnand V. Avati <avati@amp.gluster.com>2009-03-12 16:29:45 +0530
commit7af8d8edbd8554235348e0f54348edf222c0b46e (patch)
tree21333449bf86e3481e8bc4197d17f69472398ef9 /xlators/protocol/server/src
parent31c817836c9c56eca1441b3b6f8b83db41c67f94 (diff)
Add extra 'volume' parameter to inodelk/entrylk calls
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/protocol/server/src')
-rw-r--r--xlators/protocol/server/src/server-helpers.c19
-rw-r--r--xlators/protocol/server/src/server-helpers.h4
-rw-r--r--xlators/protocol/server/src/server-protocol.c54
-rw-r--r--xlators/protocol/server/src/server-protocol.h2
4 files changed, 57 insertions, 22 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index ebe00829f4a..1fa400d5fab 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -223,6 +223,7 @@ server_copy_frame (call_frame_t *frame)
int32_t
gf_add_locker (struct _lock_table *table,
+ const char *volume,
loc_t *loc,
fd_t *fd,
pid_t pid)
@@ -239,6 +240,8 @@ gf_add_locker (struct _lock_table *table,
}
INIT_LIST_HEAD (&new->lockers);
+ new->volume = strdup (volume);
+
if (fd == NULL) {
loc_copy (&new->loc, loc);
dir = S_ISDIR (new->loc.inode->st_mode);
@@ -263,6 +266,7 @@ out:
int32_t
gf_del_locker (struct _lock_table *table,
+ const char *volume,
loc_t *loc,
fd_t *fd,
pid_t pid)
@@ -292,12 +296,14 @@ gf_del_locker (struct _lock_table *table,
list_for_each_entry_safe (locker, tmp, head, lockers) {
if (locker->fd &&
fd &&
- (locker->fd == fd) && (locker->pid == pid)) {
+ (locker->fd == fd) && (locker->pid == pid)
+ && !strcmp (locker->volume, volume)) {
list_move_tail (&locker->lockers, &del);
} else if (locker->loc.inode &&
loc &&
(locker->loc.inode == loc->inode) &&
- (locker->pid == pid)) {
+ (locker->pid == pid)
+ && !strcmp (locker->volume, volume)) {
list_move_tail (&locker->lockers, &del);
}
}
@@ -314,6 +320,7 @@ gf_del_locker (struct _lock_table *table,
else
loc_wipe (&locker->loc);
+ free (locker->volume);
free (locker);
}
@@ -453,16 +460,20 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
STACK_WIND (tmp_frame, server_nop_cbk,
bound_xl,
bound_xl->fops->finodelk,
+ locker->volume,
locker->fd, F_SETLK, &flock);
fd_unref (locker->fd);
} else {
STACK_WIND (tmp_frame, server_nop_cbk,
bound_xl,
bound_xl->fops->inodelk,
+ locker->volume,
&(locker->loc), F_SETLK, &flock);
loc_wipe (&locker->loc);
}
+ free (locker->volume);
+
list_del_init (&locker->lockers);
free (locker);
}
@@ -479,6 +490,7 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
STACK_WIND (tmp_frame, server_nop_cbk,
bound_xl,
bound_xl->fops->fentrylk,
+ locker->volume,
locker->fd, NULL,
ENTRYLK_UNLOCK, ENTRYLK_WRLCK);
fd_unref (locker->fd);
@@ -486,11 +498,14 @@ server_connection_destroy (xlator_t *this, server_connection_t *conn)
STACK_WIND (tmp_frame, server_nop_cbk,
bound_xl,
bound_xl->fops->entrylk,
+ locker->volume,
&(locker->loc), NULL,
ENTRYLK_UNLOCK, ENTRYLK_WRLCK);
loc_wipe (&locker->loc);
}
+ free (locker->volume);
+
list_del_init (&locker->lockers);
free (locker);
}
diff --git a/xlators/protocol/server/src/server-helpers.h b/xlators/protocol/server/src/server-helpers.h
index 3fea9f66776..eb26de84f86 100644
--- a/xlators/protocol/server/src/server-helpers.h
+++ b/xlators/protocol/server/src/server-helpers.h
@@ -60,13 +60,13 @@ void free_state (server_state_t *state);
void server_loc_wipe (loc_t *loc);
int32_t
-gf_add_locker (struct _lock_table *table,
+gf_add_locker (struct _lock_table *table, const char *volume,
loc_t *loc,
fd_t *fd,
pid_t pid);
int32_t
-gf_del_locker (struct _lock_table *table,
+gf_del_locker (struct _lock_table *table, const char *volume,
loc_t *loc,
fd_t *fd,
pid_t pid);
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 0a3e3e0110b..1153a545100 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -362,10 +362,10 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie,
if (op_ret >= 0) {
if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn->ltable,
+ gf_del_locker (conn->ltable, state->volume,
&state->loc, NULL, frame->root->pid);
else
- gf_add_locker (conn->ltable,
+ gf_add_locker (conn->ltable, state->volume,
&state->loc, NULL, frame->root->pid);
} else if (op_errno != ENOSYS) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -409,11 +409,13 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie,
if (op_ret >= 0) {
if (state->flock.l_type == F_UNLCK)
- gf_del_locker (conn->ltable,
- NULL, state->fd, frame->root->pid);
+ gf_del_locker (conn->ltable, state->volume,
+ NULL, state->fd,
+ frame->root->pid);
else
- gf_add_locker (conn->ltable,
- NULL, state->fd, frame->root->pid);
+ gf_add_locker (conn->ltable, state->volume,
+ NULL, state->fd,
+ frame->root->pid);
} else if (op_errno != ENOSYS) {
gf_log (this->name, GF_LOG_DEBUG,
"%"PRId64": FINODELK %"PRId64" (%"PRId64") ==> %"PRId32" (%s)",
@@ -465,10 +467,10 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie,
if (op_ret >= 0) {
if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn->ltable,
+ gf_del_locker (conn->ltable, state->volume,
&state->loc, NULL, frame->root->pid);
else
- gf_add_locker (conn->ltable,
+ gf_add_locker (conn->ltable, state->volume,
&state->loc, NULL, frame->root->pid);
} else if (op_errno != ENOSYS) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -511,10 +513,10 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie,
if (op_ret >= 0) {
state = CALL_STATE(frame);
if (state->cmd == ENTRYLK_UNLOCK)
- gf_del_locker (conn->ltable,
+ gf_del_locker (conn->ltable, state->volume,
NULL, state->fd, frame->root->pid);
else
- gf_add_locker (conn->ltable,
+ gf_add_locker (conn->ltable, state->volume,
NULL, state->fd, frame->root->pid);
} else if (op_errno != ENOSYS) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -6024,7 +6026,7 @@ server_utimens (call_frame_t *frame,
int32_t
server_inodelk_resume (call_frame_t *frame,
xlator_t *this,
- loc_t *loc, int32_t cmd,
+ const char *volume, loc_t *loc, int32_t cmd,
struct flock *flock)
{
server_state_t *state = NULL;
@@ -6046,7 +6048,7 @@ server_inodelk_resume (call_frame_t *frame,
server_inodelk_cbk,
BOUND_XL(frame),
BOUND_XL(frame)->fops->inodelk,
- loc, cmd, flock);
+ volume, loc, cmd, flock);
return 0;
}
@@ -6062,6 +6064,7 @@ server_inodelk (call_frame_t *frame,
gf_fop_inodelk_req_t *req = NULL;
server_state_t *state = NULL;
size_t pathlen = 0;
+ size_t vollen = 0;
req = gf_param (hdr);
state = CALL_STATE(frame);
@@ -6082,8 +6085,10 @@ server_inodelk (call_frame_t *frame,
state->type = ntoh32 (req->type);
pathlen = STRLEN_0(req->path);
+ vollen = STRLEN_0(req->volume + vollen);
state->path = req->path;
+ state->volume = req->volume + vollen;
state->ino = ntoh64 (req->ino);
gf_flock_to_flock (&req->flock, &state->flock);
@@ -6107,7 +6112,8 @@ server_inodelk (call_frame_t *frame,
inodelk_stub = fop_inodelk_stub (frame,
server_inodelk_resume,
- &state->loc, state->cmd, &state->flock);
+ state->volume, &state->loc,
+ state->cmd, &state->flock);
if ((state->loc.parent == NULL) ||
(state->loc.inode == NULL)) {
@@ -6129,12 +6135,14 @@ server_finodelk (call_frame_t *frame,
gf_fop_finodelk_req_t *req = NULL;
server_state_t *state = NULL;
server_connection_t *conn = NULL;
-
+
conn = SERVER_CONNECTION(frame);
req = gf_param (hdr);
state = CALL_STATE(frame);
{
+ state->volume = req->volume;
+
state->fd_no = ntoh64 (req->fd);
if (state->fd_no >= 0)
state->fd = gf_fd_fdptr_get (conn->fdtable,
@@ -6188,7 +6196,7 @@ server_finodelk (call_frame_t *frame,
STACK_WIND (frame, server_finodelk_cbk,
BOUND_XL(frame),
BOUND_XL(frame)->fops->finodelk,
- state->fd, state->cmd, &state->flock);
+ state->volume, state->fd, state->cmd, &state->flock);
return 0;
}
@@ -6196,7 +6204,7 @@ server_finodelk (call_frame_t *frame,
int32_t
server_entrylk_resume (call_frame_t *frame,
xlator_t *this,
- loc_t *loc, const char *name,
+ const char *volume, loc_t *loc, const char *name,
entrylk_cmd cmd, entrylk_type type)
{
server_state_t *state = NULL;
@@ -6218,7 +6226,7 @@ server_entrylk_resume (call_frame_t *frame,
server_entrylk_cbk,
BOUND_XL(frame),
BOUND_XL(frame)->fops->entrylk,
- loc, name, cmd, type);
+ volume, loc, name, cmd, type);
return 0;
}
@@ -6242,6 +6250,7 @@ server_entrylk (call_frame_t *frame,
call_stub_t *entrylk_stub = NULL;
size_t pathlen = 0;
size_t namelen = 0;
+ size_t vollen = 0;
req = gf_param (hdr);
state = CALL_STATE(frame);
@@ -6254,6 +6263,9 @@ server_entrylk (call_frame_t *frame,
if (namelen)
state->name = req->name + pathlen;
+ vollen = STRLEN_0(req->volume + pathlen + namelen);
+ state->volume = req->volume + pathlen + namelen;
+
state->cmd = ntoh32 (req->cmd);
state->type = ntoh32 (req->type);
}
@@ -6264,6 +6276,7 @@ server_entrylk (call_frame_t *frame,
entrylk_stub = fop_entrylk_stub (frame,
server_entrylk_resume,
+ state->volume,
&state->loc, state->name, state->cmd,
state->type);
@@ -6287,6 +6300,7 @@ server_fentrylk (call_frame_t *frame,
gf_fop_fentrylk_req_t *req = NULL;
server_state_t *state = NULL;
size_t namelen = 0;
+ size_t vollen = 0;
server_connection_t *conn = NULL;
conn = SERVER_CONNECTION(frame);
@@ -6305,6 +6319,9 @@ server_fentrylk (call_frame_t *frame,
if (namelen)
state->name = req->name;
+
+ vollen = STRLEN_0(req->volume + namelen);
+ state->volume = req->volume + namelen;
}
if (state->fd == NULL) {
@@ -6324,7 +6341,8 @@ server_fentrylk (call_frame_t *frame,
STACK_WIND (frame, server_fentrylk_cbk,
BOUND_XL(frame),
BOUND_XL(frame)->fops->fentrylk,
- state->fd, state->name, state->cmd, state->type);
+ state->volume, state->fd, state->name,
+ state->cmd, state->type);
return 0;
}
diff --git a/xlators/protocol/server/src/server-protocol.h b/xlators/protocol/server/src/server-protocol.h
index 30ccb91e756..f00b584fb25 100644
--- a/xlators/protocol/server/src/server-protocol.h
+++ b/xlators/protocol/server/src/server-protocol.h
@@ -42,6 +42,7 @@ typedef struct _server_state server_state_t;
struct _locker {
struct list_head lockers;
+ char *volume;
loc_t loc;
fd_t *fd;
pid_t pid;
@@ -138,6 +139,7 @@ struct _server_state {
struct flock flock;
struct timespec tv[2];
char *resolved;
+ const char *volume;
};