linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix reiserfs oops on small fs
@ 2004-11-18 11:49 Jan Kara
  2004-11-18 14:09 ` Chris Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2004-11-18 11:49 UTC (permalink / raw)
  To: reiserfs-list; +Cc: linux-fsdevel

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

  Hello!

  Attached patch fixes oops of reiserfs on a filesystem with just one
bitmap block - current code always tries to return second bitmap even if
there's not any. Could someone review it please so that it can be merged
in mainline?
	
								Honza

[-- Attachment #2: quota-new-2.6.10-rc2-mm1-4-reisersmall.diff --]
[-- Type: text/plain, Size: 1370 bytes --]

Fix block allocation code of reiserfs to give correct bitmap numbers
for small filesystems (with just one bitmap block).

Signed-off-by: Jan Kara <jack@suse.cz>

diff -rupNX /home/jack/.kerndiffexclude linux-2.6.10-rc2-mm1-3-reiserdebug/fs/reiserfs/bitmap.c linux-2.6.10-rc2-mm1-4-reisersmall/fs/reiserfs/bitmap.c
--- linux-2.6.10-rc2-mm1-3-reiserdebug/fs/reiserfs/bitmap.c	2004-11-16 16:57:33.000000000 +0100
+++ linux-2.6.10-rc2-mm1-4-reisersmall/fs/reiserfs/bitmap.c	2004-11-16 17:01:47.000000000 +0100
@@ -229,6 +229,9 @@ static int bmap_hash_id(struct super_blo
     unsigned long hash;
     unsigned bm;
 
+    /* If there is only one bitmap, we have no choice... */
+    if (SB_BMAP_NR(s) == 1)
+	return 0;
     if (id <= 2) {
 	bm = 1;
     } else {
@@ -613,7 +616,7 @@ dirid_groups (reiserfs_blocknr_hint_t *h
 	/* give a portion of the block group to metadata */
 	if (hint->inode)
 	    hash += sb->s_blocksize/2;
-	hint->search_start = hash;
+	hint->search_start = hash >= SB_BLOCK_COUNT(sb) ? SB_BLOCK_COUNT(sb)-1 : hash;
     }
 }
 
@@ -642,7 +645,7 @@ oid_groups (reiserfs_blocknr_hint_t *hin
 	    bm = bmap_hash_id(hint->inode->i_sb, oid);
 	    hash = bm * (hint->inode->i_sb->s_blocksize << 3);
 	}
-	hint->search_start = hash;
+	hint->search_start = hash >= SB_BLOCK_COUNT(hint->inode->i_sb) ? SB_BLOCK_COUNT(hint->inode->i_sb)-1 : hash;
     }
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix reiserfs oops on small fs
  2004-11-18 11:49 [PATCH] Fix reiserfs oops on small fs Jan Kara
@ 2004-11-18 14:09 ` Chris Mason
  2004-11-19  9:31   ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Mason @ 2004-11-18 14:09 UTC (permalink / raw)
  To: Jan Kara; +Cc: reiserfs-list, linux-fsdevel

On Thu, 2004-11-18 at 12:49 +0100, Jan Kara wrote:
>   Hello!
> 
>   Attached patch fixes oops of reiserfs on a filesystem with just one
> bitmap block - current code always tries to return second bitmap even if
> there's not any. Could someone review it please so that it can be merged
> in mainline?

Hi Jan,

A slightly different form of this patch is in already.  Look for the
checks in bmap_hash_id.  Are you still able to reproduce this bug on
kernels newer than October 18?

-chris

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix reiserfs oops on small fs
  2004-11-18 14:09 ` Chris Mason
@ 2004-11-19  9:31   ` Jan Kara
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2004-11-19  9:31 UTC (permalink / raw)
  To: Chris Mason; +Cc: reiserfs-list, linux-fsdevel

> On Thu, 2004-11-18 at 12:49 +0100, Jan Kara wrote:
> >   Hello!
> > 
> >   Attached patch fixes oops of reiserfs on a filesystem with just one
> > bitmap block - current code always tries to return second bitmap even if
> > there's not any. Could someone review it please so that it can be merged
> > in mainline?
> 
> A slightly different form of this patch is in already.  Look for the
> checks in bmap_hash_id.  Are you still able to reproduce this bug on
> kernels newer than October 18?
  Sorry. I've missed that the bug was already fixed in the other place.
It looks OK now.
								Honza

-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-19  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-18 11:49 [PATCH] Fix reiserfs oops on small fs Jan Kara
2004-11-18 14:09 ` Chris Mason
2004-11-19  9:31   ` Jan Kara

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).