Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Aug 2012 18:34:52 +0300
From:      Boris Astardzhiev <boris.astardzhiev@gmail.com>
To:        freebsd-fs@freebsd.org
Subject:   NANDFS: out of space panic
Message-ID:  <CAP=KkTz3%2B7UbfBcW9D_8VHv-Rw7BxNyG5xiVFxG4L-Zq1skwJw@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 <dev/nand/nand.h>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAP=KkTz3%2B7UbfBcW9D_8VHv-Rw7BxNyG5xiVFxG4L-Zq1skwJw>