From 8150d6bb9041f7e1b61370aebe14181f368d679f Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Tue, 2 Mar 2010 07:20:31 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 621 (3.0.2 GlusterFS fails on Solaris 10) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=621 --- xlators/storage/posix/src/posix.c | 19 +++++++++++++++++-- 1 file 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; } -- cgit