From cb533fc296e37ffbd7937a8550611d557b89ae0b Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 21 Aug 2013 18:54:05 +0530 Subject: core: remove GLUSTERFS_CREATE_MODE_KEY usage Change-Id: I23b8cb7223b91a55af1cd4214f61bbe0e87351f6 BUG: 952029 Signed-off-by: Amar Tumballi Reviewed-on: http://review.gluster.org/5683 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/glusterfs.h | 1 - xlators/cluster/dht/src/dht-linkfile.c | 9 --------- xlators/features/gfid-access/src/gfid-access.c | 17 +++++------------ xlators/storage/posix/src/posix.c | 14 -------------- 4 files changed, 5 insertions(+), 36 deletions(-) diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 324e3f5b..ede208b3 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -102,7 +102,6 @@ #define UUID_CANONICAL_FORM_LEN 36 #define GLUSTERFS_INTERNAL_FOP_KEY "glusterfs-internal-fop" -#define GLUSTERFS_CREATE_MODE_KEY "glusterfs-create-mode" #define ZR_FILE_CONTENT_STR "glusterfs.file." #define ZR_FILE_CONTENT_STRLEN 15 diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c index 57cc202d..dbc9d0b3 100644 --- a/xlators/cluster/dht/src/dht-linkfile.c +++ b/xlators/cluster/dht/src/dht-linkfile.c @@ -148,15 +148,6 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk, goto out; } - ret = dict_set_uint32 (dict, GLUSTERFS_CREATE_MODE_KEY, - DHT_LINKFILE_MODE); - if (ret < 0) { - gf_log (frame->this->name, GF_LOG_WARNING, - "%s: failed to set mode in xdata", - loc->path); - goto out; - } - local->link_subvol = fromvol; /* Always create as root:root. dht_linkfile_attr_heal fixes the * ownsership */ diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 62103b05..755add52 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -337,6 +337,7 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, ga_newfile_args_t *args = NULL; loc_t tmp_loc = {0,}; call_frame_t *new_frame = NULL; + mode_t mode = 0; args = ga_newfile_parse_args (this, data); if (!args) @@ -369,21 +370,13 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, args->args.symlink.linkpath, &tmp_loc, 0, xdata); } else { - if (S_ISREG (args->st_mode)) { - ret = dict_set_uint32 (xdata, - GLUSTERFS_CREATE_MODE_KEY, - args->args.mknod.mode); - if (ret < 0) { - gf_log (THIS->name, GF_LOG_ERROR, - "failed to set the create-mode-key"); - goto out; - } - args->args.mknod.mode = IA_IFREG; - } + /* use 07777 (4 7s) for considering the Sticky bits etc) */ + mode = (S_IFMT & args->st_mode) | + (07777 | args->args.mknod.mode);; STACK_WIND (new_frame, ga_newentry_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, - &tmp_loc, args->args.mknod.mode, + &tmp_loc, mode, args->args.mknod.rdev, args->args.mknod.umask, xdata); } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index fc7c259e..3c7816cf 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -842,7 +842,6 @@ 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; @@ -918,19 +917,6 @@ 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