From 6e6b4b4fd002347ca08691f73e10b961f693d754 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 12 Oct 2010 04:09:35 +0000 Subject: glusterd-rebalance: if file is open, don't do rebalance Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xlators/mgmt') 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, -- cgit