Subject: Re: detachable device: stuck in biowait
To: Ferry Sutanto , Bill Studenmund <email@example.com>
From: Ferry Sutanto <firstname.lastname@example.org>
Date: 01/29/2002 16:49:55
NetBSD kernel gurus ...
Can I assume that there is only 1 (one) inode per file
in a file system ?
--- Ferry Sutanto <email@example.com> wrote:
> Hi Bill,
> Thank you very much for the information. Can u
> elaborate more on "invalidating the file system" ?
> kernel gets the "device gone" interrupt, the first
> thing it does is unmounting the FFS and call
> config_detach. Is this what u mean by "invalidating
> FFS" ?
> I notice that although config_detach has finished,
> kernel still tries to write by calling either
> or bwrite. I put little hack (a global flag == true
> device has gone) which will bail out if the device
> gone and I called brelse to clean up the buffer. FTP
> exit with EIO error, but the csh (shell) hangs. Does
> anybody have this problem before ?
> --- Bill Studenmund <firstname.lastname@example.org> wrote:
> > On Mon, 28 Jan 2002, Ferry Sutanto wrote:
> > > Thank you for all the information. I have done
> > > that in normal cases. Right now, I am trying to
> > put a
> > > support in the kernel in a case where the
> > > device/compact flash is pulled out during ftp
> > write
> > > session. FTP will call write to write to the
> > and
> > > write will call vn_write and eventuall access
> > > device driver. The problem I have now is that I
> > > mounted the compact flash with MNT_SYNCHRONOUS
> > > bwrite (in vfs_bio.c) will call biowait to wait
> > for
> > > "write completion" interrupt from the device.
> > Since
> > > the device is already gone, no interrupt will
> > come,
> > > hence, the kernel hangs because it is waiting
> > > somebody to wake the buffer it puts to sleep
> > (using
> > > tsleep). I haven't solved this problem yet, but
> > > encountered another one.
> > >
> > > If the kernel calls bdwrite (delayed write), how
> > does
> > > it work. I see that somebody calls the bwrite
> > it
> > > will eventual do the work. What is the condition
> > that
> > > the actual write will occur ?
> > The problem is that you shouldn't still have a
> > system when the device
> > is gone. Yor error occured earlier when you let
> > kernel think there was
> > still a devive when there wasn't.
> > When you get the eject event in the disk driver,
> > need to invalidate
> > the file system then.
> > > Question on VOP_LEASE macro. It is not really
> > obvious
> > > which function will get executed for FFS. Can
> > anybody
> > > point it out to me ?
> > Look in sys/ufs/ffs/ffs_vnode.c. There are three
> > dispatch tables. As with
> > all file systems that support fifos, there is one
> > dispatch table for fifos
> > (fifo_this, fifo_that in it). As for all file
> > systems that support device
> > nodes, there is one for device nodes (spec_this,
> > spec_that). Then there is
> > one table for everything else in the filesystem.
> > So for most things, ufs_lease_check gets called.
> > device nodes,
> > spec_lease_check. For fifos, fifo_lease_check.
> > Take care,
> > Bill
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions!