summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/inode.c
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2016-08-04 16:00:31 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-08-10 21:15:19 -0700
commit9eac3cda9de3144a18e86c8eda2428cbad1e732d (patch)
tree345bda28e587b0b2aa4f0dc4724bb40362c32a52 /libglusterfs/src/inode.c
parentd0ff4ab470c0530677a41c494ee56180b7aacfde (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: 1365746 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/15128 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src/inode.c')
-rw-r--r--libglusterfs/src/inode.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index b70b4a93957..e45fe0deb4a 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -1519,6 +1519,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);
@@ -1788,6 +1796,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)) {