summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 6e478b073..3b04dc2be 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -23,6 +23,7 @@
#endif
#include <inttypes.h>
#include <sys/resource.h>
+#include <sys/time.h>
#include "globals.h"
#include "compat.h"
@@ -111,6 +112,7 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir)
char value[16] = {0,};
char linkinfo[PATH_MAX] = {0,};
char file_not_copied_fully = 0;
+ struct timeval times[2] = {{0,},{0,}};
if (!volinfo->defrag)
goto out;
@@ -207,7 +209,7 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir)
ret = fchown (dst_fd, stbuf.st_uid, stbuf.st_gid);
if (ret) {
- gf_log ("", GF_LOG_WARNING,
+ gf_log (THIS->name, GF_LOG_WARNING,
"failed to set the uid/gid of file %s: %s",
tmp_filename, strerror (errno));
}
@@ -252,6 +254,20 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir)
continue;
}
+ times[0].tv_sec = stbuf.st_atime;
+ times[0].tv_usec = 0;
+
+ times[1].tv_sec = stbuf.st_mtime;
+ times[1].tv_usec = 0;
+
+ ret = utimes (tmp_filename, times);
+
+ if (ret < 0) {
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to set the atime/mtime of file %s: %s",
+ tmp_filename, strerror (errno));
+ }
+
ret = rename (tmp_filename, full_path);
if (ret != -1) {
LOCK (&defrag->lock);