diff options
author | N Balachandran <nbalacha@redhat.com> | 2016-07-26 11:27:16 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2016-07-27 05:58:27 -0700 |
commit | bda4a2be0bba608d61bd04815e92b2d4cc63e7f2 (patch) | |
tree | b22ac8d0977f564869a18a21f273e7cc7d52e114 | |
parent | a5b9677500bb61abda1693973668c21428beff79 (diff) |
features/ctr: Check for NULL local
This is a defensive fix to prevent a crash reported
during a rename operation. This is not reproducible
under normal circumstances.
This patch also moves ctr-messages.h to the src dir
of the changetimerecorder xlator.
Backported from master: http://review.gluster.org/#/c/14964/
Change-Id: I2aac2d4da5752f6a0b45a70e0d97a4d506532ff4
BUG: 1360125
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/15007
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Milind Changire <mchangir@redhat.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
-rw-r--r-- | libglusterfs/src/Makefile.am | 2 | ||||
-rw-r--r-- | xlators/features/changetimerecorder/src/Makefile.am | 3 | ||||
-rw-r--r-- | xlators/features/changetimerecorder/src/changetimerecorder.c | 8 | ||||
-rw-r--r-- | xlators/features/changetimerecorder/src/ctr-messages.h (renamed from libglusterfs/src/ctr-messages.h) | 6 |
4 files changed, 15 insertions, 4 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index e56d92d6e17..ab209e0630d 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -45,7 +45,7 @@ noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h timespec. run.h options.h lkowner.h fd-lk.h circ-buff.h event-history.h \ gidcache.h client_t.h glusterfs-acl.h glfs-message-id.h \ template-component-messages.h strfd.h syncop-utils.h parse-utils.h \ - ctr-messages.h libglusterfs-messages.h \ + libglusterfs-messages.h \ $(CONTRIBDIR)/mount/mntent_compat.h lvm-defaults.h \ $(CONTRIBDIR)/libexecinfo/execinfo_compat.h \ unittest/unittest.h quota-common-utils.h rot-buffs.h \ diff --git a/xlators/features/changetimerecorder/src/Makefile.am b/xlators/features/changetimerecorder/src/Makefile.am index 630dd8e6e15..f447a16c97e 100644 --- a/xlators/features/changetimerecorder/src/Makefile.am +++ b/xlators/features/changetimerecorder/src/Makefile.am @@ -12,7 +12,8 @@ changetimerecorder_la_SOURCES = changetimerecorder.c ctr-helper.c ctr-xlator-ctx changetimerecorder_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la\ $(top_builddir)/libglusterfs/src/gfdb/libgfdb.la -noinst_HEADERS = changetimerecorder.h ctr_mem_types.h ctr-helper.h ctr-xlator-ctx.h +noinst_HEADERS = ctr-messages.h changetimerecorder.h ctr_mem_types.h \ + ctr-helper.h ctr-xlator-ctx.h AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \ -I$(top_srcdir)/libglusterfs/src/gfdb \ diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c index 0631d5e6c73..9e748448061 100644 --- a/xlators/features/changetimerecorder/src/changetimerecorder.c +++ b/xlators/features/changetimerecorder/src/changetimerecorder.c @@ -835,13 +835,19 @@ ctr_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (ret) { gf_msg (this->name, GF_LOG_ERROR, 0, CTR_MSG_GET_CTR_RESPONSE_LINK_COUNT_XDATA_FAILED, - "Failed to getting GF_RESPONSE_LINK_COUNT_XDATA"); + "Failed to get GF_RESPONSE_LINK_COUNT_XDATA"); remaining_links = -1; goto out; } ctr_local = frame->local; + if (!ctr_local) { + gf_msg (this->name, GF_LOG_ERROR, 0, CTR_MSG_NULL_LOCAL, + "ctr_local is NULL."); + goto out; + } + /* This is not the only link */ if (remaining_links > 1) { fop_type = GFDB_FOP_DENTRY_WRITE; diff --git a/libglusterfs/src/ctr-messages.h b/xlators/features/changetimerecorder/src/ctr-messages.h index 1fe0587ba3d..14573a4afb2 100644 --- a/libglusterfs/src/ctr-messages.h +++ b/xlators/features/changetimerecorder/src/ctr-messages.h @@ -36,7 +36,7 @@ */ #define GLFS_COMP_BASE GLFS_MSGID_COMP_CTR -#define GLFS_NUM_MESSAGES 56 +#define GLFS_NUM_MESSAGES 57 #define GLFS_MSGID_END (GLFS_COMP_BASE + GLFS_NUM_MESSAGES + 1) /* Messaged with message IDs */ #define glfs_msg_start_x GLFS_COMP_BASE, "Invalid: Start of messages" @@ -490,6 +490,10 @@ * @recommendedaction * */ + +#define CTR_MSG_NULL_LOCAL (GLFS_COMP_BASE + 57) + + /*------------*/ #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages" |