summaryrefslogtreecommitdiffstats
path: root/xlators/protocol
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-07-14 07:11:28 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-14 14:44:22 -0700
commite73a856e926465068f6f6cf5a0cace501589957c (patch)
treef3bac15e33ec855921dd192717f16f755d0c3f78 /xlators/protocol
parent32451a4dd02bdd95ec800d51267d2e6be43914a4 (diff)
v2 [PATCH BUG:1050] protocol/server Convert-OS-specific-lock-value-to-Glusterfs-lock
server/protocol's getlk implementation needs to convert the flock on the system to glfs own flock before returning it to the client to prevent misinterpretation of the flock structure. Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1050 (fcntl F_GETLK lock calls do not return correct flock on non-linux systems) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1050
Diffstat (limited to 'xlators/protocol')
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 3a62a400d50..578e461b0a3 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -189,6 +189,22 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE(frame);
if (op_ret == 0) {
+ switch (lock->l_type) {
+ case F_RDLCK:
+ lock->l_type = GF_LK_F_RDLCK;
+ break;
+ case F_WRLCK:
+ lock->l_type = GF_LK_F_WRLCK;
+ break;
+ case F_UNLCK:
+ lock->l_type = GF_LK_F_UNLCK;
+ break;
+ default:
+ gf_log (this->name, GF_LOG_ERROR,
+ "Unknown lock type: %"PRId32"!", lock->l_type);
+ break;
+ }
+
gf_flock_from_flock (&rsp.flock, lock);
} else if (op_errno != ENOSYS) {
gf_log (this->name, GF_LOG_TRACE,