lkml.org 
[lkml]   [2004]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: silent semantic changes with reiser4
On Tue, Sep 07, 2004 at 03:38:01PM -0700, William Lee Irwin III wrote:
> Okay, sounds like time to run these tests and post the results myself.
> Hans, these things should be part of your standard QA. It would likely
> make a better impression if there were some record of these kinds of
> things having been successfully tested prior to your releases. For
> future reference, Andrew, Christoph, myself, and others can provide
> more detailed references to suites of stress tests and various kinds of
> tests filesystems should pass before being considered stable, and we
> (it's a relatively safe presumption that I speak for all of us when I
> say this) would appreciate this kind of testing in the future.

Step 1, the tools are very broken. This level of nonfunctionality
of the reiser4 toolchain precludes any kind of exposure to the kind of
testing I've asked about. I would very strongly prefer not to have to
become a reiser4 implementor and furthermore fix numerous bugs just to
have the smallest bit of assurance that this thing won't generate bug
reports en masse once merged.

The following is from an UltraSPARC system (64-bit wordsize, big-endian,
8KB pagesize, 32-bit userspace, including 32-bit compiled reiser4 tools)
running 2.6.9-rc1-mm3:


# /usr/local/sbin/mkfs.reiser4 -f -b 4096 /dev/loop0
/usr/local/sioctl32(mkfs.reiser4:1949): Unknown cmd fd(3) cmd(40081272){00} arg(efffc810) on /dev/loop0
4boicnt/lm3k2f(sm.krfesi.sreeri4s e1r.40:.109
9C)o:p yUrnikgnhotw n( Cc)m d2 0f0d1(,3 )2 0c0m2d,( 420000831,2 7220)0{40 0b}y raHragn(se fRfefics8e1r0,) loinc e/ndseivn/gl ogoopv0e
ned by
reiser4progs/COPYING.

Block size 4096 will be used.
Linux 2.6.9-rc1-mm3 is detected.
Reiser4 is going to be created on /dev/loop0.
(Yes/No): Yes
ioctl32(mkfs.reiser4:1949): Unknown cmd fd(3) cmd(40081272){00} arg(efffc738) on /dev/loop0
i o c t l 3 2 ( m k f s . r e i s e r 4 : 1 9 4 9 ) : U n k n o w n c m d sC r/edaetvi/nlgo orpe0i0 8 1 2 7 2 ) { 0 0 } a r g ( e f f f c 7 3 8 )
er4 on /dev/loop0 ... Bus error
#

With the below patch, I get:
# /usr/local/sbin/mkfs.reiser4 -f -b 4096 /dev/loop0 /usr/local/sbin/mkfs.reiser4 1.0.0
Copyright (C) 2001, 2002, 2003, 2004 by Hans Reiser, licensing governed by
reiser4progs/COPYING.

Block size 4096 will be used.
Linux 2.6.9-rc1-mm3 is detected.
Reiser4 is going to be created on /dev/loop0.
(Yes/No): Yes
Creating reiser4 on /dev/loop0 ... Bus error
#

The S_ISBLK() check is so that other assumptions about the file being
a block device elsewhere won't be tripped up; it's not strictly
necessary, only retained so as not to expose unaudited code to a new
situation for which it's not prepared.

strace(1) before and after the patch is included here. The backtrace
from the core dump is:

#0 0x7005e464 in cde40_insert_units () from /usr/local/lib/libreiser4-1.0.so.0
(gdb) bt
#0 0x7005e464 in cde40_insert_units () from /usr/local/lib/libreiser4-1.0.so.0
#1 0x7004fa44 in node40_modify () from /usr/local/lib/libreiser4-1.0.so.0
#2 0x7003c608 in cb_node_insert () from /usr/local/lib/libreiser4-1.0.so.0
#3 0x7003c58c in reiser4_node_modify ()
from /usr/local/lib/libreiser4-1.0.so.0
#4 0x7003ee7c in reiser4_tree_modify ()
from /usr/local/lib/libreiser4-1.0.so.0
#5 0x7006bc10 in obj40_insert () from /usr/local/lib/libreiser4-1.0.so.0
#6 0x7006d9e8 in dir40_create () from /usr/local/lib/libreiser4-1.0.so.0
#7 0x70041610 in reiser4_object_create ()
from /usr/local/lib/libreiser4-1.0.so.0
#8 0x00012160 in main ()


-- wli

Index: libaal-1.0.0/src/file.c
===================================================================
--- libaal-1.0.0.orig/src/file.c 2004-01-08 06:49:40.000000000 -0800
+++ libaal-1.0.0/src/file.c 2004-09-07 19:36:49.593844072 -0700
@@ -193,59 +193,31 @@
return !aal_strncmp(file1, file2, aal_strlen(file1));
}

-#if defined(__linux__) && defined(_IOR) && !defined(BLKGETSIZE64)
-# define BLKGETSIZE64 _IOR(0x12, 114, uint64_t)
-#endif
-
/* Handler for "len" operation for use with file device. See bellow for
understanding where it is used. */
static count_t file_len(
aal_device_t *device) /* file device, lenght will be obtained from */
{
- uint64_t size;
- off_t max_off = 0;
+ off_t off, size;
+ struct stat stat_buf;
+ int fd;

- if (!device)
+ if (!device)
return INVAL_BLK;
-
-#ifdef BLKGETSIZE64
- if ((int)ioctl(*((int *)device->entity), BLKGETSIZE64, &size) >= (int)0) {
- uint32_t block_count;
-
- size = (size / 4096) * 4096 / device->blksize;
- block_count = size;
-
- if ((uint64_t)block_count != size) {
- aal_fatal("The partition size is too big.");
- return INVAL_BLK;
- }
-
- return (count_t)block_count;
- }
-
-#endif
-
-#ifdef BLKGETSIZE
- {
- unsigned long l_size;
-
- if (ioctl(*((int *)device->entity), BLKGETSIZE, &l_size) >= 0) {
- size = l_size;
- return (count_t)((size * 512 / 4096) * 4096 /
- device->blksize);
- }
- }
-
-#endif
-
- if ((max_off = lseek(*((int *)device->entity),
- 0, SEEK_END)) == (off_t)-1)
- {
- file_error(device);
+ fd = *(int *)device->entity;
+ if (fstat(fd, &stat_buf))
+ return INVAL_BLK;
+ if (!S_ISBLK(stat_buf.st_mode))
+ return INVAL_BLK;
+ off = lseek(fd, 0, SEEK_CUR);
+ size = lseek(fd, 0, SEEK_END);
+ if (lseek(fd, off, SEEK_SET) == (off_t)-1)
+ errno = 0;
+ if (size == (off_t)-1) {
+ errno = 0;
return INVAL_BLK;
}
-
- return (count_t)(max_off / device->blksize);
+ return (size & ~4096ULL)/device->blksize;
}

/* Initializing the file device operations. They are used when any operation of[unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.827 / U:20.332 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site