linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* jffs2_gcd_mtdx thread and umount problem.
@ 2010-01-18  7:04 Johnny Hung
  2010-01-18  7:57 ` Joakim Tjernlund
  0 siblings, 1 reply; 4+ messages in thread
From: Johnny Hung @ 2010-01-18  7:04 UTC (permalink / raw)
  To: linux-embedded, linuxppc-dev, linux-mtd

Hi All,

I have a customized MPC8313 (ppc arch) board with SPANSION 64MB NOR
flash, everything works fine but I found a abnormal about JFFS2 flahs
filesystem.

The system will mount JFFS2 to /mnt/mtd when system boot up. I try to
execute umount /mnt/mtd or sync or reboot right away after login then
these commands hangs. Use ps command to check process status and is D
(Uninterruptible sleep, usually IO). I try to kill jffs2_gcd_mtd4 and
umount/reboot/syc commands execute successfully. I think
jffs2_gcd_mtd4 (mount /dev/mtd4) do something in the background so I
wait for 10 minutes after login and execute the same commands and it
doesn't hangs.

The following procedure is I to make jffs2 file system and write to
flash then mount to /mnt/mtd.

1. mkfs.jffs2 -d mtd -e 0x20000 --pad 0x3080000 -o mtd.jffs2 (erase
block size is 128KB and jffs2 partition size is 48.5MB)

2. write jffs2 file system to flash in uboot.
      tftpboot 200000 mtd.jffs2;                (load mtd.jffs2 to memory)
      protect off f8f80000 fbffffff;
      erase f8f80000 fbffffff;                       (erase all 48.5MB)
      cp.b 200000 f8f80000 $filesize;     (program mtd.jffs2 to flash)
      protect on f8f80000 fbffffff;
      cmp.b 200000 f8f80000 $filesize

3. Add below in /etc/fstab file to mount to /mnt/mtd
      /dev/mtdblock4  /mnt/mtd        jffs2   defaults        1       1

Does anyone knows what purpose for jffs2_gcd_mtdx thread and why it
cause umount/sync/reboot commands hangs it is reasonable or  something
I did wrong?

BRs, H. Johnny

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

* Re: jffs2_gcd_mtdx thread and umount problem.
  2010-01-18  7:04 jffs2_gcd_mtdx thread and umount problem Johnny Hung
@ 2010-01-18  7:57 ` Joakim Tjernlund
  2010-01-18  8:26   ` Johnny Hung
  0 siblings, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2010-01-18  7:57 UTC (permalink / raw)
  To: Johnny Hung; +Cc: linuxppc-dev, linux-mtd, linux-embedded

>
> Hi All,
>
> I have a customized MPC8313 (ppc arch) board with SPANSION 64MB NOR
> flash, everything works fine but I found a abnormal about JFFS2 flahs
> filesystem.
>
> The system will mount JFFS2 to /mnt/mtd when system boot up. I try to
> execute umount /mnt/mtd or sync or reboot right away after login then
> these commands hangs. Use ps command to check process status and is D
> (Uninterruptible sleep, usually IO). I try to kill jffs2_gcd_mtd4 and
> umount/reboot/syc commands execute successfully. I think
> jffs2_gcd_mtd4 (mount /dev/mtd4) do something in the background so I
> wait for 10 minutes after login and execute the same commands and it
> doesn't hangs.
>
> The following procedure is I to make jffs2 file system and write to
> flash then mount to /mnt/mtd.
>
> 1. mkfs.jffs2 -d mtd -e 0x20000 --pad 0x3080000 -o mtd.jffs2 (erase
> block size is 128KB and jffs2 partition size is 48.5MB)
>
> 2. write jffs2 file system to flash in uboot.
>       tftpboot 200000 mtd.jffs2;                (load mtd.jffs2 to memory)
>       protect off f8f80000 fbffffff;
>       erase f8f80000 fbffffff;                       (erase all 48.5MB)
>       cp.b 200000 f8f80000 $filesize;     (program mtd.jffs2 to flash)
>       protect on f8f80000 fbffffff;
>       cmp.b 200000 f8f80000 $filesize
>
> 3. Add below in /etc/fstab file to mount to /mnt/mtd
>       /dev/mtdblock4  /mnt/mtd        jffs2   defaults        1       1
>
> Does anyone knows what purpose for jffs2_gcd_mtdx thread and why it
> cause umount/sync/reboot commands hangs it is reasonable or  something
> I did wrong?

I guess this is the first reboot after mounting a new JFFS2 FS?
Then JFFS2 is reerasing empty blocks and you will have to wait
until it is done.

I posted a patch long ago for this, but it was racy w.r.t JFSS2 module unload so
it didn't make it into the repo. Search the list for
"[JFFS2] Stop erasing blocks when rebooting." to find my old patch

  Jocke

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

* Re: jffs2_gcd_mtdx thread and umount problem.
  2010-01-18  7:57 ` Joakim Tjernlund
