tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Making forced unmounts work


> Forced unmounts will most likely panic the kernel.  The main problem is
> other threads running a vnode operation when we come to clean and
> reclaim an active vnode and therefore change its operation vector and
> destroy the file system private data without locking or synchronisation.
> One solution is to to suspend the file system while it gets unmounted.
> This way all other threads running a vnode operation will wait for
> fstrans_start() to succeed.  Changing fstrans_start() to detect a now
> dead vnode it is possible to restart the vnode operation with the new
> operations vector.
> In short the attached diff:
> - Adds a new kernel-internal errno ERESTARTVOP and changes VCALL() to
>   restart a vnode operation once it returns ERESTARTVOP.
> - Changes fstrans_start() to take an optional `hint vnode' and return
>   ERESTARTVOP if the vnode becomes dead.
> - Rearranges all file system operations to call fstrans_start() before
>   accessing file system private data and check (and return) an error.
> - Changes vfs_suspend() to optionally suspend a file system without
>   syncing it to disk.  This feature is used when revoking a vnode.
> - Changes dounmount() to suspend a file system during the unmount.
> - Keeps the `struct mp' until all (dead) vnodes disappear.
> - Adds some missing operations to deadfs.
> Comments or objections?

thanks for working on this.

if possible, it's better to avoid taking a rwlock for every VOPs.
IMO umount and revoke, instead every VOPs, ought to do the hard work.
have you considered to do it at upper levels like file, descriptors,
mmaps, etc?

        1. iterate all processes to mark their files revoked
        2. make long-sleepers (fifo, nfs rpcs, etc) abort
        3. wait for reference counts settle

        you may need to send IPIs as some operations are barrier-less.

iirc dragonflybsd implements revoke at the file or descriptor level.


> --
> J. Hannken-Illjes - - TU Braunschweig 
> (Germany)

Home | Main Index | Thread Index | Old Index