summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2010-12-06 07:35:24 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-12-06 05:20:43 -0800
commit6da4cc87ff5545bd2ae7d5a45a4468e77aac2198 (patch)
tree6c6a49cc568d7a003f91c13378f0ac3a87cd5814
parente602c69beda645740b1f4a2b5da8e03655a28b57 (diff)
check if the file is a symlink while doing utimesv3.0.7qa2v3.0.7
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
-rw-r--r--xlators/storage/posix/src/posix.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 0000973..10c8ec8 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -634,6 +634,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->st_atime;
tv[0].tv_usec = ST_ATIM_NSEC (stbuf) / 1000;
@@ -642,9 +654,14 @@ 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;
}