From 51ddf878b1d74369434c6b95b49a76bce32fd4b1 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 13 Oct 2010 00:12:49 +0000 Subject: glusterd-rebalance: if file is open, don't do rebalance Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 1934 (Server segfault with 3.1 platform ISO during volume expansion) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1934 --- xlators/storage/posix/src/posix.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index fbdc2a13d..c69b7c872 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3031,6 +3031,22 @@ posix_getxattr (call_frame_t *frame, xlator_t *this, goto out; } + if (loc->inode && name && !strcmp (name, GLUSTERFS_OPEN_FD_COUNT)) { + if (!list_empty (&loc->inode->fd_list)) { + ret = dict_set_uint32 (dict, (char *)name, 1); + if (ret < 0) + gf_log (this->name, GF_LOG_WARNING, + "Failed to set dictionary value for %s", + name); + } else { + ret = dict_set_uint32 (dict, (char *)name, 0); + if (ret < 0) + gf_log (this->name, GF_LOG_WARNING, + "Failed to set dictionary value for %s", + name); + } + goto done; + } if (loc->inode && IA_ISREG (loc->inode->ia_type) && name && (strcmp (name, GF_XATTR_PATHINFO_KEY) == 0)) { snprintf (host_buf, 1024, "%s:%s", priv->hostname, @@ -3171,6 +3187,15 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this, goto out; } + if (name && !strcmp (name, GLUSTERFS_OPEN_FD_COUNT)) { + ret = dict_set_uint32 (dict, (char *)name, 1); + if (ret < 0) + gf_log (this->name, GF_LOG_WARNING, + "Failed to set dictionary value for %s", + name); + goto done; + } + size = sys_flistxattr (_fd, NULL, 0); if (size == -1) { op_errno = errno; -- cgit