Gitweb:
http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=ef8592b6...
Commit: ef8592b611c776b75d037a4c5bb3cf0779f2b55b
Parent: 120b0bfdca68602205623dd85516b87bd98a692d
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Mon May 2 13:44:42 2016 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Mon May 9 13:21:17 2016 -0500
fsck.gfs2: Adjust bitmap for lost+found after adding to dirtree
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(a)redhat.com>
---
gfs2/fsck/lost_n_found.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
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 */