gfs2-utils: master - fsck.gfs2: fsck.gfs2: Sync di_nlink adding links for lost+found

Bob Peterson rpeterso at fedoraproject.org
Tue Aug 30 20:25:24 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=6bee78a1e1e0e759339da5a01d42b1c8c4260d73
Commit:        6bee78a1e1e0e759339da5a01d42b1c8c4260d73
Parent:        6bc54f5d14c2d0432f97fd2c4a20dfdb8ece8c84
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Mon Aug 8 14:21:06 2011 -0500
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Mon Aug 29 12:52:10 2011 -0500

fsck.gfs2: fsck.gfs2: Sync di_nlink adding links for lost+found

When adding a ".." entry to a directory newly linked to lost+found
fsck.gfs2 needs to update its di_nlink value to account for the new
link.  If not, it can "correct" the di_nlink value to the wrong
value and not find the error until a second fsck.gfs2 is done.
This only happens in the rare case where there is no pre-existing
".." entry that may be reused to re-link to lost+found.

rhbz#675723
---
 gfs2/fsck/lost_n_found.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index 32f3c5c..b6f02b9 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -118,6 +118,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 			dip = fsck_load_inode(sdp, di->dotdot_parent);
 			if (dip->i_di.di_nlink > 0) {
 				dip->i_di.di_nlink--;
+				set_di_nlink(dip); /* keep inode tree in sync */
 				log_debug(_("Decrementing its links to %d\n"),
 					  dip->i_di.di_nlink);
 				bmodified(dip->i_bh);
@@ -128,6 +129,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
 					    "Changing it to 0.\n"),
 					  dip->i_di.di_nlink);
 				dip->i_di.di_nlink = 0;
+				set_di_nlink(dip); /* keep inode tree in sync */
 				bmodified(dip->i_bh);
 			}
 			fsck_inode_put(&dip);


More information about the cluster-commits mailing list