diff options
author | Soumya Koduri <skoduri@redhat.com> | 2016-08-04 16:00:31 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2016-08-13 01:04:01 -0700 |
commit | dae860ab7e1c5a205646393f2cb80a0a06986c30 (patch) | |
tree | bff0532514ac345cd83ac976c5f8ce6b0594a965 /libglusterfs | |
parent | a027be1229eb68ce1bbf8b4092673c80bf4a18fc (diff) |
inode: Adjust lru_size while retiring entries in lru list
As part of inode_table_destroy(), we first retire entries
in the lru list but the lru_size is not adjusted accordingly.
This may result in invalid memory reference in inode_table_prune
if the lru_size > lru_limit.
> Reviewed-on: http://review.gluster.org/15087
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-by: Prashanth Pai <ppai@redhat.com>
BUG: 1362540
Change-Id: I29ee3c03b0eaa8a118d06dc0cefba85877daf963
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Reviewed-on: http://review.gluster.org/15129
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Prashanth Pai <ppai@redhat.com>
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>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/inode.c | 9 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs-messages.h | 10 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index ab4b505e22f..2aca41bed17 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1514,6 +1514,14 @@ inode_table_prune (inode_table_t *table) { while (table->lru_limit && table->lru_size > (table->lru_limit)) { + if (list_empty (&table->lru)) { + gf_msg_callingfn (THIS->name, GF_LOG_WARNING, 0, + LG_MSG_INVALID_INODE_LIST, + "Empty inode lru list found" + " but with (%d) lru_size", + table->lru_size); + break; + } entry = list_entry (table->lru.next, inode_t, list); @@ -1783,6 +1791,7 @@ inode_table_destroy (inode_table_t *inode_table) { inode_t, list); __inode_forget (trav, 0); __inode_retire (trav); + inode_table->lru_size--; } while (!list_empty (&inode_table->active)) { diff --git a/libglusterfs/src/libglusterfs-messages.h b/libglusterfs/src/libglusterfs-messages.h index d18f4cb3112..d2ad44e470e 100644 --- a/libglusterfs/src/libglusterfs-messages.h +++ b/libglusterfs/src/libglusterfs-messages.h @@ -36,7 +36,7 @@ */ #define GLFS_LG_BASE GLFS_MSGID_COMP_LIBGLUSTERFS -#define GLFS_LG_NUM_MESSAGES 206 +#define GLFS_LG_NUM_MESSAGES 207 #define GLFS_LG_MSGID_END (GLFS_LG_BASE + GLFS_LG_NUM_MESSAGES + 1) /* Messaged with message IDs */ #define glfs_msg_start_lg GLFS_LG_BASE, "Invalid: Start of messages" @@ -1762,6 +1762,14 @@ * @recommendedaction * */ +#define LG_MSG_INVALID_INODE_LIST (GLFS_LG_BASE + 207) + +/*! + * @messageid + * @diagnosis + * @recommendedaction + * + */ /*------------*/ #define glfs_msg_end_lg GLFS_LG_MSGID_END, "Invalid: End of messages" |