diff options
| author | N Balachandran <nbalacha@redhat.com> | 2016-07-26 11:57:18 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2016-07-26 08:14:02 -0700 | 
| commit | ed1c986bff37e783a19fc43e38066a74ece13cc5 (patch) | |
| tree | 6efba2c460a11e2b6e817576cd2383607f3f38c3 | |
| parent | c35dc4fb18e6d942ae773fd1e6ab1636bcdd1788 (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: If459f46d3ce9258f595d0ca7ef55942bf466d767
BUG: 1360122
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/15009
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: Niels de Vos <ndevos@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 | 5 | ||||
| -rw-r--r-- | xlators/features/changetimerecorder/src/ctr-messages.h (renamed from libglusterfs/src/ctr-messages.h) | 4 | 
4 files changed, 11 insertions, 3 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index 63feb380e66..2a4f76421fa 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -50,7 +50,7 @@ libglusterfs_la_HEADERS = common-utils.h defaults.h default-args.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 libglusterfs-messages.h tw.h \ -	ctr-messages.h lvm-defaults.h quota-common-utils.h rot-buffs.h \ +	lvm-defaults.h quota-common-utils.h rot-buffs.h \  	compat-uuid.h upcall-utils.h  libglusterfs_ladir = $(includedir)/glusterfs diff --git a/xlators/features/changetimerecorder/src/Makefile.am b/xlators/features/changetimerecorder/src/Makefile.am index 44cebd6aedf..503c6db5286 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 b6ff18934fe..5f3a074acd5 100644 --- a/xlators/features/changetimerecorder/src/changetimerecorder.c +++ b/xlators/features/changetimerecorder/src/changetimerecorder.c @@ -842,6 +842,11 @@ ctr_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          }          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) { diff --git a/libglusterfs/src/ctr-messages.h b/xlators/features/changetimerecorder/src/ctr-messages.h index 27de07a0d8e..5b367dd8511 100644 --- a/libglusterfs/src/ctr-messages.h +++ b/xlators/features/changetimerecorder/src/ctr-messages.h @@ -41,7 +41,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" @@ -495,6 +495,8 @@   * @recommendedaction   *   */ +#define CTR_MSG_NULL_LOCAL                               (GLFS_COMP_BASE + 57) +  /*------------*/  #define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"  | 
