summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-10-18 10:30:42 +0530
committerAnand Avati <avati@gluster.com>2011-10-20 04:13:50 -0700
commit84ebee8c20ce667a5ec5fddc0aa47f8b5bef39f8 (patch)
treef38e977ced3c0b2d6e8c47d3aeeea4bdc3fce208
parent26a51e5e6ec1639a7601c0fc373fd9f6493b014a (diff)
build: warning suppression (round n)
with this patch, there are no more warnings with gcc (GCC) 4.6.1 20110908 Change-Id: Ice0d52d304b9846395f8a4a191c98eb53125f792 BUG: 2550 Reviewed-on: http://review.gluster.com/607 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
-rw-r--r--cli/src/cli-rl.c5
-rw-r--r--libglusterfs/src/common-utils.c19
-rw-r--r--libglusterfs/src/daemon.c9
-rw-r--r--libglusterfs/src/mem-pool.c3
-rw-r--r--libglusterfs/src/options.c4
-rw-r--r--libglusterfs/src/statedump.c21
-rw-r--r--libglusterfs/src/statedump.h4
-rw-r--r--xlators/cluster/afr/src/afr-common.c3
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c9
-rw-r--r--xlators/cluster/afr/src/pump.c19
-rw-r--r--xlators/cluster/dht/src/dht-common.c15
-rw-r--r--xlators/cluster/stripe/src/stripe.c9
-rw-r--r--xlators/features/marker/src/marker.c8
-rw-r--r--xlators/features/quota/src/quota.c5
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c2
-rw-r--r--xlators/nfs/server/src/mount3.c5
-rw-r--r--xlators/performance/io-cache/src/io-cache.c18
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c20
18 files changed, 134 insertions, 44 deletions
diff --git a/cli/src/cli-rl.c b/cli/src/cli-rl.c
index 80b14620fba..592da7baa78 100644
--- a/cli/src/cli-rl.c
+++ b/cli/src/cli-rl.c
@@ -89,9 +89,14 @@ cli_rl_process_line (char *line)
state->rl_processing = 1;
{
ret = cli_cmd_process_line (state, line);
+ if (ret)
+ gf_log (THIS->name, GF_LOG_WARNING,
+ "failed to process line");
+
add_history (line);
}
state->rl_processing = 0;
+
}
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 2d4415f506d..e7d54d48b22 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -357,6 +357,9 @@ gf_print_trace (int32_t signum)
/* Pending frames, (if any), list them in order */
ret = write (fd, "pending frames:\n", 16);
+ if (ret < 0)
+ goto out;
+
{
glusterfs_ctx_t *ctx = glusterfs_ctx_get ();
struct list_head *trav = ((call_pool_t *)ctx->pool)->all_frames.next;
@@ -372,16 +375,25 @@ gf_print_trace (int32_t signum)
gf_mgmt_list[tmp->root->op]);
ret = write (fd, msg, strlen (msg));
+ if (ret < 0)
+ goto out;
+
trav = trav->next;
}
ret = write (fd, "\n", 1);
+ if (ret < 0)
+ goto out;
}
sprintf (msg, "patchset: %s\n", GLUSTERFS_REPOSITORY_REVISION);
ret = write (fd, msg, strlen (msg));
+ if (ret < 0)
+ goto out;
sprintf (msg, "signal received: %d\n", signum);
ret = write (fd, msg, strlen (msg));
+ if (ret < 0)
+ goto out;
{
/* Dump the timestamp of the crash too, so the previous logs
@@ -390,7 +402,11 @@ gf_print_trace (int32_t signum)
tm = localtime (&utime);
strftime (timestr, 256, "%Y-%m-%d %H:%M:%S\n", tm);
ret = write (fd, "time of crash: ", 15);
+ if (ret < 0)
+ goto out;
ret = write (fd, timestr, strlen (timestr));
+ if (ret < 0)
+ goto out;
}
gf_dump_config_flags (fd);
@@ -404,9 +420,12 @@ gf_print_trace (int32_t signum)
backtrace_symbols_fd (&array[1], size-1, fd);
sprintf (msg, "---------\n");
ret = write (fd, msg, strlen (msg));
+ if (ret < 0)
+ goto out;
}
#endif /* HAVE_BACKTRACE */
+out:
/* Send a signal to terminate the process */
signal (signum, SIG_DFL);
raise (signum);
diff --git a/libglusterfs/src/daemon.c b/libglusterfs/src/daemon.c
index 51b14810cc4..778196164b8 100644
--- a/libglusterfs/src/daemon.c
+++ b/libglusterfs/src/daemon.c
@@ -29,7 +29,6 @@ os_daemon_return (int nochdir, int noclose)
int ret = -1;
FILE *ptr = NULL;
-
ret = fork();
if (ret)
return ret;
@@ -46,8 +45,16 @@ os_daemon_return (int nochdir, int noclose)
if (!noclose) {
ptr = freopen (DEVNULLPATH, "r", stdin);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stdout);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stderr);
+ if (!ptr)
+ goto out;
}
ret = 0;
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
index 95e91567e16..4cad56dd906 100644
--- a/libglusterfs/src/mem-pool.c
+++ b/libglusterfs/src/mem-pool.c
@@ -336,6 +336,9 @@ mem_pool_new_fn (unsigned long sizeof_type,
return NULL;
ret = gf_asprintf (&mem_pool->name, "%s:%s", THIS->name, name);
+ if (ret < 0)
+ return NULL;
+
if (!mem_pool->name) {
GF_FREE (mem_pool);
return NULL;
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 1e6413cc0a9..b8d3b6ae5a8 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -647,6 +647,10 @@ xl_opt_validate (dict_t *dict, char *key, data_t *value, void *data)
return;
ret = xlator_option_validate (xl, key, value->data, opt, &errstr);
+ if (ret)
+ gf_log (xl->name, GF_LOG_WARNING, "validate of %s returned %d",
+ key, ret);
+
if (errstr)
/* possible small leak of previously set stub->errstr */
stub->errstr = errstr;
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 52de73b50e3..c744c6c5ff8 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -88,13 +88,12 @@ gf_proc_dump_close (void)
}
-void
+int
gf_proc_dump_add_section (char *key, ...)
{
char buf[GF_DUMP_MAX_BUF_LEN];
va_list ap;
- int ret;
GF_ASSERT(key);
@@ -106,18 +105,17 @@ gf_proc_dump_add_section (char *key, ...)
va_end (ap);
snprintf (buf + strlen(buf),
GF_DUMP_MAX_BUF_LEN - strlen (buf), "]\n");
- ret = write (gf_dump_fd, buf, strlen (buf));
+ return write (gf_dump_fd, buf, strlen (buf));
}
-void
+int
gf_proc_dump_write (char *key, char *value,...)
{
char buf[GF_DUMP_MAX_BUF_LEN];
int offset = 0;
va_list ap;
- int ret;
GF_ASSERT (key);
@@ -133,7 +131,7 @@ gf_proc_dump_write (char *key, char *value,...)
offset = strlen (buf);
snprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, "\n");
- ret = write (gf_dump_fd, buf, strlen (buf));
+ return write (gf_dump_fd, buf, strlen (buf));
}
static void
@@ -421,7 +419,12 @@ gf_proc_dump_parse_set_option (char *key, char *value)
"matched key : %s\n", key);
ret = write (gf_dump_fd, buf, strlen (buf));
- return -1;
+ /* warning suppression */
+ if (ret >= 0) {
+ ret = -1;
+ goto out;
+ }
+
}
opt_value = (strncasecmp (value, "yes", 3) ?
@@ -429,7 +432,9 @@ gf_proc_dump_parse_set_option (char *key, char *value)
GF_PROC_DUMP_SET_OPTION (*opt_key, opt_value);
- return 0;
+ ret = 0;
+out:
+ return ret;
}
static int
diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h
index fb07f5927a2..1c56d6cfa8a 100644
--- a/libglusterfs/src/statedump.h
+++ b/libglusterfs/src/statedump.h
@@ -71,9 +71,9 @@ void gf_proc_dump_cleanup(void);
void gf_proc_dump_info(int signum);
-void gf_proc_dump_add_section(char *key,...);
+int gf_proc_dump_add_section(char *key,...);
-void gf_proc_dump_write(char *key, char *value,...);
+int gf_proc_dump_write(char *key, char *value,...);
void inode_table_dump(inode_table_t *itable, char *prefix);
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index e6b0881fc9d..acefa697f8a 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -2235,7 +2235,6 @@ afr_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
int ret = -1;
int op_ret = -1;
int op_errno = 0;
- int call_count = 0;
VALIDATE_OR_GOTO (frame, out);
VALIDATE_OR_GOTO (this, out);
@@ -2251,8 +2250,6 @@ afr_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
goto out;
}
- call_count = afr_up_children_count (local->child_up, priv->child_count);
-
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
op_errno = ENOMEM;
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 1828ddde789..33ddb9db11b 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -587,7 +587,6 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
struct gf_flock flock = {0,};
- struct gf_flock full_flock = {0,};
int call_count = 0;
int i = 0;
int piggyback = 0;
@@ -602,13 +601,10 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
flock.l_len = int_lock->lk_flock.l_len;
flock.l_type = F_UNLCK;
-
gf_log (this->name, GF_LOG_DEBUG, "attempting data unlock range %"PRIu64
" %"PRIu64" by %"PRIu64, flock.l_start, flock.l_len,
frame->root->lk_owner);
- full_flock.l_type = F_UNLCK;
-
call_count = afr_locked_nodes_count (int_lock->inode_locked_nodes,
priv->child_count);
@@ -2120,7 +2116,12 @@ afr_lock_recovery_preopen (call_frame_t *frame, xlator_t *this)
GF_ASSERT (local && local->fd);
ret = fd_ctx_get (local->fd, this, &tmp);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to get the context of fd",
+ uuid_utoa (local->fd->inode->gfid));
fdctx = (afr_fd_ctx_t *) (long) tmp;
+ /* TODO: instead we should return from the function */
GF_ASSERT (fdctx);
child_index = local->lock_recovery_child;
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 4d5d9ec44c6..9154c2eadbf 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -171,17 +171,18 @@ pump_save_path (xlator_t *this, const char *path)
dict = dict_new ();
dict_ret = dict_set_str (dict, PUMP_PATH, (char *)path);
+ if (dict_ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set the key %s", path, PUMP_PATH);
ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"setxattr failed - could not save path=%s", path);
} else {
gf_log (this->name, GF_LOG_DEBUG,
"setxattr succeeded - saved path=%s", path);
- gf_log (this->name, GF_LOG_DEBUG,
- "Saving path for status info");
}
dict_unref (dict);
@@ -248,13 +249,9 @@ pump_get_resume_path (xlator_t *this)
static int
pump_update_resume_state (xlator_t *this, const char *path)
{
- afr_private_t *priv = NULL;
-
pump_state_t state;
const char *resume_path = NULL;
- priv = this->private;
-
state = pump_get_state ();
if (state == PUMP_STATE_RESUME) {
@@ -546,6 +543,10 @@ pump_complete_migration (xlator_t *this)
pump_priv->pump_finished = _gf_true;
dict_ret = dict_set_str (dict, PUMP_SOURCE_COMPLETE, "jargon");
+ if (dict_ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set the key %s",
+ loc.path, PUMP_SOURCE_COMPLETE);
ret = syncop_setxattr (PUMP_SOURCE_CHILD (this), &loc, dict, 0);
if (ret < 0) {
@@ -553,6 +554,10 @@ pump_complete_migration (xlator_t *this)
"setxattr failed - while notifying source complete");
}
dict_ret = dict_set_str (dict, PUMP_SINK_COMPLETE, "jargon");
+ if (dict_ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set the key %s",
+ loc.path, PUMP_SINK_COMPLETE);
ret = syncop_setxattr (PUMP_SINK_CHILD (this), &loc, dict, 0);
if (ret < 0) {
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 0fa14968beb..109bc77f208 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -881,9 +881,13 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)
local->xattr = NULL;
}
- if (!uuid_is_null (local->gfid))
+ if (!uuid_is_null (local->gfid)) {
ret = dict_set_static_bin (local->xattr_req, "gfid-req",
local->gfid, 16);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set gfid", local->loc.path);
+ }
for (i = 0; i < call_cnt; i++) {
STACK_WIND (frame, dht_lookup_dir_cbk,
@@ -3206,6 +3210,9 @@ dht_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_merge (this, layout, prev->this,
op_ret, op_errno, NULL);
}
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to merge layouts", local->loc.path);
if (op_ret == -1) {
local->op_errno = op_errno;
@@ -3260,6 +3267,12 @@ dht_mkdir_hashed_cbk (call_frame_t *frame, void *cookie,
ret = dht_layout_merge (this, layout, prev->this,
op_ret, op_errno, NULL);
+ /* TODO: we may have to return from the function
+ if layout merge fails. For now, lets just log an error */
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to merge layouts", local->loc.path);
+
if (op_ret == -1) {
local->op_errno = op_errno;
goto err;
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 8ba624efa22..206b1e1327c 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -199,7 +199,7 @@ stripe_entry_self_heal (call_frame_t *frame, xlator_t *this,
ret = dict_set_static_bin (dict, "gfid-req", local->stbuf.ia_gfid, 16);
if (ret)
gf_log (this->name, GF_LOG_WARNING,
- "failed to set gfid-req");
+ "%s: failed to set gfid-req", local->loc.path);
while (trav) {
if (IA_ISREG (local->stbuf.ia_type)) {
@@ -2139,7 +2139,6 @@ stripe_first_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
inode_t *inode, struct iatt *buf, struct iatt *preparent,
struct iatt *postparent)
{
- int32_t callcnt = 0;
stripe_local_t *local = NULL;
stripe_private_t *priv = NULL;
call_frame_t *prev = NULL;
@@ -2164,7 +2163,7 @@ stripe_first_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
trav = this->children;
loc = &local->loc;
- callcnt = --local->call_count;
+ --local->call_count;
if (op_ret == -1) {
gf_log (this->name, GF_LOG_DEBUG, "%s returned error %s",
@@ -2210,7 +2209,7 @@ stripe_first_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local->stbuf.ia_size = local->stbuf_size;
local->stbuf.ia_blocks = local->stbuf_blocks;
}
-
+
/* Send a setxattr request to nodes where the
files are created */
sprintf (size_key, "trusted.%s.stripe-size", this->name);
@@ -2274,7 +2273,6 @@ stripe_create (call_frame_t *frame, xlator_t *this, loc_t *loc,
{
stripe_private_t *priv = NULL;
stripe_local_t *local = NULL;
- xlator_list_t *trav = NULL;
int32_t op_errno = EINVAL;
int ret = 0;
int need_unref = 0;
@@ -2329,7 +2327,6 @@ stripe_create (call_frame_t *frame, xlator_t *this, loc_t *loc,
sprintf (count_key, "trusted.%s.stripe-count", this->name);
sprintf (index_key, "trusted.%s.stripe-index", this->name);
- trav = this->children;
if (priv->xattr_supported) {
dict = dict_new ();
if (!dict) {
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 7ddc7968f2e..0faa8be5848 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -236,6 +236,9 @@ marker_getxattr_stampfile_cbk (call_frame_t *frame, xlator_t *this,
ret = dict_set_bin (dict, (char *)name, vol_mark,
sizeof (struct volume_mark));
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "failed to set key %s",
+ name);
STACK_UNWIND_STRICT (getxattr, frame, 0, 0, dict);
@@ -390,8 +393,9 @@ marker_start_setxattr (call_frame_t *frame, xlator_t *this)
ret = dict_set_static_bin (dict, priv->marker_xattr,
(void *)local->timebuf, 8);
-
- gf_log (this->name, GF_LOG_DEBUG, "path = %s", local->loc.path);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to set marker xattr (%s)", local->loc.path);
STACK_WIND (frame, marker_specific_setxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->setxattr, &local->loc, dict, 0);
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index c15d59f5458..3ec480a94df 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -812,6 +812,11 @@ quota_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
ret = inode_ctx_get (local->loc.inode, this, &ctx_int);
+ if (ret) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to get the context", local->loc.path);
+ goto out;
+ }
ctx = (quota_inode_ctx_t *)(unsigned long) ctx_int;
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 9c4be889293..70aac385f10 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -3023,6 +3023,8 @@ fuse_first_lookup (xlator_t *this)
memset (gfid, 0, 16);
gfid[15] = 1;
ret = dict_set_static_bin (dict, "gfid-req", gfid, 16);
+ if (ret)
+ gf_log (xl->name, GF_LOG_ERROR, "failed to set 'gfid-req'");
STACK_WIND (frame, fuse_first_lookup_cbk, xl, xl->fops->lookup,
&loc, dict);
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index 62ad343849f..89634af94c8 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -1443,7 +1443,10 @@ mnt3_init_export_ent (struct mount3_state *ms, xlator_t *xl, char *exportpath,
exp->exptype = MNT3_EXPTYPE_VOLUME;
ret = snprintf (exp->expname, alloclen, "/%s", xl->name);
}
-
+ if (ret < 0) {
+ gf_log (xl->name, GF_LOG_WARNING,
+ "failed to get the export name");
+ }
/* Just copy without discrimination, we'll determine whether to
* actually use it when a mount request comes in and a file handle
* needs to be built.
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index b848910c14c..8b32a4f0637 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -649,6 +649,10 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|| ((table->max_file_size > 0)
&& (table->max_file_size < ioc_inode->ia_size))) {
ret = fd_ctx_set (fd, this, 1);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set fd ctx",
+ local->file_loc.path);
}
}
ioc_inode_unlock (ioc_inode);
@@ -657,16 +661,26 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
(uint64_t)(long)ioc_inode);
/* If O_DIRECT open, we disable caching on it */
- if (local->flags & O_DIRECT)
+ if (local->flags & O_DIRECT) {
/*
* O_DIRECT is only for one fd, not the inode
* as a whole */
ret = fd_ctx_set (fd, this, 1);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set fd ctx",
+ local->file_loc.path);
+ }
/* if weight == 0, we disable caching on it */
- if (!weight)
+ if (!weight) {
/* we allow a pattern-matched cache disable this way */
ret = fd_ctx_set (fd, this, 1);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to set fd ctx",
+ local->file_loc.path);
+ }
}
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 7a80d119577..a0a47134a4d 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -171,7 +171,6 @@ static int
acl_permits (call_frame_t *frame, inode_t *inode, int want)
{
int verdict = 0;
- int ret = 0;
struct posix_acl *acl = NULL;
struct posix_ace *ace = NULL;
struct posix_acl_ctx *ctx = NULL;
@@ -190,8 +189,7 @@ acl_permits (call_frame_t *frame, inode_t *inode, int want)
if (frame_is_super_user (frame))
goto green;
- ret = posix_acl_get (inode, frame->this, &acl, NULL);
-
+ posix_acl_get (inode, frame->this, &acl, NULL);
if (!acl) {
acl = posix_acl_ref (frame->this, conf->minimal_acl);
}
@@ -723,7 +721,9 @@ acl_set:
posix_acl_ctx_update (inode, this, buf);
ret = posix_acl_set (inode, this, acl_access, acl_default);
-
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to set ACL in context");
unwind:
my_xattr = frame->local;
frame->local = NULL;
@@ -769,7 +769,14 @@ green:
}
ret = dict_set_int8 (my_xattr, POSIX_ACL_ACCESS_XATTR, 0);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "failed to set key %s",
+ POSIX_ACL_ACCESS_XATTR);
+
ret = dict_set_int8 (my_xattr, POSIX_ACL_DEFAULT_XATTR, 0);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "failed to set key %s",
+ POSIX_ACL_DEFAULT_XATTR);
frame->local = my_xattr;
STACK_WIND (frame, posix_acl_lookup_cbk,
@@ -1644,7 +1651,6 @@ posix_acl_setxattr_update (xlator_t *this, inode_t *inode, dict_t *xattr)
struct posix_acl *old_default = NULL;
struct posix_acl_ctx *ctx = NULL;
int ret = 0;
- mode_t mode = 0;
ctx = posix_acl_ctx_get (inode, this);
if (!ctx)
@@ -1663,7 +1669,7 @@ posix_acl_setxattr_update (xlator_t *this, inode_t *inode, dict_t *xattr)
ret = posix_acl_set (inode, this, acl_access, acl_default);
if (acl_access && acl_access != old_access) {
- mode = posix_acl_access_set_mode (acl_access, ctx);
+ posix_acl_access_set_mode (acl_access, ctx);
}
if (acl_access)
@@ -1675,7 +1681,7 @@ posix_acl_setxattr_update (xlator_t *this, inode_t *inode, dict_t *xattr)
if (old_default)
posix_acl_unref (this, old_default);
- return 0;
+ return ret;
}