diff options
author | shishir gowda <shishirng@gluster.com> | 2011-03-04 02:22:37 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-03-04 00:41:15 -0800 |
commit | 5b909c83de45e9457eef773cb24770b47d51a632 (patch) | |
tree | 4de0148ce00c572308b96c43e4f95ae49b88c2fa /xlators/storage/posix/src/posix.c | |
parent | 0066a093a258bfd1a9130134318c3df3571a091d (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 (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r-- | xlators/storage/posix/src/posix.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 457a3511880..e3130f4f1e0 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -56,7 +56,6 @@ #include "glusterfs3-xdr.h" #include "hashfn.h" -#define GFID_XATTR_KEY "trusted.gfid" #undef HAVE_SET_FSID #ifdef HAVE_SET_FSID @@ -1471,7 +1470,7 @@ posix_unlink (call_frame_t *frame, xlator_t *this, } } - op_ret = unlink (real_path); + op_ret = sys_unlink (real_path); if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, @@ -1778,7 +1777,7 @@ posix_rename (call_frame_t *frame, xlator_t *this, was_present = 0; } - op_ret = rename (real_oldpath, real_newpath); + op_ret = sys_rename (real_oldpath, real_newpath); if (op_ret == -1) { op_errno = errno; gf_log (this->name, @@ -3969,6 +3968,8 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, struct iatt stbuf = {0, }; char base_path[PATH_MAX] = {0,}; gf_dirent_t *tmp_entry = NULL; + struct stat statbuf = {0, }; + char hidden_path[PATH_MAX] = {0, }; VALIDATE_OR_GOTO (frame, out); VALIDATE_OR_GOTO (this, out); @@ -4058,6 +4059,15 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this, && (!strcmp(entry->d_name, GF_REPLICATE_TRASH_DIR))) continue; + if ((!strcmp (real_path, base_path)) + && (!strncmp (GF_HIDDEN_PATH, entry->d_name, + strlen(GF_HIDDEN_PATH)))) { + snprintf (hidden_path, PATH_MAX, "%s/%s", real_path, + entry->d_name); + ret = lstat (hidden_path, &statbuf); + if (!ret && S_ISDIR (statbuf.st_mode)) + continue; + } this_size = max (sizeof (gf_dirent_t), sizeof (gfs3_dirplist)) + strlen (entry->d_name) + 1; |