summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.c
diff options
context:
space:
mode:
authorkrishna <krishna@gluster.com>2009-04-22 23:43:58 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-04-23 15:19:58 +0530
commit99351618cd15da15ee875f143154ea7f8e28eaf4 (patch)
treee78affcfece2f64f28ed77dd736043c00bcf6921 /xlators/cluster/dht/src/dht-common.c
parentb6f634f602559cfe0c4609f16c9f33a32243b578 (diff)
"option unhashed-sticky-bit on/off"
"option unhashed-sticky-bit on/off" will configure distribute to set or not the S_ISVTX bit in the stat.st_mode of the actual file in case it is pointed to by the link file. This can be enabled during migration. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.c')
-rw-r--r--xlators/cluster/dht/src/dht-common.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index fc0e7706c..4bf86263d 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -198,12 +198,14 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
+ dht_conf_t *conf = NULL;
int ret = -1;
int is_dir = 0;
int is_linkfile = 0;
local = frame->local;
prev = cookie;
+ conf = this->private;
LOCK (&frame->lock);
{
@@ -286,9 +288,11 @@ unlock:
if (is_last_call (this_call_cnt)) {
if (!S_ISDIR (local->stbuf.st_mode)
&& (local->hashed_subvol != local->cached_subvol)
- && (local->stbuf.st_nlink == 1))
+ && (local->stbuf.st_nlink == 1)
+ && (conf->unhashed_sticky_bit)) {
local->stbuf.st_mode |= S_ISVTX;
-
+ }
+
if (local->layout_mismatch) {
local->op_ret = -1;
local->op_errno = ESTALE;
@@ -310,10 +314,12 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
{
dht_local_t *local = NULL;
xlator_t *cached_subvol = NULL;
+ dht_conf_t *conf = NULL;
int ret = -1;
local = frame->local;
cached_subvol = local->cached_subvol;
+ conf = this->private;
ret = dht_layout_inode_set (this, local->cached_subvol, inode);
if (ret < 0) {
@@ -326,8 +332,10 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
}
local->op_ret = 0;
- if (local->stbuf.st_nlink == 1)
+ if ((local->stbuf.st_nlink == 1)
+ && (conf->unhashed_sticky_bit)) {
local->stbuf.st_mode |= S_ISVTX;
+ }
unwind:
DHT_STACK_UNWIND (frame, local->op_ret, local->op_errno,
@@ -521,10 +529,11 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
dht_layout_t *layout = NULL;
xlator_t *subvol = NULL;
loc_t *loc = NULL;
+ dht_conf_t *conf = NULL;
prev = cookie;
subvol = prev->this;
-
+ conf = this->private;
local = frame->local;
loc = &local->loc;
@@ -549,8 +558,10 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
goto err;
}
- if (stbuf->st_nlink == 1)
+ if ((stbuf->st_nlink == 1)
+ && (conf->unhashed_sticky_bit)) {
stbuf->st_mode |= S_ISVTX;
+ }
dht_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino);
layout = dht_layout_for_subvol (this, prev->this);