Skip to contentSkip to conversation

Recovery for lost unlinked inodes

Cluster-devel Steven Whitehouse 1 participant 1 message Jun 7, 2007 GFS2 file system

lore
Share & tools
lore
#0 lore raw

Hi,

Under certain circumstances its possible (though rather unlikely) that inodes which were unlinked by one node while still open on another might get "lost" in the sense that they don't get deallocated if the node which held the inode open crashed before it was unlinked.

This patch adds the recovery code which allows automatic deallocation of the inode if its found during block allocation (the sensible time to look for such inodes since we are scanning the rgrp's bitmaps anyway at this time, so it adds no overhead to do this).

Since the inode will have had its i_nlink set to zero, all we need to trigger recovery is a lookup and an iput(), and the normal deallocation code takes care of the rest.

Steve.

---------------------------------------------------------------------------

fs/gfs2/incore.h +2 -0
index e5069b9..c7c6ec0 100644
@@ -95,6 +95,8 @@ struct gfs2_rgrpd {
 	u32 rd_last_alloc_data;
 	u32 rd_last_alloc_meta;
 	struct gfs2_sbd *rd_sbd;
+	unsigned long rd_flags;
+#define GFS2_RDF_CHECK        0x0001          /* Need to check for unlinked inodes */
 };
 
 enum gfs2_state_bits {
fs/gfs2/inode.c +35 -15

67 lines not on this page · raw message

fs/gfs2/log.c +0 -0
fs/gfs2/rgrp.c +74 -17

200 lines not on this page · raw message