Skip to contentSkip to conversation

Fix ordering of page disposal vs. glock_dq

Cluster-devel Steven Whitehouse 1 participant 1 message Jan 8, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

Hi,

In case of unlinked files with dirty pages GFS2 wasn't clearing the pages in quite the right order. This patch clears the pages earlier (before the qlock_dq) to avoid the situation that the release of the glock results in attempting to write back data that has already been deallocated.

This fixes Red Hat bugzilla: #220117

Steve.

fs/gfs2/ops_super.c +6 -0
index b283783..c22738c 100644
@@ -429,6 +429,12 @@ static void gfs2_delete_inode(struct ino
 	}
 
 	error = gfs2_dinode_dealloc(ip);
+	/*
+	 * Must do this before unlock to avoid trying to write back
+	 * potentially dirty data now that inode no longer exists
+	 * on disk.
+	 */
+	truncate_inode_pages(&inode->i_data, 0);
 
 out_unlock:
 	gfs2_glock_dq(&ip->i_iopen_gh);