From da7c26ff1bb879c6a9489c1dc42c7a3400c9be20 Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Fri, 27 Jul 2018 14:52:21 +0800 Subject: gfapi: Use inode_forget in case of unlink/rename objects After unlink/rename, the nonexistent inode should be remove from inode table, that's better than put to lru list. Change-Id: I5a40df188f3f42a2c864cfb4404b22b288fdcc12 fixes: bz#1612750 Signed-off-by: Kinglong Mee --- api/src/glfs-fops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'api/src/glfs-fops.c') diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 870b287c2a7..cb6dffc9335 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -214,6 +214,11 @@ glfs_loc_unlink (loc_t *loc) { inode_unlink (loc->inode, loc->parent, loc->name); + /* since glfs_h_* objects hold a reference to inode + * it is safe to keep lookup count to '0' */ + if (!inode_has_dentry (loc->inode)) + inode_forget (loc->inode, 0); + return 0; } @@ -2713,10 +2718,14 @@ retrynew: } } - if (ret == 0) + if (ret == 0) { inode_rename (oldloc.parent->table, oldloc.parent, oldloc.name, newloc.parent, newloc.name, oldloc.inode, &oldiatt); + + if (newloc.inode && !inode_has_dentry (newloc.inode)) + inode_forget (newloc.inode, 0); + } out: loc_wipe (&oldloc); loc_wipe (&newloc); -- cgit