From owner-freebsd-fs@FreeBSD.ORG Wed Aug 22 15:41:19 2012 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE6D3106564A for ; Wed, 22 Aug 2012 15:41:19 +0000 (UTC) (envelope-from boris.astardzhiev@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3D2DC8FC1C for ; Wed, 22 Aug 2012 15:41:18 +0000 (UTC) Received: by lbbgg13 with SMTP id gg13so888975lbb.13 for ; Wed, 22 Aug 2012 08:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Bqf6C0zV/hkblhPBNtiiRYUvArdis9WYmLhtbzDoEdk=; b=SxFy0gYmtlOr4eCwcJDmTPPVVlS5LFcnHuXxprsBIknoyqMVlVmzTdhYepD4aG/uM2 ASuguRwlorkeONqW53bwkWGT38L4ZgI3umTnlSoo8nV/JrPRpByu8OrIbalbrfDmJnyA lckLOQxZn08uNaZI/o0iSpQUZX7qo8XAjwJqQPCyFm12x3slUSgspC5M6327hdww5dmc vApZzZuoMmoWUklIiNa+2YltXpRjMI0bu8dMOPBWkNr742gIVBBJKq1mpB3O0sViOWvy +bZDMfa3CweetAVs47ccKFGUj4PYeJUoAskeNf7EebFqyJ2vNhR3FTFyWcKZ37IGDIQs hagw== MIME-Version: 1.0 Received: by 10.152.103.11 with SMTP id fs11mr21571115lab.23.1345649692532; Wed, 22 Aug 2012 08:34:52 -0700 (PDT) Received: by 10.112.58.2 with HTTP; Wed, 22 Aug 2012 08:34:52 -0700 (PDT) Date: Wed, 22 Aug 2012 18:34:52 +0300 Message-ID: From: Boris Astardzhiev To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: NANDFS: out of space panic X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Aug 2012 15:41:19 -0000 Hello, firstly a BIG greeting to the contributors of the NANDFS support in FreeBSD. This is a major step in embedded systems development. Now to the point - I have 2 questions. I've been playing with it recently and so far i've noticed an annoying bug. root@sheevaplug:/mnt # df -h Filesystem Size Used Avail Capacity Mounted on 10.100.100.34:/usr/sheeva-fs 7.5G 4.2G 2.7G 61% / devfs 1.0k 1.0k 0B 100% /dev /dev/gnand0s.root 255M 0B 255M 0% /mnt root@sheevaplug:/mnt # uname -a FreeBSD sheevaplug 10.0-CURRENT FreeBSD 10.0-CURRENT #2 r239563M: Wed Aug 22 18:13:56 EEST 2012 root@freebsd9:/usr/obj/arm.arm/usr/src2/sys/SHEEVAPLUG arm As you can see I've mounted a NANDFS device (/dev/gnand0s.root) into /mnt. I can happily read and write data there until I overfill the slice. So there we go: root@sheevaplug:/mnt # dd if=/dev/urandom of=file1234 bs=1M count=255 dd: 1: No space left on device 233+0 records in 232+0 records out 243269632 bytes transferred in 412.222840 secs (590141 bytes/sec) root@sheevaplug:/mnt # Now when I attempt to delete /mnt/file1234 I get a panic: root@smartcpe:/mnt # rm file1234 panic: bmap_truncate_mapping: error 28 when truncate at level 1 KDB: enter: panic [ thread pid 606 tid 100047 ] Stopped at kdb_enter+0x48: ldrb r15, [r15, r15, ror r15]! db> So how do I solve this? It is easily reproduced following this scenario every time. Up to this commit I've made the following minor changes so that Sheevaplug's nandflash can be recognized: freebsd9# svn diff Index: sys/boot/fdt/dts/sheevaplug.dts =================================================================== --- sys/boot/fdt/dts/sheevaplug.dts (revision 239563) +++ sys/boot/fdt/dts/sheevaplug.dts (working copy) @@ -87,16 +87,21 @@ reg = <0x0 0x0 0x00100000>; bank-width = <2>; device-width = <1>; - + slice@0 { reg = <0x0 0x200000>; label = "u-boot"; read-only; - }; + }; - slice@200000 { - reg = <0x200000 0x1fe00000>; - label = "root"; + slice@200000 { + reg = <0x200000 0x600000>; + label = "fbsd-boot"; + }; + + slice@800000 { + reg = <0x800000 0x10000000>; + label = "root"; }; }; }; Index: sys/arm/conf/SHEEVAPLUG =================================================================== --- sys/arm/conf/SHEEVAPLUG (revision 239563) +++ sys/arm/conf/SHEEVAPLUG (working copy) @@ -23,11 +23,11 @@ options NFS_ROOT #NFS usable as /, requires NFSCL options BOOTP options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_WIRED_TO=mge0 +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=mge0 # Root fs on USB device -#options ROOTDEVNAME=\"ufs:/dev/da0a\" +#options ROOTDEVNAME=\"nandfs:/dev/gnand0s.root\" options SYSVSHM #SYSV-style shared memory options SYSVMSG #SYSV-style message queues Index: sys/dev/nand/nand_id.c =================================================================== --- sys/dev/nand/nand_id.c (revision 239563) +++ sys/dev/nand/nand_id.c (working copy) @@ -33,6 +33,8 @@ #include struct nand_params nand_ids[] = { + { { NAND_MAN_SAMSUNG, 0xdc }, "Samsung K9F4G08U0B-PCB0", + 0x200, 0x800, 0x40, 0x40, 0 }, { { NAND_MAN_SAMSUNG, 0x75 }, "Samsung K9F5608U0B", 0x20, 0x200, 0x10, 0x20, 0 }, { { NAND_MAN_SAMSUNG, 0xd3 }, "Samsung NAND 1GiB 3,3V 8-bit", freebsd9# And the second question - is there any documentation abount NANDFS's design i.e layers, models, diagrams? They would be very helpful in pinpointing bugs and reading the code as a whole. Greetings, B. Astardzhiev