@ 2010-01-18  8:26   ` Johnny Hung
  2010-01-18  9:13     ` Joakim Tjernlund
  0 siblings, 1 reply; 4+ messages in thread
From: Johnny Hung @ 2010-01-18  8:26 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-embedded, linux-mtd, linuxppc-dev

Yes, umount / reboot command doesn't hang after first boot + wait for
20 minutes. The jffs2_gcd_mtdx will re-erase empty blocks but how do I
know it is finished?

BTW, why jffs2_gcd_mtd need to re-erase empty blocks and it will cause
some command cannot work if erase block is necessary. I mean many
pepple could meet this problem if it is need to erase empty block and
how do they overcome or workaround it.

Thank you so much, Jocke
BRs, H. Johnny

> I guess this is the first reboot after mounting a new JFFS2 FS?
> Then JFFS2 is reerasing empty blocks and you will have to wait
> until it is done.
>
> I posted a patch long ago for this, but it was racy w.r.t JFSS2 module unload so
> it didn't make it into the repo. Search the list for
> "[JFFS2] Stop erasing blocks when rebooting." to find my old patch
>
>  Jocke
>
>

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

* Re: jffs2_gcd_mtdx thread and umount problem.
  2010-01-18  8:26   ` Johnny Hung
@ 2010-01-18  9:13     ` Joakim Tjernlund
  0 siblings, 0 replies; 4+ messages in thread
From: Joakim Tjernlund @ 2010-01-18  9:13 UTC (permalink / raw)
  To: Johnny Hung; +Cc: linux-embedded, linux-mtd, linuxppc-dev

Johnny Hung <johnny.hacking@gmail.com> wrote on 18/01/2010 09:26:26:
>
Please don't top post.

> Yes, umount / reboot command doesn't hang after first boot + wait for
> 20 minutes. The jffs2_gcd_mtdx will re-erase empty blocks but how do I
> know it is finished?

You don't or just monitor jffs2_gcd_mtdx until it is finished.

>
> BTW, why jffs2_gcd_mtd need to re-erase empty blocks and it will cause
> some command cannot work if erase block is necessary. I mean many
> pepple could meet this problem if it is need to erase empty block and
> how do they overcome or workaround it.

Because it might not be completely erased due to power failure in the
middle of an erase. You get random bit flips if that happens.

You can avoid this by writing clean markers in every empty block when you
install it, a bit messy though and it won't solve the general problem: Try
removing a few big files and then reboot, you will have to wait then too.
If you don't use JFFS2 as a module and unload it, you can my old patch which will
solve both problems.

    Jocke
>
> Thank you so much, Jocke
> BRs, H. Johnny
>
> > I guess this is the first reboot after mounting a new JFFS2 FS?
> > Then JFFS2 is reerasing empty blocks and you will have to wait
> > until it is done.
> >
> > I posted a patch long ago for this, but it was racy w.r.t JFSS2 module unload so
> > it didn't make it into the repo. Search the list for
> > "[JFFS2] Stop erasing blocks when rebooting." to find my old patch
> >
> >  Jocke
> >
> >
>

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

end of thread, other threads:[~2010-01-18  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18  7:04 jffs2_gcd_mtdx thread and umount problem Johnny Hung
2010-01-18  7:57 ` Joakim Tjernlund
2010-01-18  8:26   ` Johnny Hung
2010-01-18  9:13     ` Joakim Tjernlund

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