Skip to content

Commit a635935

Browse files
committed
Fixes after review
Change-Id: I34711960e57a54a726307e0ee17df5ecc9b36766 Signed-off-by: Amar Tumballi <amar@kadalu.io>
1 parent 331618d commit a635935

32 files changed

Lines changed: 67 additions & 84 deletions

File tree

libglusterfs/src/glusterfs/list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ list_add_order(struct list_head *new, struct list_head *head,
5454
struct list_head *pos = head->prev;
5555

5656
while (pos != head) {
57-
if (IS_SUCCESS(compare(new, pos)))
57+
if (compare(new, pos) >= 0)
5858
break;
5959

6060
/* Iterate the list in the reverse order. This will have

libglusterfs/src/logging.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ _gf_msg_backtrace(int stacksize, char *callstr, size_t strsize)
10611061
ret = snprintf(callstr, strsize, "(");
10621062
PRINT_SIZE_CHECK(ret, out, strsize);
10631063

1064-
for (IS_SUCCESS((i = size - 3); i); i--) {
1064+
for (i = (size - 3); i >= 0; i--) {
10651065
ret = snprintf(callstr + savstrsize - strsize, strsize, "-->%s ",
10661066
callingfn[i]);
10671067
PRINT_SIZE_CHECK(ret, out, strsize);

rpc/rpc-lib/src/rpc-clnt.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -697,12 +697,9 @@ rpc_clnt_handle_cbk(struct rpc_clnt *clnt, rpc_transport_pollin_t *msg)
697697

698698
gf_log(clnt->conn.name, GF_LOG_TRACE,
699699
"receivd rpc message (XID: 0x%" GF_PRI_RPC_XID
700-
", "
701-
"Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID
702-
", "
703-
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
704-
") "
705-
"from rpc-transport (%s)",
700+
", Ver: %" GF_PRI_RPC_VERSION ", Program: %" GF_PRI_RPC_PROG_ID
701+
", ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
702+
") from rpc-transport (%s)",
706703
rpc_call_xid(&rpcmsg), rpc_call_rpcvers(&rpcmsg),
707704
rpc_call_program(&rpcmsg), rpc_call_progver(&rpcmsg),
708705
rpc_call_progproc(&rpcmsg), clnt->conn.name);

rpc/rpc-lib/src/rpcsvc.c

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,9 @@ rpcsvc_request_create(rpcsvc_t *svc, rpc_transport_t *trans,
539539
rpcsvc_request_init(svc, trans, &rpcmsg, progmsg, msg, req);
540540

541541
gf_log(GF_RPCSVC, GF_LOG_TRACE,
542-
"received rpc-message "
543-
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
544-
", Program: %" GF_PRI_RPC_PROG_ID
545-
", "
546-
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
547-
") "
548-
"from rpc-transport (%s)",
542+
"received rpc-message (XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
543+
", Program: %" GF_PRI_RPC_PROG_ID ", ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
544+
") from rpc-transport (%s)",
549545
rpc_call_xid(&rpcmsg), rpc_call_rpcvers(&rpcmsg),
550546
rpc_call_program(&rpcmsg), rpc_call_progver(&rpcmsg),
551547
rpc_call_progproc(&rpcmsg), trans->name);
@@ -561,13 +557,9 @@ rpcsvc_request_create(rpcsvc_t *svc, rpc_transport_t *trans,
561557
/* LOG- TODO: print rpc version, also print the peerinfo
562558
from transport */
563559
gf_log(GF_RPCSVC, GF_LOG_ERROR,
564-
"RPC version not supported "
565-
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
566-
", Program: %" GF_PRI_RPC_PROG_ID
567-
", "
568-
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
569-
") "
570-
"from trans (%s)",
560+
"RPC version not supported (XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
561+
", Program: %" GF_PRI_RPC_PROG_ID ", ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
562+
") from trans (%s)",
571563
rpc_call_xid(&rpcmsg), rpc_call_rpcvers(&rpcmsg),
572564
rpc_call_program(&rpcmsg), rpc_call_progver(&rpcmsg),
573565
rpc_call_progproc(&rpcmsg), trans->name);
@@ -583,13 +575,9 @@ rpcsvc_request_create(rpcsvc_t *svc, rpc_transport_t *trans,
583575
*/
584576
rpcsvc_request_seterr(req, AUTH_ERROR);
585577
gf_log(GF_RPCSVC, GF_LOG_ERROR,
586-
"auth failed on request. "
587-
"(XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
588-
", Program: %" GF_PRI_RPC_PROG_ID
589-
", "
590-
"ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
591-
") "
592-
"from trans (%s)",
578+
"auth failed on request. (XID: 0x%" GF_PRI_RPC_XID ", Ver: %" GF_PRI_RPC_VERSION
579+
", Program: %" GF_PRI_RPC_PROG_ID ", ProgVers: %" GF_PRI_RPC_PROG_VERS ", Proc: %" GF_PRI_RPC_PROC
580+
") from trans (%s)",
593581
rpc_call_xid(&rpcmsg), rpc_call_rpcvers(&rpcmsg),
594582
rpc_call_program(&rpcmsg), rpc_call_progver(&rpcmsg),
595583
rpc_call_progproc(&rpcmsg), trans->name);

rpc/rpc-transport/socket/src/socket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ socket_event_poll_err(rpc_transport_t *this, int gen, int idx)
13451345

13461346
pthread_mutex_lock(&priv->out_lock);
13471347
{
1348-
if (IS_SUCCESS((priv->gen == gen) && (priv->idx == idx) && (priv->sock))) {
1348+
if ((priv->gen == gen) && (priv->idx == idx) && IS_SUCCESS(priv->sock)) {
13491349
__socket_ioq_flush(priv);
13501350
__socket_reset(this);
13511351
socket_closed = _gf_true;
@@ -2535,7 +2535,7 @@ socket_event_poll_in(rpc_transport_t *this, gf_boolean_t notify_handled)
25352535
pthread_mutex_unlock(&priv->notify.lock);
25362536
}
25372537

2538-
if (IS_SUCCESS(notify_handled && (ret)))
2538+
if (notify_handled && IS_SUCCESS(ret))
25392539
gf_event_handled(ctx->event_pool, priv->sock, priv->idx, priv->gen);
25402540

25412541
if (pollin) {
@@ -2951,7 +2951,7 @@ socket_event_handler(int fd, int idx, int gen, void *data, int poll_in,
29512951
this->name, "disconnecting from");
29522952

29532953
/* Logging has happened already in earlier cases */
2954-
gf_log(IS_SUCCESS("transport", ((ret)) ? GF_LOG_INFO : GF_LOG_DEBUG),
2954+
gf_log("transport", (IS_SUCCESS(ret) ? GF_LOG_INFO : GF_LOG_DEBUG),
29552955
"EPOLLERR - disconnecting (sock:%d) (%s)", priv->sock,
29562956
(priv->use_ssl ? "SSL" : "non-SSL"));
29572957

xlators/cluster/afr/src/afr-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5785,7 +5785,7 @@ find_best_down_child(xlator_t *this)
57855785
priv = this->private;
57865786

57875787
for (i = 0; i < priv->child_count; i++) {
5788-
if (IS_SUCCESS(!priv->child_up[i] && priv->child_latency[i]) &&
5788+
if (!priv->child_up[i] && IS_SUCCESS(priv->child_latency[i]) &&
57895789
priv->child_latency[i] < best_latency) {
57905790
best_child = i;
57915791
best_latency = priv->child_latency[i];
@@ -5810,7 +5810,7 @@ find_worst_up_child(xlator_t *this)
58105810
priv = this->private;
58115811

58125812
for (i = 0; i < priv->child_count; i++) {
5813-
if (IS_SUCCESS(priv->child_up[i] && priv->child_latency[i]) &&
5813+
if (priv->child_up[i] && IS_SUCCESS(priv->child_latency[i]) &&
58145814
priv->child_latency[i] > worst_latency) {
58155815
worst_child = i;
58165816
worst_latency = priv->child_latency[i];

xlators/cluster/afr/src/afr-read-txn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ afr_read_txn_refresh_done(call_frame_t *frame, xlator_t *this, int err)
304304
readfn:
305305
if (IS_ERROR(read_subvol)) {
306306
ret = afr_inode_split_brain_choice_get(inode, this, &spb_choice);
307-
if (IS_SUCCESS((ret == 0) && spb_choice))
307+
if ((ret == 0) && IS_SUCCESS(spb_choice))
308308
read_subvol = spb_choice;
309309
}
310310

xlators/cluster/afr/src/afr-self-heal-common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,25 +1229,25 @@ afr_sh_get_fav_by_policy(xlator_t *this, struct afr_reply *replies,
12291229
switch (priv->fav_child_policy) {
12301230
case AFR_FAV_CHILD_BY_SIZE:
12311231
fav_child = afr_sh_fav_by_size(this, replies, inode);
1232-
if (IS_SUCCESS(policy_str && fav_child)) {
1232+
if (policy_str && IS_SUCCESS(fav_child)) {
12331233
*policy_str = "SIZE";
12341234
}
12351235
break;
12361236
case AFR_FAV_CHILD_BY_CTIME:
12371237
fav_child = afr_sh_fav_by_ctime(this, replies, inode);
1238-
if (IS_SUCCESS(policy_str && fav_child)) {
1238+
if (policy_str && IS_SUCCESS(fav_child)) {
12391239
*policy_str = "CTIME";
12401240
}
12411241
break;
12421242
case AFR_FAV_CHILD_BY_MTIME:
12431243
fav_child = afr_sh_fav_by_mtime(this, replies, inode);
1244-
if (IS_SUCCESS(policy_str && fav_child)) {
1244+
if (policy_str && IS_SUCCESS(fav_child)) {
12451245
*policy_str = "MTIME";
12461246
}
12471247
break;
12481248
case AFR_FAV_CHILD_BY_MAJORITY:
12491249
fav_child = afr_sh_fav_by_majority(this, replies, inode);
1250-
if (IS_SUCCESS(policy_str && fav_child)) {
1250+
if (policy_str && IS_SUCCESS(fav_child)) {
12511251
*policy_str = "MAJORITY";
12521252
}
12531253
break;

xlators/cluster/afr/src/afr-self-heal-name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ afr_selfheal_name_gfid_mismatch_check(xlator_t *this, struct afr_reply *replies,
277277
ret = afr_gfid_split_brain_source(this, replies, inode, pargfid,
278278
bname, gfid_idx_iter, i,
279279
locked_on, gfid_idx, xdata);
280-
if (IS_SUCCESS(!ret && *gfid_idx)) {
280+
if (!ret && IS_SUCCESS(*gfid_idx)) {
281281
ret = dict_set_sizen_str_sizen(xdata, "gfid-heal-msg",
282282
"GFID split-brain resolved");
283283
if (ret)

xlators/cluster/dht/src/dht-common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ dht_set_fixed_dir_stat(struct iatt *stat)
8484
static gf_boolean_t
8585
dht_match_xattr(const char *key)
8686
{
87-
return gf_get_index_by_elem(IS_SUCCESS(xattrs_to_heal, (char *)key));
87+
return IS_SUCCESS(gf_get_index_by_elem(xattrs_to_heal, (char *)key));
8888
}
8989

9090
static int
@@ -9104,7 +9104,7 @@ dht_mkdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
91049104

91059105
LOCK(&frame->lock);
91069106
{
9107-
if (IS_SUCCESS(subvol_filled && (op_ret))) {
9107+
if (subvol_filled && IS_SUCCESS(op_ret)) {
91089108
ret = dht_layout_merge(this, layout, prev, -1, ENOSPC, NULL);
91099109
} else {
91109110
if (IS_ERROR(op_ret) && op_errno == EEXIST) {

0 commit comments

Comments
 (0)