Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2002 15:23:21 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Norikatsu Shigemura <nork@FreeBSD.org>
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: filesytem bsize=64k causes libc/db hash crash
Message-ID:  <3D8113D9.CBF06664@mindspring.com>
References:  <200209122022.g8CKM004040532@nd250009.gab.xdsl.ne.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------0D69AD2D1777CA68B9DD36F0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Norikatsu Shigemura wrote:
>         I found a problem on 4-STABLE(maybe 5-CURRENT, too) with libc/db
>         (BerkeleyDB 1).  It that when block size on fs is 65536 bytes,
>         many programs which use BerkeleyDB(dev_mkdb, cap_mkdb, etc..) are
>         crash.

Here is a patch; it's ugly, but it works.

-- Terry
--------------0D69AD2D1777CA68B9DD36F0
Content-Type: text/plain; charset=us-ascii;
 name="db.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="db.diff"

Index: btree/bt_open.c
===================================================================
RCS file: /usr/cvs/src/lib/libc/db/btree/bt_open.c,v
retrieving revision 1.7.2.1
diff -c -r1.7.2.1 bt_open.c
*** btree/bt_open.c	2 Nov 2000 10:30:07 -0000	1.7.2.1
--- btree/bt_open.c	12 Sep 2002 22:28:51 -0000
***************
*** 262,267 ****
--- 262,269 ----
  		 */
  		if (b.psize == 0) {
  			b.psize = sb.st_blksize;
+ 			if (b.psize > 32768)
+ 				b.psize = 32868;
  			if (b.psize < MINPSIZE)
  				b.psize = MINPSIZE;
  			if (b.psize > MAX_PAGE_OFFSET + 1)
Index: hash/hash.c
===================================================================
RCS file: /usr/cvs/src/lib/libc/db/hash/hash.c,v
retrieving revision 1.8
diff -c -r1.8 hash.c
*** hash/hash.c	27 Jan 2000 23:06:08 -0000	1.8
--- hash/hash.c	12 Sep 2002 22:28:26 -0000
***************
*** 311,316 ****
--- 311,318 ----
  		if (stat(file, &statbuf))
  			return (NULL);
  		hashp->BSIZE = statbuf.st_blksize;
+ 		if (hashp->BSIZE > 32768)
+ 			hashp->BSIZE = 32868;
  		hashp->BSHIFT = __log2(hashp->BSIZE);
  	}
  

--------------0D69AD2D1777CA68B9DD36F0--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D8113D9.CBF06664>