Subject: Re: CVS commit: src/sys/fs/smbfs
To: Jaromir Dolecek <jdolecek@netbsd.org>
From: Bill Studenmund <wrstuden@netbsd.org>
List: source-changes
Date: 02/25/2003 18:14:39
On Tue, 25 Feb 2003, Jaromir Dolecek wrote:

> Bill Studenmund wrote:
> > I'm concerned about the vref() in the error case. What happens when the
> > vflush() has killed off the vnode corresponding to the root vnode? You
> > either dereference NULL (if SMBTOV(smp->sm_root) returns NULL), or you
> > start referencing an entirely different vnode. Oh, and bad things happen
> > if smp->sm_root itself is NULL.
>
> Thanks, didn't realize this :)
>
> sm_root is expected to be !NULL on enter to smbfs_root(). There is
> KASSERT() to this effect before the vrele(), too.

I assume the smb-specific vnode structures get free'd when the vnode is
torn down, correct? So then the only thing to do is make sure that when
the root vnode gets torn down, the smb-specific stuff, at smb->sm_root,
doesn't get torn down.

The main point is to make sure you survive the root vnode getting torn
down.

> > You really need to do the gyrations done in smbfs_root(). Or do better
> > checking to make sure you vref() what you think you are vref()ing.
>
> I'm changing this to make sure sm_root is reset in case of failure,
> calling smbfs_root() instead of vref() on error.

Good good!

Take care,

Bill