2.6.31 xfs_fs_destroy_inode: cannot reclaim

Christoph Hellwig hch at infradead.org
Thu Sep 17 13:59:53 CDT 2009


On Wed, Sep 16, 2009 at 12:27:21PM +0200, Tommy van Leeuwen wrote:
> Hello All,
> 
> We had this error reported on the list about 1 or 2 months ago. During
> that time a lot of fixes were applied. However, we still experience
> this problem with the recent 2.6.31 tree. We've also applied an extra
> log entry to aid in debugging.
> 
> printk("XFS: inode_init_always failed to re-initialize inode\n");
> 
> However, we didn't see this logging!

Can you try the patch below, its does two things

 - remove all that reclaimable flagging if we reclaim the inode
   directly.  This removes any possibility of racing with the reclaiming
   thread.
 - adds asserts if one of the reclaim-related flags is already set.


Index: xfs/fs/xfs/xfs_vnodeops.c
===================================================================
--- xfs.orig/fs/xfs/xfs_vnodeops.c	2009-09-17 14:39:37.799003843 -0300
+++ xfs/fs/xfs/xfs_vnodeops.c	2009-09-17 14:50:14.987005862 -0300
@@ -2460,39 +2460,35 @@ int
 xfs_reclaim(
 	xfs_inode_t	*ip)
 {
-
 	xfs_itrace_entry(ip);
 
 	ASSERT(!VN_MAPPED(VFS_I(ip)));
 
 	/* bad inode, get out here ASAP */
-	if (is_bad_inode(VFS_I(ip))) {
-		xfs_ireclaim(ip);
-		return 0;
-	}
+	if (is_bad_inode(VFS_I(ip)))
+		goto out_reclaim;
 
 	xfs_ioend_wait(ip);
 
 	ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || ip->i_delayed_blks == 0);
 
 	/*
+	 * We should never get here with one of the reclaim flags already set.
+	 */
+	BUG_ON(xfs_iflags_test(ip, XFS_IRECLAIMABLE));
+	BUG_ON(xfs_iflags_test(ip, XFS_IRECLAIM));
+
+	/*
 	 * If we have nothing to flush with this inode then complete the
-	 * teardown now, otherwise break the link between the xfs inode and the
-	 * linux inode and clean up the xfs inode later. This avoids flushing
-	 * the inode to disk during the delete operation itself.
-	 *
-	 * When breaking the link, we need to set the XFS_IRECLAIMABLE flag
-	 * first to ensure that xfs_iunpin() will never see an xfs inode
-	 * that has a linux inode being reclaimed. Synchronisation is provided
-	 * by the i_flags_lock.
+	 * teardown now, otherwise delay the flush operation.
 	 */
-	if (!ip->i_update_core && (ip->i_itemp == NULL)) {
-		xfs_ilock(ip, XFS_ILOCK_EXCL);
-		xfs_iflock(ip);
-		xfs_iflags_set(ip, XFS_IRECLAIMABLE);
-		return xfs_reclaim_inode(ip, 1, XFS_IFLUSH_DELWRI_ELSE_SYNC);
+	if (ip->i_update_core || ip->i_itemp) {
+		xfs_inode_set_reclaim_tag(ip);
+		return 0;
 	}
-	xfs_inode_set_reclaim_tag(ip);
+
+out_reclaim:
+	xfs_ireclaim(ip);
 	return 0;
 }
 




More information about the xfs mailing list