diff options
author | Vikas Gorur <vikas@zresearch.com> | 2009-03-12 16:21:51 +0530 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-03-12 16:29:45 +0530 |
commit | 7af8d8edbd8554235348e0f54348edf222c0b46e (patch) | |
tree | 21333449bf86e3481e8bc4197d17f69472398ef9 | |
parent | 31c817836c9c56eca1441b3b6f8b83db41c67f94 (diff) |
Add extra 'volume' parameter to inodelk/entrylk calls
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
28 files changed, 278 insertions, 150 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 92301a2ddb8..8a090ba83e9 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -1731,7 +1731,7 @@ out: call_stub_t * fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { call_stub_t *stub = NULL; @@ -1744,6 +1744,9 @@ fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, stub->args.inodelk.fn = fn; + if (volume) + stub->args.inodelk.volume = strdup (volume); + loc_copy (&stub->args.inodelk.loc, loc); stub->args.inodelk.cmd = cmd; stub->args.inodelk.lock = *lock; @@ -1774,7 +1777,7 @@ fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, call_stub_t * fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { call_stub_t *stub = NULL; @@ -1789,6 +1792,10 @@ fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, if (fd) stub->args.finodelk.fd = fd_ref (fd); + + if (volume) + stub->args.finodelk.volume = strdup (volume); + stub->args.finodelk.cmd = cmd; stub->args.finodelk.lock = *lock; @@ -1819,7 +1826,7 @@ fop_finodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, call_stub_t * fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, - loc_t *loc, const char *name, + const char *volume, loc_t *loc, const char *name, entrylk_cmd cmd, entrylk_type type) { call_stub_t *stub = NULL; @@ -1832,6 +1839,10 @@ fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, return NULL; stub->args.entrylk.fn = fn; + + if (volume) + stub->args.entrylk.volume = strdup (volume); + loc_copy (&stub->args.entrylk.loc, loc); stub->args.entrylk.cmd = cmd; @@ -1865,7 +1876,7 @@ fop_entrylk_cbk_stub (call_frame_t *frame, fop_entrylk_cbk_t fn, call_stub_t * fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn, - fd_t *fd, const char *name, + const char *volume, fd_t *fd, const char *name, entrylk_cmd cmd, entrylk_type type) { call_stub_t *stub = NULL; @@ -1878,7 +1889,10 @@ fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn, return NULL; stub->args.fentrylk.fn = fn; - + + if (volume) + stub->args.fentrylk.volume = strdup (volume); + if (fd) stub->args.fentrylk.fd = fd_ref (fd); stub->args.fentrylk.cmd = cmd; @@ -2536,6 +2550,7 @@ call_resume_wind (call_stub_t *stub) { stub->args.inodelk.fn (stub->frame, stub->frame->this, + stub->args.inodelk.volume, &stub->args.inodelk.loc, stub->args.inodelk.cmd, &stub->args.inodelk.lock); @@ -2546,6 +2561,7 @@ call_resume_wind (call_stub_t *stub) { stub->args.finodelk.fn (stub->frame, stub->frame->this, + stub->args.finodelk.volume, stub->args.finodelk.fd, stub->args.finodelk.cmd, &stub->args.finodelk.lock); @@ -2556,6 +2572,7 @@ call_resume_wind (call_stub_t *stub) { stub->args.entrylk.fn (stub->frame, stub->frame->this, + stub->args.entrylk.volume, &stub->args.entrylk.loc, stub->args.entrylk.name, stub->args.entrylk.cmd, @@ -2567,6 +2584,7 @@ call_resume_wind (call_stub_t *stub) { stub->args.fentrylk.fn (stub->frame, stub->frame->this, + stub->args.fentrylk.volume, stub->args.fentrylk.fd, stub->args.fentrylk.name, stub->args.fentrylk.cmd, @@ -3744,17 +3762,26 @@ call_stub_destroy_wind (call_stub_t *stub) case GF_FOP_INODELK: { + if (stub->args.inodelk.volume) + FREE (stub->args.inodelk.volume); + loc_wipe (&stub->args.inodelk.loc); break; } case GF_FOP_FINODELK: { + if (stub->args.finodelk.volume) + FREE (stub->args.finodelk.volume); + if (stub->args.finodelk.fd) fd_unref (stub->args.finodelk.fd); break; } case GF_FOP_ENTRYLK: { + if (stub->args.entrylk.volume) + FREE (stub->args.entrylk.volume); + if (stub->args.entrylk.name) FREE (stub->args.entrylk.name); loc_wipe (&stub->args.entrylk.loc); @@ -3762,10 +3789,13 @@ call_stub_destroy_wind (call_stub_t *stub) } case GF_FOP_FENTRYLK: { + if (stub->args.fentrylk.volume) + FREE (stub->args.fentrylk.volume); + if (stub->args.fentrylk.name) FREE (stub->args.fentrylk.name); - if (stub->args.fentrylk.fd) + if (stub->args.fentrylk.fd) fd_unref (stub->args.fentrylk.fd); break; } diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index d80ddd1733b..a970897bbac 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -487,6 +487,7 @@ typedef struct { /* inodelk */ struct { fop_inodelk_t fn; + const char *volume; loc_t loc; int32_t cmd; struct flock lock; @@ -500,6 +501,7 @@ typedef struct { /* finodelk */ struct { fop_finodelk_t fn; + const char *volume; fd_t *fd; int32_t cmd; struct flock lock; @@ -514,6 +516,7 @@ typedef struct { struct { fop_entrylk_t fn; loc_t loc; + const char *volume; const char *name; entrylk_cmd cmd; entrylk_type type; @@ -528,6 +531,7 @@ typedef struct { struct { fop_fentrylk_t fn; fd_t *fd; + const char *volume; const char *name; entrylk_cmd cmd; entrylk_type type; @@ -1086,20 +1090,22 @@ fop_lk_cbk_stub (call_frame_t *frame, call_stub_t * fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, - loc_t *loc, int32_t cmd, struct flock *lock); + const char *volume, loc_t *loc, int32_t cmd, + struct flock *lock); call_stub_t * fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, - fd_t *fd, int32_t cmd, struct flock *lock); + const char *volume, fd_t *fd, int32_t cmd, + struct flock *lock); call_stub_t * fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type); call_stub_t * fop_fentrylk_stub (call_frame_t *frame, fop_fentrylk_t fn, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type); call_stub_t * diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index dc290863395..724f5a79225 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -1199,13 +1199,14 @@ default_inodelk_cbk (call_frame_t *frame, void *cookie, int32_t default_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, + struct flock *lock) { STACK_WIND (frame, default_inodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, - loc, cmd, lock); + volume, loc, cmd, lock); return 0; } @@ -1222,13 +1223,13 @@ default_finodelk_cbk (call_frame_t *frame, void *cookie, int32_t default_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { STACK_WIND (frame, default_finodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, - fd, cmd, lock); + volume, fd, cmd, lock); return 0; } @@ -1244,13 +1245,13 @@ default_entrylk_cbk (call_frame_t *frame, void *cookie, int32_t default_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { STACK_WIND (frame, default_entrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; } @@ -1265,13 +1266,13 @@ default_fentrylk_cbk (call_frame_t *frame, void *cookie, int32_t default_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { STACK_WIND (frame, default_fentrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); return 0; } diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 61522230075..98e15c5bf2a 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -230,17 +230,19 @@ int32_t default_lk (call_frame_t *frame, struct flock *flock); int32_t default_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *flock); + const char *volume, loc_t *loc, int32_t cmd, + struct flock *flock); int32_t default_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *flock); + const char *volume, fd_t *fd, int32_t cmd, + struct flock *flock); int32_t default_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type); int32_t default_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type); int32_t default_readdir (call_frame_t *frame, diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 35f172ab7b4..4bb379b2f9b 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -557,6 +557,7 @@ typedef struct { uint32_t type; struct gf_flock flock; char path[0]; + char volume[0]; } __attribute__((packed)) gf_fop_inodelk_req_t; typedef struct { } __attribute__((packed)) gf_fop_inodelk_rsp_t; @@ -567,6 +568,7 @@ typedef struct { uint32_t cmd; uint32_t type; struct gf_flock flock; + char volume[0]; } __attribute__((packed)) gf_fop_finodelk_req_t; typedef struct { } __attribute__((packed)) gf_fop_finodelk_rsp_t; @@ -578,6 +580,7 @@ typedef struct { uint64_t namelen; char path[0]; char name[0]; + char volume[0]; } __attribute__((packed)) gf_fop_entrylk_req_t; typedef struct { } __attribute__((packed)) gf_fop_entrylk_rsp_t; @@ -589,6 +592,7 @@ typedef struct { uint32_t type; uint64_t namelen; char name[0]; + char volume[0]; } __attribute__((packed)) gf_fop_fentrylk_req_t; typedef struct { } __attribute__((packed)) gf_fop_fentrylk_rsp_t; diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index a5a20e8b28a..2f35643c34c 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -626,23 +626,27 @@ typedef int32_t (*fop_lk_t) (call_frame_t *frame, typedef int32_t (*fop_inodelk_t) (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock); typedef int32_t (*fop_finodelk_t) (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock); typedef int32_t (*fop_entrylk_t) (call_frame_t *frame, - xlator_t *this, loc_t *loc, + xlator_t *this, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type); typedef int32_t (*fop_fentrylk_t) (call_frame_t *frame, - xlator_t *this, fd_t *fd, + xlator_t *this, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index f418085e53e..aea31a748f5 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -504,6 +504,7 @@ sh_missing_entries_finish (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, sh_missing_entries_unlck_cbk, priv->children[i], priv->children[i]->fops->entrylk, + this->name, &sh->parent_loc, local->loc.name, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); @@ -1008,6 +1009,7 @@ afr_self_heal_missing_entries (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, sh_missing_entries_lk_cbk, priv->children[i], priv->children[i]->fops->entrylk, + this->name, &sh->parent_loc, local->loc.name, ENTRYLK_LOCK_NB, ENTRYLK_WRLCK); if (!--call_count) diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 674d2923f1c..775845fe6be 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -231,6 +231,7 @@ afr_sh_data_unlock (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->inodelk, + this->name, &local->loc, F_SETLK, &flock); if (!--call_count) break; @@ -995,6 +996,7 @@ afr_sh_data_lock (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->inodelk, + this->name, &local->loc, F_SETLK, &flock); if (!--call_count) break; diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index d5b6dff3cb4..e7431249fc3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -146,6 +146,7 @@ afr_sh_entry_unlock (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->entrylk, + this->name, &local->loc, NULL, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); if (!--call_count) @@ -2001,6 +2002,7 @@ afr_sh_entry_lock (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->entrylk, + this->name, &local->loc, NULL, ENTRYLK_LOCK_NB, ENTRYLK_WRLCK); if (!--call_count) diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 6c66f8704b0..de8fa1a3914 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -158,6 +158,7 @@ afr_sh_metadata_finish (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, afr_sh_metadata_unlck_cbk, priv->children[i], priv->children[i]->fops->inodelk, + this->name, &local->loc, F_SETLK, &flock); if (!--call_count) @@ -755,6 +756,7 @@ afr_sh_metadata_lock (call_frame_t *frame, xlator_t *this) (void *) (long) i, priv->children[i], priv->children[i]->fops->inodelk, + this->name, &local->loc, F_SETLK, &flock); if (!--call_count) diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 82c2ee3406f..0590b598405 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -309,12 +309,14 @@ afr_unlock (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, afr_unlock_common_cbk, priv->children[i], priv->children[i]->fops->finodelk, - local->fd, F_SETLK, &flock); + this->name, local->fd, + F_SETLK, &flock); } else { STACK_WIND (frame, afr_unlock_common_cbk, priv->children[i], priv->children[i]->fops->inodelk, - &local->loc, F_SETLK, &flock); + this->name, &local->loc, + F_SETLK, &flock); } break; @@ -324,6 +326,7 @@ afr_unlock (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, afr_unlock_common_cbk, priv->children[i], priv->children[i]->fops->entrylk, + this->name, &local->transaction.new_parent_loc, local->transaction.new_basename, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); @@ -337,14 +340,15 @@ afr_unlock (call_frame_t *frame, xlator_t *this) STACK_WIND (frame, afr_unlock_common_cbk, priv->children[i], priv->children[i]->fops->fentrylk, - local->fd, + this->name, local->fd, local->transaction.basename, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); } else { STACK_WIND (frame, afr_unlock_common_cbk, priv->children[i], priv->children[i]->fops->entrylk, - &local->transaction.parent_loc, + this->name, + &local->transaction.parent_loc, local->transaction.basename, ENTRYLK_UNLOCK, ENTRYLK_WRLCK); @@ -838,14 +842,16 @@ int afr_lock_rec (call_frame_t *frame, xlator_t *this, int child_index) (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->finodelk, - local->fd, F_SETLKW, &flock); + this->name, local->fd, + F_SETLKW, &flock); } else { STACK_WIND_COOKIE (frame, afr_lock_cbk, (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->inodelk, - &local->loc, F_SETLKW, &flock); + this->name, &local->loc, + F_SETLKW, &flock); } break; @@ -878,14 +884,14 @@ int afr_lock_rec (call_frame_t *frame, xlator_t *this, int child_index) (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->entrylk, - lower, lower_name, + this->name, lower, lower_name, ENTRYLK_LOCK, ENTRYLK_WRLCK); STACK_WIND_COOKIE (frame, afr_lock_cbk, (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->entrylk, - higher, higher_name, + this->name, higher, higher_name, ENTRYLK_LOCK, ENTRYLK_WRLCK); break; @@ -897,7 +903,7 @@ int afr_lock_rec (call_frame_t *frame, xlator_t *this, int child_index) (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->fentrylk, - local->fd, + this->name, local->fd, local->transaction.basename, ENTRYLK_LOCK, ENTRYLK_WRLCK); } else { @@ -905,7 +911,8 @@ int afr_lock_rec (call_frame_t *frame, xlator_t *this, int child_index) (void *) (long) child_index, priv->children[child_index], priv->children[child_index]->fops->entrylk, - &local->transaction.parent_loc, + this->name, + &local->transaction.parent_loc, local->transaction.basename, ENTRYLK_LOCK, ENTRYLK_WRLCK); } diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index acd7f8d0236..bd213b5326d 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -1173,8 +1173,8 @@ afr_inodelk_cbk (call_frame_t *frame, void *cookie, int32_t -afr_inodelk (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t cmd, struct flock *flock) +afr_inodelk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock) { afr_private_t *priv = NULL; afr_local_t *local = NULL; @@ -1208,7 +1208,7 @@ afr_inodelk (call_frame_t *frame, xlator_t *this, loc_t *loc, STACK_WIND (frame, afr_inodelk_cbk, priv->children[i], priv->children[i]->fops->inodelk, - loc, cmd, flock); + volume, loc, cmd, flock); if (!--call_count) break; @@ -1254,8 +1254,8 @@ afr_finodelk_cbk (call_frame_t *frame, void *cookie, int32_t -afr_finodelk (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t cmd, struct flock *flock) +afr_finodelk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock) { afr_private_t *priv = NULL; afr_local_t *local = NULL; @@ -1289,7 +1289,7 @@ afr_finodelk (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, afr_finodelk_cbk, priv->children[i], priv->children[i]->fops->finodelk, - fd, cmd, flock); + volume, fd, cmd, flock); if (!--call_count) break; @@ -1335,7 +1335,8 @@ afr_entrylk_cbk (call_frame_t *frame, void *cookie, int32_t -afr_entrylk (call_frame_t *frame, xlator_t *this, loc_t *loc, +afr_entrylk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { afr_private_t *priv = NULL; @@ -1370,7 +1371,7 @@ afr_entrylk (call_frame_t *frame, xlator_t *this, loc_t *loc, STACK_WIND (frame, afr_entrylk_cbk, priv->children[i], priv->children[i]->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); if (!--call_count) break; @@ -1417,7 +1418,8 @@ afr_fentrylk_cbk (call_frame_t *frame, void *cookie, int32_t -afr_fentrylk (call_frame_t *frame, xlator_t *this, fd_t *fd, +afr_fentrylk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { afr_private_t *priv = NULL; @@ -1452,7 +1454,7 @@ afr_fentrylk (call_frame_t *frame, xlator_t *this, fd_t *fd, STACK_WIND (frame, afr_fentrylk_cbk, priv->children[i], priv->children[i]->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); if (!--call_count) break; diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 6d97f8f7a4d..27bac7627f7 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -3163,7 +3163,7 @@ dht_inodelk_cbk (call_frame_t *frame, void *cookie, int32_t dht_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { xlator_t *subvol = NULL; int op_errno = -1; @@ -3198,7 +3198,7 @@ dht_inodelk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_inodelk_cbk, subvol, subvol->fops->inodelk, - loc, cmd, lock); + volume, loc, cmd, lock); return 0; @@ -3222,7 +3222,7 @@ dht_finodelk_cbk (call_frame_t *frame, void *cookie, int32_t dht_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { xlator_t *subvol = NULL; int op_errno = -1; @@ -3243,7 +3243,7 @@ dht_finodelk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_finodelk_cbk, subvol, subvol->fops->finodelk, - fd, cmd, lock); + this->name, fd, cmd, lock); return 0; @@ -3266,7 +3266,7 @@ dht_entrylk_cbk (call_frame_t *frame, void *cookie, int32_t dht_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { xlator_t *subvol = NULL; @@ -3300,7 +3300,7 @@ dht_entrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_entrylk_cbk, subvol, subvol->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; @@ -3322,7 +3322,7 @@ dht_fentrylk_cbk (call_frame_t *frame, void *cookie, int32_t dht_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { xlator_t *subvol = NULL; @@ -3342,7 +3342,7 @@ dht_fentrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, dht_fentrylk_cbk, subvol, subvol->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); return 0; diff --git a/xlators/cluster/ha/src/ha.c b/xlators/cluster/ha/src/ha.c index b8670ecfb14..7e25f6c11c9 100644 --- a/xlators/cluster/ha/src/ha.c +++ b/xlators/cluster/ha/src/ha.c @@ -2933,6 +2933,7 @@ ha_inode_entry_lk_cbk (call_frame_t *frame, int32_t ha_inodelk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) @@ -2946,13 +2947,15 @@ ha_inodelk (call_frame_t *frame, goto err; } local = frame->local; - local->stub = fop_inodelk_stub (frame, ha_inodelk, loc, cmd, lock); + local->stub = fop_inodelk_stub (frame, ha_inodelk, volume, + loc, cmd, lock); STACK_WIND_COOKIE (frame, ha_inode_entry_lk_cbk, (void *)(long)local->active, HA_ACTIVE_CHILD(this, local), HA_ACTIVE_CHILD(this, local)->fops->inodelk, - loc, + volume, + loc, cmd, lock); return 0; @@ -2964,6 +2967,7 @@ err: int32_t ha_entrylk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, @@ -2978,13 +2982,14 @@ ha_entrylk (call_frame_t *frame, goto err; } local = frame->local; - local->stub = fop_entrylk_stub (frame, ha_entrylk, loc, basename, cmd, type); + local->stub = fop_entrylk_stub (frame, ha_entrylk, volume, + loc, basename, cmd, type); STACK_WIND_COOKIE (frame, ha_inode_entry_lk_cbk, (void *)(long)local->active, HA_ACTIVE_CHILD(this, local), HA_ACTIVE_CHILD(this, local)->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; err: STACK_UNWIND (frame, -1, op_errno); diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index c44b24ce5b2..f4859ee7199 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -1053,7 +1053,7 @@ map_lk (call_frame_t *frame, int32_t map_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { int32_t op_errno = 1; xlator_t *subvol = NULL; @@ -1074,7 +1074,7 @@ map_inodelk (call_frame_t *frame, xlator_t *this, default_inodelk_cbk, subvol, subvol->fops->inodelk, - loc, cmd, lock); + volume, loc, cmd, lock); return 0; err: STACK_UNWIND (frame, -1, op_errno, NULL, NULL); @@ -1085,7 +1085,7 @@ map_inodelk (call_frame_t *frame, xlator_t *this, int32_t map_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { int32_t op_errno = 1; xlator_t *subvol = NULL; @@ -1105,7 +1105,7 @@ map_finodelk (call_frame_t *frame, xlator_t *this, default_finodelk_cbk, subvol, subvol->fops->finodelk, - fd, cmd, lock); + volume, fd, cmd, lock); return 0; err: STACK_UNWIND (frame, -1, op_errno, NULL, NULL); @@ -1115,7 +1115,7 @@ map_finodelk (call_frame_t *frame, xlator_t *this, int32_t map_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { int32_t op_errno = 1; @@ -1136,7 +1136,7 @@ map_entrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, default_entrylk_cbk, subvol, subvol->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; err: STACK_UNWIND (frame, -1, op_errno, NULL, NULL); @@ -1146,7 +1146,7 @@ map_entrylk (call_frame_t *frame, xlator_t *this, int32_t map_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { int32_t op_errno = 1; @@ -1166,7 +1166,7 @@ map_fentrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, default_fentrylk_cbk, subvol, subvol->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); return 0; err: STACK_UNWIND (frame, -1, op_errno, NULL, NULL); diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c index 6455b4f072d..5122a006173 100644 --- a/xlators/cluster/unify/src/unify.c +++ b/xlators/cluster/unify/src/unify.c @@ -3894,7 +3894,7 @@ unify_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int unify_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int cmd, struct flock *flock) + const char *volume, fd_t *fd, int cmd, struct flock *flock) { UNIFY_CHECK_FD_CTX_AND_UNWIND_ON_ERR (fd); xlator_t *child = NULL; @@ -3905,7 +3905,7 @@ unify_finodelk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, unify_finodelk_cbk, child, child->fops->finodelk, - fd, cmd, flock); + volume, fd, cmd, flock); return 0; } @@ -3928,7 +3928,7 @@ unify_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int unify_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { @@ -3941,7 +3941,7 @@ unify_fentrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, unify_fentrylk_cbk, child, child->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); return 0; } @@ -3998,7 +3998,7 @@ unify_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int unify_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int cmd, struct flock *flock) + const char *volume, loc_t *loc, int cmd, struct flock *flock) { xlator_t *child = NULL; @@ -4006,7 +4006,7 @@ unify_inodelk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, unify_inodelk_cbk, child, child->fops->inodelk, - loc, cmd, flock); + volume, loc, cmd, flock); return 0; } @@ -4029,7 +4029,7 @@ unify_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, */ int unify_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { @@ -4039,7 +4039,7 @@ unify_entrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, unify_entrylk_cbk, child, child->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; } diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 2be30cb6c98..f013023a51b 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -1414,7 +1414,8 @@ error_gen_inodelk_cbk (call_frame_t *frame, void *cookie, int32_t error_gen_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, + struct flock *lock) { int op_errno = 0; op_errno = error_gen(this); @@ -1428,7 +1429,7 @@ error_gen_inodelk (call_frame_t *frame, xlator_t *this, error_gen_inodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, - loc, cmd, lock); + volume, loc, cmd, lock); return 0; } @@ -1445,7 +1446,8 @@ error_gen_finodelk_cbk (call_frame_t *frame, void *cookie, int32_t error_gen_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, + struct flock *lock) { int op_errno = 0; op_errno = error_gen(this); @@ -1459,7 +1461,7 @@ error_gen_finodelk (call_frame_t *frame, xlator_t *this, error_gen_finodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, - fd, cmd, lock); + volume, fd, cmd, lock); return 0; } @@ -1475,7 +1477,7 @@ error_gen_entrylk_cbk (call_frame_t *frame, void *cookie, int32_t error_gen_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { int op_errno = 0; @@ -1489,7 +1491,7 @@ error_gen_entrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, error_gen_entrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; } @@ -1504,7 +1506,7 @@ error_gen_fentrylk_cbk (call_frame_t *frame, void *cookie, int32_t error_gen_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { int op_errno = 0; @@ -1518,7 +1520,7 @@ error_gen_fentrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, error_gen_fentrylk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fentrylk, - fd, basename, cmd, type); + volume, fd, basename, cmd, type); return 0; } diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index ac51b964432..f0f005a7cd3 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -1094,15 +1094,15 @@ trace_inodelk_cbk (call_frame_t *frame, int32_t trace_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { ERR_EINVAL_NORETURN (!this || !loc || !basename); if (trace_fop_names[GF_FOP_ENTRYLK].enabled) { gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (loc= {path=%s, ino=%"PRIu64"} basename=%s, cmd=%s, type=%s)", - frame->root->unique, loc->path, loc->inode->ino, basename, + "%"PRId64": volume=%s, (loc= {path=%s, ino=%"PRIu64"} basename=%s, cmd=%s, type=%s)", + frame->root->unique, volume, loc->path, loc->inode->ino, basename, ((cmd == ENTRYLK_LOCK) ? "ENTRYLK_LOCK" : "ENTRYLK_UNLOCK"), ((type == ENTRYLK_RDLCK) ? "ENTRYLK_RDLCK" : "ENTRYLK_WRLCK")); } @@ -1111,21 +1111,21 @@ trace_entrylk (call_frame_t *frame, xlator_t *this, trace_entrylk_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); return 0; } int32_t trace_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *flock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock) { ERR_EINVAL_NORETURN (!this || !loc); if (trace_fop_names[GF_FOP_INODELK].enabled) { gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, cmd=%s)", - frame->root->unique, loc->path, loc->inode->ino, + "%"PRId64": volume=%s, (loc {path=%s, ino=%"PRIu64"}, cmd=%s)", + frame->root->unique, volume, loc->path, loc->inode->ino, ((cmd == F_SETLK)? "F_SETLK" : "unknown")); } @@ -1133,7 +1133,7 @@ trace_inodelk (call_frame_t *frame, trace_inodelk_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->inodelk, - loc, cmd, flock); + volume, loc, cmd, flock); return 0; } @@ -1160,14 +1160,14 @@ trace_finodelk_cbk (call_frame_t *frame, int32_t trace_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *flock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock) { ERR_EINVAL_NORETURN (!this || !fd); if (trace_fop_names[GF_FOP_FINODELK].enabled) { gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (fd=%p, cmd=%s)", - frame->root->unique, fd, + "%"PRId64": volume=%s, (fd=%p, cmd=%s)", + frame->root->unique, volume, fd, ((cmd == F_SETLK) ? "F_SETLK" : "unknown")); } @@ -1175,7 +1175,7 @@ trace_finodelk (call_frame_t *frame, trace_finodelk_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->finodelk, - fd, cmd, flock); + volume, fd, cmd, flock); return 0; } diff --git a/xlators/features/locks/src/internal.c b/xlators/features/locks/src/internal.c index 985762fb9eb..6bfb627a772 100644 --- a/xlators/features/locks/src/internal.c +++ b/xlators/features/locks/src/internal.c @@ -62,7 +62,7 @@ delete_locks_of_transport (pl_inode_t *pinode, transport_t *trans) int pl_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *flock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock) { int32_t op_ret = -1; int32_t op_errno = 0; @@ -162,7 +162,7 @@ out: int pl_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *flock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock) { int32_t op_ret = -1; int32_t op_errno = 0; @@ -649,7 +649,7 @@ unlock: int pl_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { int32_t op_ret = -1; @@ -759,7 +759,7 @@ out: int pl_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type) { int32_t op_ret = -1; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 46d2cb9a003..095b5b288c9 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -785,20 +785,20 @@ fini (xlator_t *this) int pl_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *flock); + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock); int pl_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *flock); + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock); int pl_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type); int pl_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, + const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type); struct xlator_fops fops = { diff --git a/xlators/features/path-convertor/src/path.c b/xlators/features/path-convertor/src/path.c index 293f34177a5..8badef38cd6 100644 --- a/xlators/features/path-convertor/src/path.c +++ b/xlators/features/path-convertor/src/path.c @@ -1021,7 +1021,7 @@ path_checksum (call_frame_t *frame, int32_t path_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, + const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type) { char *loc_path = (char *)loc->path; @@ -1036,7 +1036,7 @@ path_entrylk (call_frame_t *frame, xlator_t *this, STACK_WIND (frame, path_common_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, - loc, basename, cmd, type); + volume, loc, basename, cmd, type); loc->path = loc_path; if (tmp_path != loc_path) @@ -1047,7 +1047,7 @@ path_entrylk (call_frame_t *frame, xlator_t *this, int32_t path_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { char *loc_path = (char *)loc->path; char *tmp_path = NULL; @@ -1062,7 +1062,7 @@ path_inodelk (call_frame_t *frame, xlator_t *this, path_common_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, - loc, cmd, lock); + volume, loc, cmd, lock); loc->path = loc_path; if (tmp_path != loc_path) diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index 58eba01ed0b..1d3fbfec783 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -3253,6 +3253,7 @@ unwind: int32_t client_inodelk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, int32_t cmd, struct flock *flock) @@ -3265,6 +3266,7 @@ client_inodelk (call_frame_t *frame, int32_t gf_type = 0; ino_t ino = 0; size_t pathlen = 0; + size_t vollen = 0; client_conf_t *conf = this->private; if (conf->child) { @@ -3273,12 +3275,14 @@ client_inodelk (call_frame_t *frame, default_inodelk_cbk, conf->child, conf->child->fops->inodelk, - loc, cmd, flock); + volume, loc, cmd, flock); return 0; } pathlen = STRLEN_0(loc->path); + vollen = STRLEN_0(volume); + ino = this_ino_get (loc, this, GF_CLIENT_INODE_SELF); if (cmd == F_GETLK || cmd == F_GETLK64) @@ -3305,13 +3309,14 @@ client_inodelk (call_frame_t *frame, break; } - hdrlen = gf_hdr_len (req, pathlen); - hdr = gf_hdr_new (req, pathlen); + hdrlen = gf_hdr_len (req, pathlen + vollen); + hdr = gf_hdr_new (req, pathlen + vollen); GF_VALIDATE_OR_GOTO(this->name, hdr, unwind); req = gf_param (hdr); strcpy (req->path, loc->path); + strcpy (req->path + pathlen, volume); req->ino = hton64 (ino); @@ -3349,6 +3354,7 @@ unwind: int32_t client_finodelk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, int32_t cmd, struct flock *flock) @@ -3357,6 +3363,7 @@ client_finodelk (call_frame_t *frame, gf_hdr_common_t *hdr = NULL; gf_fop_finodelk_req_t *req = NULL; size_t hdrlen = 0; + size_t vollen = 0; int32_t gf_cmd = 0; int32_t gf_type = 0; int64_t remote_fd = -1; @@ -3368,11 +3375,13 @@ client_finodelk (call_frame_t *frame, default_finodelk_cbk, conf->child, conf->child->fops->finodelk, - fd, cmd, flock); + volume, fd, cmd, flock); return 0; } + vollen = STRLEN_0(volume); + ret = this_fd_get (fd, this, &remote_fd); if (ret == -1) { gf_log (this->name, GF_LOG_DEBUG, @@ -3406,12 +3415,14 @@ client_finodelk (call_frame_t *frame, break; } - hdrlen = gf_hdr_len (req, 0); - hdr = gf_hdr_new (req, 0); + hdrlen = gf_hdr_len (req, vollen); + hdr = gf_hdr_new (req, vollen); GF_VALIDATE_OR_GOTO(this->name, hdr, unwind); req = gf_param (hdr); + strcpy (req->volume, volume); + req->fd = hton64 (remote_fd); req->cmd = hton32 (gf_cmd); @@ -3436,6 +3447,7 @@ unwind: int32_t client_entrylk (call_frame_t *frame, xlator_t *this, + const char *volume, loc_t *loc, const char *name, entrylk_cmd cmd, @@ -3444,6 +3456,7 @@ client_entrylk (call_frame_t *frame, gf_hdr_common_t *hdr = NULL; gf_fop_entrylk_req_t *req = NULL; size_t pathlen = 0; + size_t vollen = 0; size_t hdrlen = -1; int ret = -1; ino_t ino = 0; @@ -3455,19 +3468,21 @@ client_entrylk (call_frame_t *frame, STACK_WIND (frame, default_entrylk_cbk, conf->child, conf->child->fops->entrylk, - loc, name, cmd, type); + volume, loc, name, cmd, type); return 0; } pathlen = STRLEN_0(loc->path); + vollen = STRLEN_0(volume); + if (name) namelen = STRLEN_0(name); ino = this_ino_get (loc, this, GF_CLIENT_INODE_SELF); - hdrlen = gf_hdr_len (req, pathlen + namelen); - hdr = gf_hdr_new (req, pathlen + namelen); + hdrlen = gf_hdr_len (req, pathlen + vollen + namelen); + hdr = gf_hdr_new (req, pathlen + vollen + namelen); GF_VALIDATE_OR_GOTO(this->name, hdr, unwind); req = gf_param (hdr); @@ -3478,6 +3493,7 @@ client_entrylk (call_frame_t *frame, strcpy (req->path, loc->path); if (name) strcpy (req->name + pathlen, name); + strcpy (req->volume + pathlen + namelen, volume); req->cmd = hton32 (cmd); req->type = hton32 (type); @@ -3501,6 +3517,7 @@ unwind: int32_t client_fentrylk (call_frame_t *frame, xlator_t *this, + const char *volume, fd_t *fd, const char *name, entrylk_cmd cmd, @@ -3509,6 +3526,7 @@ client_fentrylk (call_frame_t *frame, gf_hdr_common_t *hdr = NULL; gf_fop_fentrylk_req_t *req = NULL; int64_t remote_fd = -1; + size_t vollen = 0; size_t namelen = 0; size_t hdrlen = -1; int ret = -1; @@ -3519,7 +3537,7 @@ client_fentrylk (call_frame_t *frame, STACK_WIND (frame, default_fentrylk_cbk, conf->child, conf->child->fops->fentrylk, - fd, name, cmd, type); + volume, fd, name, cmd, type); return 0; } @@ -3527,6 +3545,8 @@ client_fentrylk (call_frame_t *frame, if (name) namelen = STRLEN_0(name); + vollen = STRLEN_0(volume); + ret = this_fd_get (fd, this, &remote_fd); if (ret == -1) { gf_log (this->name, GF_LOG_DEBUG, @@ -3536,8 +3556,8 @@ client_fentrylk (call_frame_t *frame, return 0; } - hdrlen = gf_hdr_len (req, namelen); - hdr = gf_hdr_new (req, namelen); + hdrlen = gf_hdr_len (req, namelen + vollen); + hdr = gf_hdr_new (req, namelen + vollen); GF_VALIDATE_OR_GOTO(this->name, hdr, unwind); req = gf_param (hdr); @@ -3548,6 +3568,8 @@ client_fentrylk (call_frame_t *frame, if (name) strcpy (req->name, name); + strcpy (req->volume + namelen, volume); + req->cmd = hton32 (cmd); req->type = hton32 (type); 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; }; diff --git a/xlators/storage/bdb/src/bdb.c b/xlators/storage/bdb/src/bdb.c index 91af98003bf..6044ef47371 100644 --- a/xlators/storage/bdb/src/bdb.c +++ b/xlators/storage/bdb/src/bdb.c @@ -2959,7 +2959,7 @@ out: int32_t bdb_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { frame->root->rsp_refs = NULL; @@ -2973,7 +2973,7 @@ bdb_inodelk (call_frame_t *frame, xlator_t *this, int32_t bdb_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { frame->root->rsp_refs = NULL; @@ -2987,8 +2987,8 @@ bdb_finodelk (call_frame_t *frame, xlator_t *this, int32_t bdb_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, entrylk_cmd cmd, - entrylk_type type) + const char *volume, loc_t *loc, const char *basename, + entrylk_cmd cmd, entrylk_type type) { frame->root->rsp_refs = NULL; @@ -3002,8 +3002,8 @@ bdb_entrylk (call_frame_t *frame, xlator_t *this, int32_t bdb_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, entrylk_cmd cmd, - entrylk_type type) + const char *volume, fd_t *fd, const char *basename, + entrylk_cmd cmd, entrylk_type type) { frame->root->rsp_refs = NULL; diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 28b6d9ef4bd..657be1edc12 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3431,7 +3431,7 @@ posix_lk (call_frame_t *frame, xlator_t *this, int32_t posix_inodelk (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) { frame->root->rsp_refs = NULL; @@ -3445,7 +3445,7 @@ posix_inodelk (call_frame_t *frame, xlator_t *this, int32_t posix_finodelk (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) { frame->root->rsp_refs = NULL; @@ -3460,8 +3460,8 @@ posix_finodelk (call_frame_t *frame, xlator_t *this, int32_t posix_entrylk (call_frame_t *frame, xlator_t *this, - loc_t *loc, const char *basename, entrylk_cmd cmd, - entrylk_type type) + const char *volume, loc_t *loc, const char *basename, + entrylk_cmd cmd, entrylk_type type) { frame->root->rsp_refs = NULL; @@ -3475,8 +3475,8 @@ posix_entrylk (call_frame_t *frame, xlator_t *this, int32_t posix_fentrylk (call_frame_t *frame, xlator_t *this, - fd_t *fd, const char *basename, entrylk_cmd cmd, - entrylk_type type) + const char *volume, fd_t *fd, const char *basename, + entrylk_cmd cmd, entrylk_type type) { frame->root->rsp_refs = NULL; |