What's required to make removal of a mounted USB stick safe?

Bernd Walter ticso at cicely7.cicely.de
Thu May 7 19:32:10 UTC 2015


On Thu, May 07, 2015 at 01:12:28PM +0300, Dmitry Sivachenko wrote:
> 
> > On 7 ?????? 2015 ??., at 9:23, Edward Tomasz Napiera??a <trasz at FreeBSD.org> wrote:
> > 
> > 
> > Dnia 6 maj 2015 o godz. 22:49 Ryan Stone <rysto32 at gmail.com> napisa??(a):
> > 
> >> Currently FreeBSD stands a fair chance at panicking if a mounted USB drive
> >> is removed while I/O is in flight.  Does anybody know what work is involved
> >> to have the kernel safely recover from this case?  Losing data from the
> >> drive is expected of course but there's no reason that the entire kernel
> >> has to crash.
> > 
> > I've spent some time on this few years ago, and got it to work, except for one case: UFS with softupdates.  It's possible that some regressions have been introduced since then.  What's the filesystem?  Do you have a backtrace?
> 
> 
> Recently I forgot to unmount a partition on failed disk (UFS+SU), and after disk was removed it was a kernel panic (something related to SU but I did not save the trace).

Another related problem point with removeable media is the filesystem state.
It can happen that the filesystem on a mounted media is broken and panic
the kernel.
The only way to work around is fsck'ing the filesystem before mounting,
which can introduce an unacceptable delay.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.


More information about the freebsd-hackers mailing list