tech-kern archive

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

Re: smbfs umount kernel panic fixes for review



On Wed, Jul 01, 2009 at 07:10:58PM +0300, Antti Kantee wrote:
> On Wed Jul 01 2009 at 16:58:27 +0200, Nicolas Joly wrote:
> > 
> > Hi,
> > 
> > While playing with SMBFS/CIFS shares from a NetApp FAS6080C filer; i
> > encountered some kernel panics, mostly when trying to umount the
> > filesystem after use.
> > 
> > Looking into the code most problems seems to come from the
> > smbfs_unmount() function ...
> > 
> > The root vnode is unconditionnaly destroyed, preventing any further
> > use. If the filesystem is in use, the umount will fail, but any access
> > to the root vnode will make the kernel panic. Likewise, the mount
> > structure blindly loose its reference to the specific smbmount
> > structure. Same result ... panic.
> > 
> > The attached patch, should fix them.
> > 
> > Could someone with more FS knowledge check that this is correct ?
> 
> Generally, IIRC, vflush() with a non-null special node always leads to
> some kind of trouble.  What happens now if you have someone with cwd in
> the mountpoint root?

In that case, v_usecount for the root will be greater than 1 ... And
the following test will prevent unmounting:

    if (smbfs_rootvp->v_usecount > 1 && (mntflags & MNT_FORCE) == 0)
            return EBUSY;

> If the root vnode being unconditionally destroyed is in fact the problem,
> the solution is to make VFS_ROOT() do the right thing.

Does removing the root vnode, while currently in use do make sense ?
At least `struct smbnode' refers to it with its n_parent member.

# sudo mount_smbfs -I silo.pasteur.fr //njoly@silo/sis /mnt
Password:
# cd /mnt/njoly
# sudo umount /mnt
umount: /mnt: Device busy
# cd
[...PANIC...]

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index