diff options
| -rw-r--r-- | api/src/glfs-fops.c | 11 | ||||
| -rw-r--r-- | api/src/glfs-handleops.c | 7 | ||||
| -rw-r--r-- | api/src/glfs-resolve.c | 6 | 
3 files changed, 21 insertions, 3 deletions
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); diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index e40adf04d3d..343fc384ddf 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1794,11 +1794,16 @@ pub_glfs_h_rename (struct glfs *fs, struct glfs_object *olddir,          ret = syncop_rename (subvol, &oldloc, &newloc, NULL, NULL);          DECODE_SYNCOP_ERR (ret); -        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); diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index 88e2d8926a0..0c4b9651bd4 100644 --- a/api/src/glfs-resolve.c +++ b/api/src/glfs-resolve.c @@ -397,9 +397,13 @@ glfs_resolve_component (struct glfs *fs, xlator_t *subvol, inode_t *parent,                   * A stale mapping might exist for a dentry/inode that has been                   * removed from another client.                   */ -                if (-ret == ENOENT) +                if (-ret == ENOENT) {                          inode_unlink(loc.inode, loc.parent,                                       loc.name); +                        if (!inode_has_dentry (loc.inode)) +                                inode_forget (loc.inode, 0); +                } +  		inode_unref (loc.inode);  	        gf_uuid_clear (loc.gfid);  		loc.inode = inode_new (parent->table);  | 
