diff options
author | Amar Tumballi <amar@gluster.com> | 2010-10-13 00:12:49 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-19 06:30:31 -0700 |
commit | 51ddf878b1d74369434c6b95b49a76bce32fd4b1 (patch) | |
tree | 537de2a80112486321f82a591ff54e3c5c5e35dd /xlators/mgmt/glusterd/src/glusterd-rebalance.c | |
parent | e788e2dec0c90c77a88b561636df569d94c8e638 (diff) |
glusterd-rebalance: if file is open, don't do rebalance
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
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
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rebalance.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 934fc70307a..f3c5b9591b5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -53,6 +53,7 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir) struct stat new_stbuf = {0,}; char full_path[1024] = {0,}; char tmp_filename[1024] = {0,}; + char value[16] = {0,}; if (!volinfo->defrag) goto out; @@ -82,6 +83,12 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir) ((stbuf.st_mode & 01000) == 01000))) continue; + /* If the file is open, don't run rebalance on it */ + ret = sys_lgetxattr (full_path, GLUSTERFS_OPEN_FD_COUNT, + &value, 16); + if ((ret < 0) || !strncmp (value, "1", 1)) + continue; + /* If its a regular file, and sticky bit is set, we need to rebalance that */ snprintf (tmp_filename, 1024, "%s/.%s.gfs%llu", dir, |