summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2010-03-02 07:20:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-03 06:40:05 -0800
commit8150d6bb9041f7e1b61370aebe14181f368d679f (patch)
tree2e1f36d0dc74c89133db9a417934ab16cb0ed27a
parent1ea072a05e98335af0fd6f86c9582ce04d262a4e (diff)
posix: gen number fixes on non-Linux systems
Most non-Linux platforms do not support extended attributes on special files and symlinks. Use the mtime as the generation number for these files on such systems Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 621 (3.0.2 GlusterFS fails on Solaris 10) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=621
-rw-r--r--xlators/storage/posix/src/posix.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 5eaebbe1cc5..0f784f28e97 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -265,6 +265,15 @@ posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p)
return -1;
}
+#ifndef GF_LINUX_HOST_OS
+ if (!S_ISDIR (stbuf.st_mode) && !S_ISREG (stbuf.st_mode)) {
+ stbuf.st_dev = (typeof(stbuf.st_dev))stbuf.st_mtime;
+ if (stbuf_p)
+ *stbuf_p = stbuf;
+ return 0;
+ }
+#endif /* !GF_LINUX_HOST_OS */
+
ret = snprintf (gen_key, 1024, "trusted.%s.gen", this->name);
if (ret == 1024)
@@ -289,7 +298,7 @@ posix_lstat_with_gen (xlator_t *this, const char *path, struct stat *stbuf_p)
if (ret >= 0) {
ret = 0;
- stbuf.st_dev = gen_val;
+ stbuf.st_dev = (typeof(stbuf.st_dev))gen_val;
if (stbuf_p)
*stbuf_p = stbuf;
}
@@ -324,6 +333,12 @@ posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p)
return -1;
}
+#ifndef GF_LINUX_HOST_OS
+ if (!S_ISDIR (stbuf.st_mode) && !S_ISREG (stbuf.st_mode)) {
+ stbuf.st_dev = (typeof(stbuf.st_dev))stbuf.st_mtime;
+ return 0;
+ }
+#endif /* !GF_LINUX_HOST_OS */
ret = snprintf (gen_key, 1024, "trusted.%s.gen", this->name);
@@ -349,7 +364,7 @@ posix_fstat_with_gen (xlator_t *this, int fd, struct stat *stbuf_p)
if (ret >= 0) {
ret = 0;
- stbuf.st_dev = gen_val;
+ stbuf.st_dev = (typeof(stbuf.st_dev))gen_val;
if (stbuf_p)
*stbuf_p = stbuf;
}