diff mbox

ext4: check block references only when read from disk

Message ID 49B944E8.2000205@ph.tum.de
State Superseded, archived
Headers show

Commit Message

Thiemo Nagel March 12, 2009, 5:22 p.m. UTC
Oops.  Fixed comment.

Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>
diff mbox

Patch

--- download/linux-2.6.29-rc7-vanilla-extcheck/fs/ext4/inode.c	2009-03-12 16:44:19.000000000 +0100
+++ linux-2.6.29-rc7/fs/ext4/inode.c	2009-03-12 16:40:28.000000000 +0100
@@ -443,12 +443,20 @@ 
 	if (!p->key)
 		goto no_block;
 	while (--depth) {
-		bh = sb_bread(sb, le32_to_cpu(p->key));
-		if (!bh)
-			goto failure;
-		if (ext4_check_indirect_blockref(inode, bh))
+		bh = sb_getblk(sb, le32_to_cpu(p->key));
+		if (unlikely(!bh))
 			goto failure;
                   
+		if (!bh_uptodate_or_lock(bh)) {
+			if (bh_submit_read(bh) < 0) {
+				put_bh(bh);
+				goto failure;
+			}
+			/* validate block references */
+			if (ext4_check_indirect_blockref(inode, bh))
+				goto failure;
+		}
+		
 		add_chain(++p, bh, (__le32 *)bh->b_data + *++offsets);
 		/* Reader: end */
 		if (!p->key)