Skip to contentSkip to conversation

ReiserFS bugfixes, the critical one of the thirteen, please apply, 12 of 13

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ReiserFS bugfixes, the critical one of the thirteen, please apply, 12 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 13285 invoked from network); 10 Apr 2002 11:21:51 -0000
Received: from angband.namesys.com ([email protected])
by thebsh.namesys.com with SMTP; 10 Apr 2002 11:21:51 -0000
Received: by angband.namesys.com (Postfix on SuSE Linux 7.3 (i386), from userid 521)

	id 2F6E34D1B34; Wed, 10 Apr 2002 15:21:51 +0400 (MSD)

Date: Wed, 10 Apr 2002 15:21:51 +0400
From: Oleg Drokin <[email protected]>
To: [email protected]
Subject: [PATCH] 2.5.8-pre3 patch 12 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 fixes a problem that was created during inode structure cleanup/ private parts separation. This fix was made by Chris Mason. This is very critical bugfix. Without it, filesystem corruption happens on savelinks processing and possibly in some other cases.

fs/reiserfs/inode.c renamed from fs/reiserfs/inode.c.orig +16 -5
@@ -1111,8 +1111,19 @@
     return;
 }
 
+/* reiserfs_read_inode2 is called to read the inode off disk, and it
+** does a make_bad_inode when things go wrong.  But, we need to make sure
+** and clear the key in the private portion of the inode, otherwise a
+** corresponding iput might try to delete whatever object the inode last
+** represented.
+*/
+static void reiserfs_make_bad_inode(struct inode *inode) {
+    memset(INODE_PKEY(inode), 0, KEY_SIZE);
+    make_bad_inode(inode);
+}
+
 void reiserfs_read_inode(struct inode *inode) {
-    make_bad_inode(inode) ;
+    reiserfs_make_bad_inode(inode) ;
 }
 
 
@@ -1132,7 +1143,7 @@
     int retval;
 
     if (!p) {
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	return;
     }
 
@@ -1152,13 +1163,13 @@
 	reiserfs_warning ("vs-13070: reiserfs_read_inode2: "
                     "i/o failure occurred trying to find stat data of %K\n",
                     &key);
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	return;
     }
     if (retval != ITEM_FOUND) {
 	/* a stale NFS handle can trigger this without it being an error */
 	pathrelse (&path_to_sd);
-	make_bad_inode(inode) ;
+	reiserfs_make_bad_inode(inode) ;
 	inode->i_nlink = 0;
 	return;
     }
@@ -1185,7 +1196,7 @@
 			      "dead inode read from disk %K. "
 			      "This is likely to be race with knfsd. Ignore\n", 
 			      &key );
-	    make_bad_inode( inode );
+	    reiserfs_make_bad_inode( inode );
     }
 
     reiserfs_check_path(&path_to_sd) ; /* init inode should be relsing */
fs/reiserfs/super.c renamed from fs/reiserfs/super.c.orig +1 -2
@@ -746,9 +746,8 @@
     //
     // ok, reiserfs signature (old or new) found in at the given offset
     //    
-    brelse (bh);
-    
     sb_set_blocksize (s, sb_blocksize(rs));
+    brelse (bh);
     
     bh = reiserfs_bread (s, offset / s->s_blocksize);
     if (!bh) {