summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
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:39:53 -0800
commit25126f64ea049a374fcd724a793328db7c96037f (patch)
treede12485749bde7a333f344b9acc853b5ac928619 /xlators/storage/posix
parentf2097590eb05e3b8e5946aa1966cfd29bfd23dc5 (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
Diffstat (limited to 'xlators/storage/posix')
-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 0cfe0c4b231..acb0eafd397 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;
}