diff options
author | Soumya Koduri <skoduri@redhat.com> | 2016-02-08 22:33:56 +0530 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2016-02-27 11:04:25 -0800 |
commit | 6f12a5767f6912f6913cd9dfa4c6a5484a766000 (patch) | |
tree | 5653e2e98177452d22c7554aa6d7956ec58a4192 | |
parent | 30e883d49475c5a99abdb4745e708bb1f9e25144 (diff) |
gfapi: Use inode_forget in case of handle objects
Currently with gfapi, even if applications release their
reference on paritular inode entries, those entries never
get destroyed as they shall always have positive nlookup
count unless inode_table exceeds lru limit.
Since inodes and their contexts can consume considerable
amount of memory, applications may end up consuming lot of
memory and may even get OOM killed.
To avoid that, have considered below approaches (for handle based access)-
a) Do 'inode_lookup' only if the corresponding inode is created
for the first time and forget it during close of the handle
This shall not work as multiple handle objects can refer to
same inode entry and inode_forget from second handle object
onwards shall result in assert.
b) Do 'inode_lookup' during a handle or fd creation
But this approach shall affect the performance of the fops which
operate on neither handle nor fd.
c) current approach taken-
Applications using glfs handle objects hold a reference
on corresponding inode entries. Hence it is safe to forget
those inodes and make nlookup count to '0' while trying to
delete those handle objects. That way the last unref (i.e,
from the last handle close) shall result in inode_destroy().
This is backport of the below patch
- http://review.gluster.org/13096
Change-Id: Id2c7ab178894a10c0030c143ba71e7813df8d18c
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
BUG: 1311441
Reviewed-on: http://review.gluster.org/13096
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.org/13506
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | api/src/glfs-handleops.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index bc57221055f..cd0f6b3e950 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1370,6 +1370,9 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_create_from_handle, 3.4.2); int pub_glfs_h_close (struct glfs_object *object) { + /* since glfs_h_* objects hold a reference to inode + * it is safe to keep lookup count to '0' */ + inode_forget (object->inode, 0); inode_unref (object->inode); GF_FREE (object); |