[Cluster-devel] [fsck.gfs2 v2 PATCH 34/40] fsck.gfs2: Adjust bitmap for lost+found after adding to dirtree

Bob Peterson rpeterso at redhat.com
Fri May 6 17:39:27 UTC 2016


This patch changes the order in which things are done in function
make_sure_lf_exists. Before, it was setting the bitmap and then
adding lost+found to the directory tree. Now the order is reversed:
lost+found is added to the directory tree, then the bitmap is
twiddled. Doing it in this order ensures that the block is treated
as an inode block for the purposes of adjusting the rgrp counts.
This is only a problem for GFS1 file systems where a bitmap
designation might mean either dinode or other metadata.

Signed-off-by: Bob Peterson <rpeterso at redhat.com>
---
 gfs2/fsck/lost_n_found.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 197ae7d..bd05223 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -139,9 +139,12 @@ void make_sure_lf_exists(struct gfs2_inode *ip)
 		/* FIXME: i'd feel better about this if fs_mkdir returned
 		   whether it created a new directory or just found an old one,
 		   and we used that instead of the bitmap_type to run this */
+		dirtree_insert(lf_dip->i_di.di_num);
+		/* Set the bitmap AFTER the dirtree insert so that function
+		   check_n_fix_bitmap will realize it's a dinode and adjust
+		   the rgrp counts properly. */
 		fsck_bitmap_set(ip, lf_dip->i_di.di_num.no_addr,
 				_("lost+found dinode"), GFS2_BLKST_DINODE);
-		dirtree_insert(lf_dip->i_di.di_num);
 		/* root inode links to lost+found */
 		incr_link_count(sdp->md.rooti->i_di.di_num, lf_dip, _("root"));
 		/* lost+found link for '.' from itself */
-- 
2.5.5




More information about the Cluster-devel mailing list