From e97f01ac5c9e2774510807728e52e8acc9524a88 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Wed, 13 Nov 2019 15:39:59 +0530 Subject: afr: fix log flooding Commit "ccf33e789 - dict.c: remove redundant checks" removed some NULL checks in certain dict functions. This caused flooding of fuse mount logs when I/O was done on the mount on a replica volume: Message: W [dict.c:1478:dict_get_with_refn] (-->/usr/local/lib/libglusterfs.so.0(dict_get_uint32+0x4d) [0x7ff9121ec963] -->/usr/local/lib/libglusterfs.so.0(dict_get_with_ref+0x90) [0x7ff9121eb93f] -->/usr/local/lib/libglusterfs.so.0(+0x229be) [0x7ff9121eb9be] ) 0-dict: dict OR key (glusterfs.lk.lkmode) is NULL [Invalid argument] Fix: In the relevant AFR functions, check that dict is not NULL before trying to perform operations on it. See bug description for more details. fixes: bz#1772006 Change-Id: I30c89c0b5d6c80cc86a6047aae70127769412120 Signed-off-by: Ravishankar N --- xlators/cluster/afr/src/afr-common.c | 2 ++ xlators/cluster/afr/src/afr.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 07bf53a1941..bc34a023d2f 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1652,6 +1652,8 @@ afr_readables_fill(call_frame_t *frame, xlator_t *this, inode_t *inode, ia_type = inode->ia_type; } + if (!xdata) + continue; /* mkdir_cbk sends NULL xdata_rsp. */ afr_accused_fill(this, xdata, data_accused, (ia_type == IA_IFDIR) ? AFR_ENTRY_TRANSACTION : AFR_DATA_TRANSACTION); diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 28be839ad68..e0aad4e38ff 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -1112,7 +1112,8 @@ afr_cleanup_fd_ctx(xlator_t *this, fd_t *fd); if (__local && __local->is_read_txn) \ afr_pending_read_decrement(__this->private, \ __local->read_subvol); \ - if (__local && afr_is_lock_mode_mandatory(__local->xdata_req)) \ + if (__local && __local->xdata_req && \ + afr_is_lock_mode_mandatory(__local->xdata_req)) \ afr_dom_lock_release(frame); \ frame->local = NULL; \ } \ -- cgit