trace_ext4_evict_inode(inode);
 
+       if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)
+               ext4_evict_ea_inode(inode);
        if (inode->i_nlink) {
                /*
                 * When journalling data dirty buffers are tracked only in the
 
        return err;
 }
 
+/* Remove entry from mbcache when EA inode is getting evicted */
+void ext4_evict_ea_inode(struct inode *inode)
+{
+       if (EA_INODE_CACHE(inode))
+               mb_cache_entry_delete(EA_INODE_CACHE(inode),
+                       ext4_xattr_inode_get_hash(inode), inode->i_ino);
+}
+
 static int
 ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
                               struct ext4_xattr_entry *entry, void *buffer,
 static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode,
                                       int ref_change)
 {
-       struct mb_cache *ea_inode_cache = EA_INODE_CACHE(ea_inode);
        struct ext4_iloc iloc;
        s64 ref_count;
-       u32 hash;
        int ret;
 
        inode_lock(ea_inode);
 
                        set_nlink(ea_inode, 1);
                        ext4_orphan_del(handle, ea_inode);
-
-                       if (ea_inode_cache) {
-                               hash = ext4_xattr_inode_get_hash(ea_inode);
-                               mb_cache_entry_create(ea_inode_cache,
-                                                     GFP_NOFS, hash,
-                                                     ea_inode->i_ino,
-                                                     true /* reusable */);
-                       }
                }
        } else {
                WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=%lld",
 
                        clear_nlink(ea_inode);
                        ext4_orphan_add(handle, ea_inode);
-
-                       if (ea_inode_cache) {
-                               hash = ext4_xattr_inode_get_hash(ea_inode);
-                               mb_cache_entry_delete(ea_inode_cache, hash,
-                                                     ea_inode->i_ino);
-                       }
                }
        }
 
 
 
 extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
                            struct ext4_inode *raw_inode, handle_t *handle);
+extern void ext4_evict_ea_inode(struct inode *inode);
 
 extern const struct xattr_handler *ext4_xattr_handlers[];