From df9bfff8ea08176a3874fb0cdec8fd4b988d3ffa Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 31 Jul 2013 23:58:04 +0530 Subject: core: changes to support gfid-access Change-Id: I38d2fdc47e4b805deafca6805e54807976ffdb7e Signed-off-by: Amar Tumballi BUG: 952029 Reviewed-on: http://review.gluster.org/5496 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-common.c | 6 ------ xlators/mount/fuse/utils/mount.glusterfs.in | 16 ++++++++++++---- xlators/storage/posix/src/posix.c | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 71588ddc..b1fee655 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1436,7 +1436,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); conf = this->private; if (!conf) @@ -2144,7 +2143,6 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); VALIDATE_OR_GOTO (this->private, err); conf = this->private; @@ -2503,7 +2501,6 @@ dht_setxattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); conf = this->private; @@ -2717,7 +2714,6 @@ dht_removexattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); local = dht_local_init (frame, loc, NULL, GF_FOP_REMOVEXATTR); if (!local) { @@ -2949,7 +2945,6 @@ dht_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); VALIDATE_OR_GOTO (this->private, err); conf = this->private; @@ -4892,7 +4887,6 @@ dht_entrylk (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); VALIDATE_OR_GOTO (loc->inode, err); - VALIDATE_OR_GOTO (loc->path, err); local = dht_local_init (frame, loc, NULL, GF_FOP_ENTRYLK); if (!local) { diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 84bcfaa5..3e8fa404 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -120,6 +120,10 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --mem-accounting"); fi + if [ -n "$aux_gfid_mount" ]; then + cmd_line=$(echo "$cmd_line --aux-gfid-mount"); + fi + #options with values start here if [ -n "$log_level" ]; then cmd_line=$(echo "$cmd_line --log-level=$log_level"); @@ -266,13 +270,13 @@ mount.glusterfs --version" # check for recursive mounts. i.e, mounting over an existing brick check_recursive_mount () { - if [ $2 = "/" ]; then + if [ $1 = "/" ]; then echo Cannot mount over root; exit 2; fi # GFID check first # remove trailing / from mount point - mnt_dir=${2%/}; + mnt_dir=${1%/}; export PATH; # check whether getfattr exists @@ -331,7 +335,6 @@ check_recursive_mount () main () { helper=$(echo "$@" | sed -n 's/.*\--[ ]*\([^ ]*\).*/\1/p'); - in_opt="no" pos_args=0 for opt in "$@"; do @@ -346,6 +349,11 @@ main () "fopen-keep-cache") fopen_keep_cache=1 ;; "enable-ino32") enable_ino32=1 ;; "mem-accounting") mem_accounting=1;; + "aux-gfid-mount") + if [ `uname -s` = "Linux" ]; then + aux_gfid_mount=1 + fi + ;; # "mount -t glusterfs" sends this, but it's useless. "rw") ;; # these ones are interpreted during system initialization @@ -435,7 +443,7 @@ main () exit 0; fi - check_recursive_mount "$@"; + check_recursive_mount "$mount_point"; # Append fuse.glusterfs to PRUNEFS variable in updatedb.conf(5). updatedb(8) # should not index files under GlusterFS, indexing will slow down GlusteFS diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 3c7816cf..fc7c259e 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -842,6 +842,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this, struct iatt preparent = {0,}; struct iatt postparent = {0,}; void * uuid_req = NULL; + mode_t st_mode = 0; DECLARE_OLD_FS_ID_VAR; @@ -917,6 +918,19 @@ real_op: strerror (op_errno)); goto out; } + } else { + op_ret = dict_get_uint32 (xdata, GLUSTERFS_CREATE_MODE_KEY, + &st_mode); + + if (op_ret >= 0) { + op_ret = chmod (real_path, st_mode); + if (op_ret < 0) { + gf_log (this->name, GF_LOG_WARNING, + "chmod failed (%s)", strerror (errno)); + } + + dict_del (xdata, GLUSTERFS_CREATE_MODE_KEY); + } } op_ret = posix_gfid_set (this, real_path, loc, xdata); -- cgit