reiserfs-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edward Shishkin <edward.shishkin@gmail.com>
To: Bringfried Stecklum <stecklum@tls-tautenburg.de>,
	Serkan Kaba <serkan@gentoo.org>,
	ReiserFS Development List <reiserfs-devel@vger.kernel.org>
Subject: Re: search_one_bitmap_forward oops
Date: Thu, 24 Mar 2011 22:42:19 +0100	[thread overview]
Message-ID: <4D8BBABB.3060409@gmail.com> (raw)
In-Reply-To: <4D8B5646.8020609@tls-tautenburg.de>

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

On 03/24/2011 03:33 PM, Bringfried Stecklum wrote:
> Edward Shishkin wrote:
>> On 03/24/2011 12:56 AM, Bringfried Stecklum wrote:
>>> Edward Shishkin wrote:
>>>> On 03/24/2011 12:34 AM, Bringfried Stecklum wrote:
>>>>> Edward Shishkin wrote:
>>>>>> On 03/23/2011 11:41 PM, Bringfried Stecklum wrote:
>>>>>>> Dear Edward,
>>>>>>>
>>>>>>> thanks for the reply. Since I contacted you again concerning this
>>>>>>> bug,
>>>>>>> my system is going mad because of it. I didn't change anything
>>>>>>> concerning the kernel but even just after login and idling, the bug
>>>>>>> happens. I'd like to stay with Reiser4. But right now it is getting
>>>>>>> really difficult.
>>>>>>
>>>>>> Do you use the mount option "dont_load_bitmap"?
>>>>>
>>>>> Yes, I used it so far for faster booting but switched it off now.
>>>>
>>>>
>>>> Please, don't use this mount option for now: it doesn't
>>>> work properly. I'll try to reproduce and fix it at leisure.
>>>
>>> Looks like, up'n running now for half an hour. Normally, I prefer to
>>> hibernate between sessions and thus boot rarely, the longer boot time is
>>> no obstacle. Good luck with fixing the issue.
>>
>>
>> It looks like missing bitmap is not uploaded somewhere..
>
> But it used to work quite some time...

It seems I have found the bug.

The problem arises when we get to the /* race: ...*/ point (see
the attached patch). This is not an error path, nevertheless we
release all bitmaps and set zeroes to bnode fields. Welcome to
the Oops...

Everyone, who experienced problems with on-demand bitmap loading
in reiser4 (the mount option "dont_load_bitmap"), please, try the 
attached patch.

Thanks,
Edward.

[-- Attachment #2: reiser4-fix-on-demand-bitmap-load.patch --]
[-- Type: text/plain, Size: 2378 bytes --]

Index: linux-2.6.38/fs/reiser4/plugin/space/bitmap.c
===================================================================
--- linux-2.6.38.orig/fs/reiser4/plugin/space/bitmap.c
+++ linux-2.6.38/fs/reiser4/plugin/space/bitmap.c
@@ -830,45 +830,43 @@ static int load_and_lock_bnode(struct bi
 	}
 
 	ret = prepare_bnode(bnode, &cjnode, &wjnode);
-	if (ret == 0) {
-		mutex_lock(&bnode->mutex);
+	if (ret)
+		return ret;
 
-		if (!atomic_read(&bnode->loaded)) {
-			assert("nikita-2822", cjnode != NULL);
-			assert("nikita-2823", wjnode != NULL);
-			assert("nikita-2824", jnode_is_loaded(cjnode));
-			assert("nikita-2825", jnode_is_loaded(wjnode));
-
-			bnode->wjnode = wjnode;
-			bnode->cjnode = cjnode;
-
-			ret = check_struct_bnode(bnode, current_blocksize);
-			if (!ret) {
-				cjnode = wjnode = NULL;
-				atomic_set(&bnode->loaded, 1);
-				/* working bitmap is initialized by on-disk
-				 * commit bitmap. This should be performed
-				 * under mutex. */
-				memcpy(bnode_working_data(bnode),
-				       bnode_commit_data(bnode),
-				       bmap_size(current_blocksize));
-			} else
-				mutex_unlock(&bnode->mutex);
-		} else
-			/* race: someone already loaded bitmap while we were
-			 * busy initializing data. */
-			check_bnode_loaded(bnode);
-	}
-
-	if (wjnode != NULL) {
-		release(wjnode);
-		bnode->wjnode = NULL;
-	}
-	if (cjnode != NULL) {
-		release(cjnode);
-		bnode->cjnode = NULL;
-	}
+	mutex_lock(&bnode->mutex);
 
+	if (!atomic_read(&bnode->loaded)) {
+		assert("nikita-2822", cjnode != NULL);
+		assert("nikita-2823", wjnode != NULL);
+		assert("nikita-2824", jnode_is_loaded(cjnode));
+		assert("nikita-2825", jnode_is_loaded(wjnode));
+
+		bnode->wjnode = wjnode;
+		bnode->cjnode = cjnode;
+
+		ret = check_struct_bnode(bnode, current_blocksize);
+		if (unlikely(ret != 0))
+			goto error;
+
+		atomic_set(&bnode->loaded, 1);
+		/* working bitmap is initialized by on-disk
+		 * commit bitmap. This should be performed
+		 * under mutex. */
+		memcpy(bnode_working_data(bnode),
+		       bnode_commit_data(bnode),
+		       bmap_size(current_blocksize));
+	} else
+		/* race: someone already loaded bitmap
+		 * while we were busy initializing data. */
+		check_bnode_loaded(bnode);
+	return 0;
+
+ error:
+	release(wjnode);
+	release(cjnode);
+	bnode->wjnode = NULL;
+	bnode->cjnode = NULL;
+	mutex_unlock(&bnode->mutex);
 	return ret;
 }
 

      parent reply	other threads:[~2011-03-24 21:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28 11:10 [patch] reiser4progs: Handle unprepped items by fsck Edward Shishkin
     [not found] ` <4C7BD349.5070005@tls-tautenburg.de>
     [not found]   ` <4C7BD64B.9070005@gmail.com>
     [not found]     ` <4C7BF309.8070906@tls-tautenburg.de>
     [not found]       ` <4C7C04FB.9070901@gmail.com>
     [not found]         ` <4D7CAE07.2090907@tls-tautenburg.de>
     [not found]           ` <4D7FECB3.4090804@gmail.com>
     [not found]             ` <4D8A771B.7080903@tls-tautenburg.de>
     [not found]               ` <4D8A7E79.90407@gmail.com>
     [not found]                 ` <4D8A838C.5040702@tls-tautenburg.de>
     [not found]                   ` <4D8A85D5.2010201@gmail.com>
     [not found]                     ` <4D8A8893.9000802@tls-tautenburg.de>
     [not found]                       ` <4D8A8C6D.7070906@gmail.com>
     [not found]                         ` <4D8B5646.8020609@tls-tautenburg.de>
2011-03-24 21:42                           ` Edward Shishkin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8BBABB.3060409@gmail.com \
    --to=edward.shishkin@gmail.com \
    --cc=reiserfs-devel@vger.kernel.org \
    --cc=serkan@gentoo.org \
    --cc=stecklum@tls-tautenburg.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).