diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2010-12-06 07:55:56 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-12-06 22:18:51 -0800 |
commit | caa77054005ea9ca9b806006103cd3f7eed10c7d (patch) | |
tree | 8c6d85b86ba2f9bfa334fff881bd67077a6a3b8b /xlators/storage | |
parent | 574d938adcfe74f912fb2de8f77fc7a9d18c689b (diff) |
check whether the file is a symlink while doing utimes
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 881 (GlusterFS daemon hangs on replication of symlink (3.0.4))
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=881
Diffstat (limited to 'xlators/storage')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index c69b7c872d5..39441fa7d96 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -585,6 +585,18 @@ posix_do_utimes (xlator_t *this, { int32_t ret = -1; struct timeval tv[2] = {{0,},{0,}}; + struct stat stat; + int is_symlink = 0; + + ret = sys_lstat (path, &stat); + if (ret != 0) { + gf_log (this->name, GF_LOG_WARNING, + "%s (%s)", path, strerror (errno)); + goto out; + } + + if (S_ISLNK (stat.st_mode)) + is_symlink = 1; tv[0].tv_sec = stbuf->ia_atime; tv[0].tv_usec = stbuf->ia_atime_nsec / 1000; @@ -593,9 +605,15 @@ posix_do_utimes (xlator_t *this, ret = lutimes (path, tv); if ((ret == -1) && (errno == ENOSYS)) { + if (is_symlink) { + ret = 0; + goto out; + } + ret = utimes (path, tv); } - + +out: return ret; } |