cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [Patch 10/44] fsck.gfs2: Keep di_nlink in sync when adding links for lost+found
@ 2011-08-11 21:01 Bob Peterson
  2011-08-12  9:24 ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2011-08-11 21:01 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From da57639e65b148bb4d2a3c6a9d98623b8ad18b04 Mon Sep 17 00:00:00 2001
From: Bob Peterson <rpeterso@redhat.com>
Date: Mon, 8 Aug 2011 14:21:06 -0500
Subject: [PATCH 10/44] fsck.gfs2: Keep di_nlink in sync when 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);
-- 
1.7.4.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [Patch 10/44] fsck.gfs2: Keep di_nlink in sync when adding links for lost+found
  2011-08-11 21:01 [Cluster-devel] [Patch 10/44] fsck.gfs2: Keep di_nlink in sync when adding links for lost+found Bob Peterson
@ 2011-08-12  9:24 ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2011-08-12  9:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Looks good,

Steve.

On Thu, 2011-08-11 at 17:01 -0400, Bob Peterson wrote:
> >From da57639e65b148bb4d2a3c6a9d98623b8ad18b04 Mon Sep 17 00:00:00 2001
> From: Bob Peterson <rpeterso@redhat.com>
> Date: Mon, 8 Aug 2011 14:21:06 -0500
> Subject: [PATCH 10/44] fsck.gfs2: Keep di_nlink in sync when 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);




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-12  9:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-11 21:01 [Cluster-devel] [Patch 10/44] fsck.gfs2: Keep di_nlink in sync when adding links for lost+found Bob Peterson
2011-08-12  9:24 ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).