All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [fsck.gfs2 PATCH] fsck.gfs2: link count checking wrong inode's formal inode number
       [not found] <1389216347.5514007.1467393004696.JavaMail.zimbra@redhat.com>
@ 2016-07-01 17:10 ` Bob Peterson
  0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2016-07-01 17:10 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

This patch fixes a bug whereby inodes that aren't in the dirtree or
the inodetree are checking the wrong formal inode number. Function
incr_link_count checks the wrong inode value, and thus reports an
error where there are none. Also, when the error is reported back,
it reports the wrong value, using a copy of the inum value. In this
case, it should look up the dentry's inode's formal inode number.
This should only hurt performance in error cases.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>

diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index 0243d85..00636d7 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -112,7 +112,7 @@ int incr_link_count(struct gfs2_inum no, struct gfs2_inode *ip,
 
 	link_ip = fsck_load_inode(ip->i_sbd, no.no_addr);
 	/* Check formal ino against dinode before adding to inode tree. */
-	if (no.no_formal_ino != ip->i_di.di_num.no_formal_ino) {
+	if (no.no_formal_ino != link_ip->i_di.di_num.no_formal_ino) {
 		fsck_inode_put(&link_ip);
 		return 1;
 	}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index f808cea..8ac5547 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -195,8 +195,13 @@ static int bad_formal_ino(struct gfs2_inode *ip, struct gfs2_dirent *dent,
 		di = dirtree_find(entry.no_addr);
 		if (di)
 			inum = di->dinode;
-		else if (link1_type(&clink1map, entry.no_addr) == 1)
-			inum = entry;
+		else if (link1_type(&clink1map, entry.no_addr) == 1) {
+			struct gfs2_inode *dent_ip;
+
+			dent_ip = fsck_load_inode(ip->i_sbd, entry.no_addr);
+			inum = dent_ip->i_di.di_num;
+			fsck_inode_put(&dent_ip);
+		}
 	}
 	log_err( _("Directory entry '%s' pointing to block %llu (0x%llx) in "
 		   "directory %llu (0x%llx) has the wrong 'formal' inode "



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-01 17:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1389216347.5514007.1467393004696.JavaMail.zimbra@redhat.com>
2016-07-01 17:10 ` [Cluster-devel] [fsck.gfs2 PATCH] fsck.gfs2: link count checking wrong inode's formal inode number Bob Peterson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.