diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2020-06-16 14:45:03 +0300 |
---|---|---|
committer | Amar Tumballi <amar@kadalu.io> | 2020-06-18 16:22:11 +0000 |
commit | 2ef75183ab3faa68b79d3d38318d4120cfc657d1 (patch) | |
tree | 5d04081dd47a98237e68bd01fd2e399ec67b7480 /cli/src/cli-rpc-ops.c | |
parent | 351091657359b41a261ea43c2fcddf5629f44943 (diff) |
cli: fix data race when handling connection status
Found with GCC ThreadSanitizer:
WARNING: ThreadSanitizer: data race (pid=287943)
Write of size 4 at 0x00000047dfa0 by thread T4:
#0 cli_rpc_notify /path/to/glusterfs/cli/src/cli.c:313 (gluster+0x40a6df)
#1 rpc_clnt_handle_disconnect /path/to/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:821 (libgfrpc.so.0+0x13f04)
#2 rpc_clnt_notify /path/to/glusterfs/rpc/rpc-lib/src/rpc-clnt.c:882 (libgfrpc.so.0+0x13f04)
#3 rpc_transport_notify /path/to/glusterfs/rpc/rpc-lib/src/rpc-transport.c:520 (libgfrpc.so.0+0xf070)
#4 socket_event_poll_err /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:1364 (socket.so+0x812c)
#5 socket_event_handler /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:2958 (socket.so+0xc453)
#6 socket_event_handler /path/to/glusterfs/rpc/rpc-transport/socket/src/socket.c:2854 (socket.so+0xc453)
#7 event_dispatch_epoll_handler /path/to/glusterfs/libglusterfs/src/event-epoll.c:640 (libglusterfs.so.0+0xcaf23)
#8 event_dispatch_epoll_worker /path/to/glusterfs/libglusterfs/src/event-epoll.c:751 (libglusterfs.so.0+0xcaf23)
#9 <null> <null> (libtsan.so.0+0x2d33f)
Previous read of size 4 at 0x00000047dfa0 by thread T3 (mutexes: write M3587):
#0 cli_cmd_await_connected /path/to/glusterfs/cli/src/cli-cmd.c:321 (gluster+0x40ca37)
#1 cli_cmd_process /path/to/glusterfs/cli/src/cli-cmd.c:123 (gluster+0x40cc74)
#2 cli_batch /path/to/glusterfs/cli/src/input.c:29 (gluster+0x40c2b9)
#3 <null> <null> (libtsan.so.0+0x2d33f)
Location is global 'connected' of size 4 at 0x00000047dfa0 (gluster+0x00000047dfa0)
Change-Id: Ie85a8a80a2c5b82252c0c1d45e68ebe9938da2eb
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Fixes: #1311
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 7a97798ae3f..e9cb81948ee 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -50,7 +50,6 @@ enum gf_task_types { GF_TASK_TYPE_REBALANCE, GF_TASK_TYPE_REMOVE_BRICK }; extern struct rpc_clnt *global_quotad_rpc; rpc_clnt_prog_t cli_quotad_clnt; extern rpc_clnt_prog_t *cli_rpc_prog; -extern int connected; static int32_t gf_cli_remove_brick(call_frame_t *frame, xlator_t *this, void *data); @@ -3406,7 +3405,7 @@ gf_cli_quota_list(cli_local_t *local, char *volname, dict_t *dict, char *default_sl, int count, int op_ret, int op_errno, char *op_errstr) { - if (!connected) + if (!cli_cmd_connected()) goto out; if (count > 0) { |