Skip to contentSkip to conversation

ReiserFS 3 of 13

PATCH New Hans Reiser 1 participant 1 message Apr 10, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ReiserFS 3 of 13

Quoted 1 line

From - Wed Apr 10 15:37:37 2002

X-Mozilla-Status2: 00000000
Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 13240 invoked from network); 10 Apr 2002 11:21:50 -0000
Received: from angband.namesys.com ([email protected])
by thebsh.namesys.com with SMTP; 10 Apr 2002 11:21:50 -0000
Received: by angband.namesys.com (Postfix on SuSE Linux 7.3 (i386), from userid 521)

	id BD9034D1B33; Wed, 10 Apr 2002 15:21:50 +0400 (MSD)

Date: Wed, 10 Apr 2002 15:21:50 +0400
From: Oleg Drokin <[email protected]>
To: [email protected]
Subject: [PATCH] 2.5.8-pre3 patch 3 of 13
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.22.1i

This patch is to convert pap14030 panic into warning. While doing this, a bug was uncovered, that when get_block() returns a failure, buffer is still marked as mapped, and on subsequent access to this buffer get_block() was not called anymore. This is also fixed.

fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c.orig +6 -4
@@ -752,6 +752,11 @@
 		goto research ;
 	    }
 	    retval = direct2indirect (&th, inode, &path, unbh, tail_offset);
+	    if (retval) {
+		reiserfs_unmap_buffer(unbh);
+		reiserfs_free_block (&th, allocated_block_nr);
+		goto failure;
+	    }
 	    /* it is important the mark_buffer_uptodate is done after
 	    ** the direct2indirect.  The buffer might contain valid
 	    ** data newer than the data on disk (read by readpage, changed,
@@ -761,10 +766,7 @@
 	    ** the disk
 	    */
 	    mark_buffer_uptodate (unbh, 1);
-	    if (retval) {
-		reiserfs_free_block (&th, allocated_block_nr);
-		goto failure;
-	    }
+
 	    /* we've converted the tail, so we must 
 	    ** flush unbh before the transaction commits
 	    */
fs/reiserfs/tail_conversion.c +7 -3
@@ -49,9 +49,13 @@
     make_cpu_key (&end_key, inode, tail_offset, TYPE_INDIRECT, 4);
 
     // FIXME: we could avoid this 
-    if ( search_for_position_by_key (sb, &end_key, path) == POSITION_FOUND )
-	reiserfs_panic (sb, "PAP-14030: direct2indirect: "
-			"pasted or inserted byte exists in the tree");
+    if ( search_for_position_by_key (sb, &end_key, path) == POSITION_FOUND ) {
+	reiserfs_warning ("PAP-14030: direct2indirect: "
+			"pasted or inserted byte exists in the tree %K. "
+			"Use fsck to repair.\n", &end_key);
+	pathrelse(path);
+	return -EIO;
+    }
     
     p_le_ih = PATH_PITEM_HEAD (path);