From 9e38b5066d42d47f1011e1d1bc32ed9c41df57ec Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Sun, 6 Dec 2009 13:29:08 +0000 Subject: 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 Signed-off-by: Anand V. Avati 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 --- xlators/features/locks/src/common.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xlators/features/locks/src/common.c') 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; -- cgit