FreeBSD/sys/fs/smbfs/smbfs_vfsops.c
/* Unmount the filesystem described by mp. */
Unmount the filesystem described by mp.
Unmount the filesystem described by mp .
static int
smbfs_unmount(struct mount *mp, int mntflags)
{
	struct thread *td;
	struct smbmount *smp = VFSTOSMBFS(mp);
	struct smb_cred *scred;
	struct smb_dev *dev;
	int error, flags;
	SMBVDEBUG("smbfs_unmount: flags=%04x\n", mntflags);
	td = curthread;
	flags = 0;
	if (mntflags & MNT_FORCE)
		flags |= FORCECLOSE;
	do {
		smp->sm_didrele = 0;
		error = vflush(mp, 1, flags, td);
	} while (error == EBUSY && smp->sm_didrele != 0);
	if (error)
		return error;
	scred = smbfs_malloc_scred();
	smb_makescred(scred, td, td->td_ucred);
	error = smb_share_lock(smp->sm_share);
	if (error)
		goto out;
	smb_share_put(smp->sm_share, scred);
	SMB_LOCK();
	dev = smp->sm_dev;
	if (!dev)
		panic("No private data for mount point");
	sdp_trydestroy(dev);
	mp->mnt_data = NULL;
	SMB_UNLOCK();
	free(smp, M_SMBFSDATA);
	MNT_ILOCK(mp);
	mp->mnt_flag &= ~MNT_LOCAL;
	MNT_IUNLOCK(mp);
out:
	smbfs_free_scred(scred);
	return error;
}
static int smbfs_unmount ( struct mount * mp , int mntflags ) { struct thread * td ; struct smbmount * smp = VFSTOSMBFS ( mp ) ; struct smb_cred * scred ; struct smb_dev * dev ; int error , flags ; SMBVDEBUG ( " \n " , mntflags ) ; td = curthread ; flags = 0 ; if ( mntflags & MNT_FORCE ) flags |= FORCECLOSE ; do { smp -> sm_didrele = 0 ; error = vflush ( mp , 1 , flags , td ) ; } while ( error == EBUSY && smp -> sm_didrele != 0 ) ; if ( error ) return error ; scred = smbfs_malloc_scred ( ) ; smb_makescred ( scred , td , td -> td_ucred ) ; error = smb_share_lock ( smp -> sm_share ) ; if ( error ) goto out ; smb_share_put ( smp -> sm_share , scred ) ; SMB_LOCK ( ) ; dev = smp -> sm_dev ; if ( ! dev ) panic ( " " ) ; sdp_trydestroy ( dev ) ; mp -> mnt_data = NULL ; SMB_UNLOCK ( ) ; free ( smp , M_SMBFSDATA ) ; MNT_ILOCK ( mp ) ; mp -> mnt_flag &= ~ MNT_LOCAL ; MNT_IUNLOCK ( mp ) ; out : smbfs_free_scred ( scred ) ; return error ; }
Unmount the filesystem described by mp.
Unmount the filesystem described by mp .
/*
	 * Keep trying to flush the vnode list for the mount while 
	 * some are still busy and we are making progress towards
	 * making them not busy. This is needed because smbfs vnodes
	 * reference their parent directory but may appear after their
	 * parent in the list; one pass over the vnode list is not
	 * sufficient in this case.
	 */ /* There is 1 extra root vnode reference from smbfs_mount(). */