summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-07-14 07:13:50 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-14 14:44:42 -0700
commit3d6e03926c093433b27400f2b7682fc7ed9c5a7e (patch)
treec70871cbc8e21b38515c01f80a89df327206c1e8
parent719987d79cd609c4aae80eafea9023c8fe6c4ec9 (diff)
v2 [PATCH BRANCH:release-3.0 BUG:1050] protocol/server: Convert OS specific lock value to Gluster lock value
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
-rw-r--r--xlators/protocol/server/src/server-protocol.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index 6af276ec8..c4b0d47c8 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -410,6 +410,22 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
hdr->rsp.op_errno = hton32 (gf_errno);
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) {
state = CALL_STATE(frame);