summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/common.c
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2009-12-06 13:29:08 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-06 11:33:03 -0800
commit9e38b5066d42d47f1011e1d1bc32ed9c41df57ec (patch)
treee37976b8068ddd3135ba3c085ff754fc6302d7a4 /xlators/features/locks/src/common.c
parentfe37a56dd42294e26158a29c15a35aeb8cb38be2 (diff)
features/locks: Implement release xlator callback.
This patch solves the lock bailout problem seen recently when autoconf tools were run. This is a workaround, where 'flock' locks are removed in pl_release, if an explicit UNLCK call does not come. The complete fix would be to allow 'fcntl' and 'flock' locks to operate in different domains. Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 449 (Handle flock calls in a different domain from fcntl calls) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=449
Diffstat (limited to 'xlators/features/locks/src/common.c')
-rw-r--r--xlators/features/locks/src/common.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index 7cbf45958a8..d82e47aa36f 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -96,6 +96,11 @@ found:
return dom;
}
+unsigned long
+fd_to_fdnum (fd_t *fd)
+{
+ return ((unsigned long) fd);
+}
int
__pl_inode_is_empty (pl_inode_t *pl_inode)
@@ -444,7 +449,7 @@ new_posix_lock (struct flock *flock, transport_t *transport, pid_t client_pid,
lock->fl_end = flock->l_start + flock->l_len - 1;
lock->transport = transport;
- lock->fd = fd;
+ lock->fd_num = fd_to_fdnum (fd);
lock->client_pid = client_pid;
lock->owner = owner;
@@ -688,7 +693,7 @@ __insert_and_merge (pl_inode_t *pl_inode, posix_lock_t *lock)
sum->fl_type = lock->fl_type;
sum->transport = lock->transport;
- sum->fd = lock->fd;
+ sum->fd_num = lock->fd_num;
sum->client_pid = lock->client_pid;
sum->owner = lock->owner;
@@ -704,7 +709,7 @@ __insert_and_merge (pl_inode_t *pl_inode, posix_lock_t *lock)
sum->fl_type = conf->fl_type;
sum->transport = conf->transport;
- sum->fd = conf->fd;
+ sum->fd_num = conf->fd_num;
sum->client_pid = conf->client_pid;
sum->owner = conf->owner;