summaryrefslogtreecommitdiffstats
path: root/argp-standalone
stat options
Period:
Authors:

Commits per author per week (path 'argp-standalone')

AuthorW05 2026W06 2026W07 2026W08 2026Total
Total00000
tr>
authorshishir gowda <shishirng@gluster.com>2011-03-04 02:22:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-03-04 00:41:15 -0800
commit5b909c83de45e9457eef773cb24770b47d51a632 (patch)
tree4de0148ce00c572308b96c43e4f95ae49b88c2fa
parent0066a093a258bfd1a9130134318c3df3571a091d (diff)
Solaris xattr support for symlink and special files.v3.1.3qa3
Since glusterfs uses xattr for storing gfid, and xattr support for symlinks and special files does not exist in solaris. The work around is provided by creating hidden files under export directory on solaris hosts only. the hidden files ares maintained in .glusterfs_xattr_inode directory, and all xattr ops on symlink and special files are redirected to respective inodes. All dir entries with name starting as .glusterfs (GF_HIDDEN_PATH) will not be shown in readdir ops. Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2213 (Symlink fails with ENODATA) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2213
Diffstat
-rw-r--r--libglusterfs/src/common-utils.h2
-rw-r--r--libglusterfs/src/compat.c244
-rw-r--r--libglusterfs/src/compat.h8
-rw-r--r--libglusterfs/src/glusterfs.h1
-rw-r--r--libglusterfs/src/inode.c2
-rw-r--r--libglusterfs/src/inode.h2
-rw-r--r--libglusterfs/src/syscall.c6
-rw-r--r--xlators/storage/posix/src/posix.c16
8 files changed, 260 insertions, 21 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 0cb53d1bf..0d93e5bee 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -144,6 +144,8 @@ extern char *gf_mgmt_list[GF_MGMT_MAXVALUE];
} while (0);
#endif
+#define GF_HIDDEN_PATH ".glusterfs"
+
static inline void
iov_free (struct iovec *vector, int count)
{
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index 210221631..914fb2006 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -35,9 +35,10 @@
#include "compat.h"
#include "common-utils.h"
+#include "iatt.h"
+#include "inode.h"
#ifdef GF_SOLARIS_HOST_OS
-
int
solaris_fsetxattr(int fd,
const char* key,
@@ -97,6 +98,125 @@ solaris_fgetxattr(int fd,
return ret;
}
+/* Solaris does not support xattr for symlinks and dev files. Since gfid and
+ other trusted attributes are stored as xattrs, we need to provide support for
+ them. A mapped regular file is stored in the /.glusterfs_xattr_inode of the export dir.
+ All xattr ops related to the special files are redirected to this map file.
+*/
+
+int
+make_export_path (const char *real_path, char **path)
+{
+ int ret = -1;
+ char *tmp = NULL;
+ char *export_path = NULL;
+ char *dup = NULL;
+ char *ptr = NULL;
+ char *freeptr = NULL;
+ uuid_t gfid = {0, };
+
+ export_path = GF_CALLOC (1, sizeof (char) * PATH_MAX, 0);
+ if (!export_path)
+ goto out;
+
+ dup = gf_strdup (real_path);
+ if (!dup)
+ goto out;
+
+ freeptr = dup;
+ ret = solaris_getxattr ("/", GFID_XATTR_KEY, gfid, 16);
+ /* Return value of getxattr */
+ if (ret == 16) {
+ if (!__is_root_gfid (gfid)){
+ strcat (export_path, "/");
+ ret = 0;
+ goto done;
+ }
+ }
+
+ do {
+ ptr = strtok_r (dup, "/", &tmp);
+ if (!ptr)
+ break;
+ strcat (export_path, dup);
+ ret = solaris_getxattr (export_path, GFID_XATTR_KEY, gfid, 16);
+ if (ret == 16) {
+ if (!__is_root_gfid (gfid)) {
+ ret = 0;
+ goto done;
+ }
+ }
+ strcat (export_path, "/");
+ dup = tmp;
+ } while (ptr);
+
+ goto out;
+
+done:
+ if (!ret) {
+ *path = export_path;
+ }
+out:
+ if (freeptr)
+ GF_FREE (freeptr);
+ if (ret && export_path)
+ GF_FREE (export_path);
+
+ return ret;
+}
+int
+solaris_xattr_resolve_path (const char *real_path, char **path)
+{
+ int ret = -1;
+ char *export_path = NULL;
+ char xattr_path[PATH_MAX] = {0, };
+ struct stat lstatbuf = {0, };
+ struct iatt stbuf = {0, };
+ struct stat statb