Home | History | Annotate | Line # | Download | only in mfs
mfs_vfsops.c revision 1.84.4.2
      1  1.84.4.2       mjf /*	$NetBSD: mfs_vfsops.c,v 1.84.4.2 2008/02/18 21:07:32 mjf Exp $	*/
      2       1.2       cgd 
      3       1.1   mycroft /*
      4       1.1   mycroft  * Copyright (c) 1989, 1990, 1993, 1994
      5       1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
      6       1.1   mycroft  *
      7       1.1   mycroft  * Redistribution and use in source and binary forms, with or without
      8       1.1   mycroft  * modification, are permitted provided that the following conditions
      9       1.1   mycroft  * are met:
     10       1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     11       1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     12       1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     14       1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     15      1.52       agc  * 3. Neither the name of the University nor the names of its contributors
     16       1.1   mycroft  *    may be used to endorse or promote products derived from this software
     17       1.1   mycroft  *    without specific prior written permission.
     18       1.1   mycroft  *
     19       1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20       1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21       1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22       1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23       1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24       1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25       1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26       1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27       1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28       1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29       1.1   mycroft  * SUCH DAMAGE.
     30       1.1   mycroft  *
     31      1.15      fvdl  *	@(#)mfs_vfsops.c	8.11 (Berkeley) 6/19/95
     32       1.1   mycroft  */
     33      1.36     lukem 
     34      1.36     lukem #include <sys/cdefs.h>
     35  1.84.4.2       mjf __KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.84.4.2 2008/02/18 21:07:32 mjf Exp $");
     36      1.17  jonathan 
     37      1.34       mrg #if defined(_KERNEL_OPT)
     38      1.17  jonathan #include "opt_compat_netbsd.h"
     39      1.17  jonathan #endif
     40       1.1   mycroft 
     41       1.1   mycroft #include <sys/param.h>
     42       1.1   mycroft #include <sys/systm.h>
     43      1.54    atatat #include <sys/sysctl.h>
     44       1.1   mycroft #include <sys/time.h>
     45       1.1   mycroft #include <sys/kernel.h>
     46       1.1   mycroft #include <sys/proc.h>
     47       1.1   mycroft #include <sys/buf.h>
     48      1.62      yamt #include <sys/bufq.h>
     49       1.1   mycroft #include <sys/mount.h>
     50       1.1   mycroft #include <sys/signalvar.h>
     51       1.1   mycroft #include <sys/vnode.h>
     52       1.1   mycroft #include <sys/malloc.h>
     53       1.1   mycroft 
     54  1.84.4.2       mjf #include <miscfs/genfs/genfs.h>
     55  1.84.4.2       mjf #include <miscfs/specfs/specdev.h>
     56      1.33   thorpej #include <miscfs/syncfs/syncfs.h>
     57      1.33   thorpej 
     58       1.1   mycroft #include <ufs/ufs/quota.h>
     59       1.1   mycroft #include <ufs/ufs/inode.h>
     60       1.1   mycroft #include <ufs/ufs/ufsmount.h>
     61       1.1   mycroft #include <ufs/ufs/ufs_extern.h>
     62       1.1   mycroft 
     63       1.1   mycroft #include <ufs/ffs/fs.h>
     64       1.1   mycroft #include <ufs/ffs/ffs_extern.h>
     65       1.1   mycroft 
     66       1.1   mycroft #include <ufs/mfs/mfsnode.h>
     67       1.1   mycroft #include <ufs/mfs/mfs_extern.h>
     68       1.1   mycroft 
     69      1.78  christos void *	mfs_rootbase;	/* address of mini-root in kernel virtual memory */
     70       1.1   mycroft u_long	mfs_rootsize;	/* size of mini-root in bytes */
     71       1.1   mycroft 
     72       1.1   mycroft static	int mfs_minor;	/* used for building internal dev_t */
     73       1.1   mycroft 
     74      1.68   xtraeme extern int (**mfs_vnodeop_p)(void *);
     75      1.44   thorpej 
     76      1.79     pooka MALLOC_JUSTDEFINE(M_MFSNODE, "MFS node", "MFS vnode private part");
     77       1.1   mycroft 
     78       1.1   mycroft /*
     79       1.1   mycroft  * mfs vfs operations.
     80       1.1   mycroft  */
     81      1.14   thorpej 
     82      1.65     perry extern const struct vnodeopv_desc mfs_vnodeop_opv_desc;
     83      1.14   thorpej 
     84      1.31  jdolecek const struct vnodeopv_desc * const mfs_vnodeopv_descs[] = {
     85      1.14   thorpej 	&mfs_vnodeop_opv_desc,
     86      1.14   thorpej 	NULL,
     87      1.14   thorpej };
     88      1.14   thorpej 
     89       1.1   mycroft struct vfsops mfs_vfsops = {
     90       1.1   mycroft 	MOUNT_MFS,
     91      1.80       dsl 	sizeof (struct mfs_args),
     92       1.1   mycroft 	mfs_mount,
     93       1.1   mycroft 	mfs_start,
     94       1.1   mycroft 	ffs_unmount,
     95       1.1   mycroft 	ufs_root,
     96       1.1   mycroft 	ufs_quotactl,
     97      1.56  christos 	mfs_statvfs,
     98       1.1   mycroft 	ffs_sync,
     99       1.1   mycroft 	ffs_vget,
    100       1.1   mycroft 	ffs_fhtovp,
    101       1.1   mycroft 	ffs_vptofh,
    102       1.1   mycroft 	mfs_init,
    103      1.35       chs 	mfs_reinit,
    104      1.23  jdolecek 	mfs_done,
    105      1.54    atatat 	NULL,
    106      1.60   hannken 	(int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
    107      1.63   thorpej 	vfs_stdextattrctl,
    108      1.82     pooka 	(void *)eopnotsupp,	/* vfs_suspendctl */
    109  1.84.4.2       mjf 	genfs_renamelock_enter,
    110  1.84.4.2       mjf 	genfs_renamelock_exit,
    111      1.14   thorpej 	mfs_vnodeopv_descs,
    112      1.73  christos 	0,
    113      1.73  christos 	{ NULL, NULL },
    114       1.1   mycroft };
    115      1.66   thorpej VFS_ATTACH(mfs_vfsops);
    116      1.54    atatat 
    117      1.54    atatat SYSCTL_SETUP(sysctl_vfs_mfs_setup, "sysctl vfs.mfs subtree setup")
    118      1.54    atatat {
    119      1.54    atatat 
    120      1.55    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    121      1.55    atatat 		       CTLFLAG_PERMANENT,
    122      1.54    atatat 		       CTLTYPE_NODE, "vfs", NULL,
    123      1.54    atatat 		       NULL, 0, NULL, 0,
    124      1.54    atatat 		       CTL_VFS, CTL_EOL);
    125      1.55    atatat 	sysctl_createv(clog, 0, NULL, NULL,
    126      1.55    atatat 		       CTLFLAG_PERMANENT|CTLFLAG_ALIAS,
    127      1.59    atatat 		       CTLTYPE_NODE, "mfs",
    128      1.59    atatat 		       SYSCTL_DESCR("Memory based file system"),
    129      1.54    atatat 		       NULL, 1, NULL, 0,
    130      1.54    atatat 		       CTL_VFS, 3, CTL_EOL);
    131      1.54    atatat 	/*
    132      1.54    atatat 	 * XXX the "1" and the "3" above could be dynamic, thereby
    133      1.54    atatat 	 * eliminating one more instance of the "number to vfs"
    134      1.54    atatat 	 * mapping problem, but they are in order as taken from
    135      1.54    atatat 	 * sys/mount.h
    136      1.54    atatat 	 */
    137      1.54    atatat }
    138       1.1   mycroft 
    139      1.65     perry /*
    140      1.15      fvdl  * Memory based filesystem initialization.
    141      1.65     perry  */
    142      1.15      fvdl void
    143      1.68   xtraeme mfs_init(void)
    144      1.15      fvdl {
    145      1.79     pooka 
    146      1.48  christos 	malloc_type_attach(M_MFSNODE);
    147      1.23  jdolecek 	/*
    148      1.23  jdolecek 	 * ffs_init() ensures to initialize necessary resources
    149      1.23  jdolecek 	 * only once.
    150      1.23  jdolecek 	 */
    151      1.23  jdolecek 	ffs_init();
    152      1.35       chs }
    153      1.35       chs 
    154      1.35       chs void
    155      1.68   xtraeme mfs_reinit(void)
    156      1.35       chs {
    157      1.35       chs 	ffs_reinit();
    158      1.15      fvdl }
    159      1.15      fvdl 
    160      1.23  jdolecek void
    161      1.68   xtraeme mfs_done(void)
    162      1.23  jdolecek {
    163      1.23  jdolecek 	/*
    164      1.23  jdolecek 	 * ffs_done() ensures to free necessary resources
    165      1.23  jdolecek 	 * only once, when it's no more needed.
    166      1.23  jdolecek 	 */
    167      1.23  jdolecek 	ffs_done();
    168      1.48  christos 	malloc_type_detach(M_MFSNODE);
    169      1.23  jdolecek }
    170      1.15      fvdl 
    171       1.1   mycroft /*
    172       1.1   mycroft  * Called by main() when mfs is going to be mounted as root.
    173       1.1   mycroft  */
    174       1.1   mycroft 
    175      1.10  christos int
    176      1.68   xtraeme mfs_mountroot(void)
    177       1.1   mycroft {
    178      1.15      fvdl 	struct fs *fs;
    179      1.15      fvdl 	struct mount *mp;
    180      1.71  christos 	struct lwp *l = curlwp;		/* XXX */
    181       1.1   mycroft 	struct ufsmount *ump;
    182       1.1   mycroft 	struct mfsnode *mfsp;
    183      1.15      fvdl 	int error = 0;
    184       1.1   mycroft 
    185      1.21  wrstuden 	if ((error = vfs_rootmountalloc(MOUNT_MFS, "mfs_root", &mp))) {
    186      1.21  wrstuden 		vrele(rootvp);
    187      1.15      fvdl 		return (error);
    188      1.21  wrstuden 	}
    189       1.1   mycroft 
    190       1.1   mycroft 	mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    191       1.1   mycroft 	rootvp->v_data = mfsp;
    192       1.1   mycroft 	rootvp->v_op = mfs_vnodeop_p;
    193       1.1   mycroft 	rootvp->v_tag = VT_MFS;
    194       1.1   mycroft 	mfsp->mfs_baseoff = mfs_rootbase;
    195       1.1   mycroft 	mfsp->mfs_size = mfs_rootsize;
    196       1.1   mycroft 	mfsp->mfs_vnode = rootvp;
    197      1.26   thorpej 	mfsp->mfs_proc = NULL;		/* indicate kernel space */
    198      1.39   hannken 	mfsp->mfs_shutdown = 0;
    199      1.70      yamt 	bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
    200      1.71  christos 	if ((error = ffs_mountfs(rootvp, mp, l)) != 0) {
    201  1.84.4.2       mjf 		vfs_unbusy(mp, false);
    202      1.70      yamt 		bufq_free(mfsp->mfs_buflist);
    203      1.84        ad 		vfs_destroy(mp);
    204       1.1   mycroft 		free(mfsp, M_MFSNODE);
    205       1.1   mycroft 		return (error);
    206      1.65     perry 	}
    207      1.84        ad 	mutex_enter(&mountlist_lock);
    208       1.4   mycroft 	CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
    209      1.84        ad 	mutex_exit(&mountlist_lock);
    210       1.1   mycroft 	mp->mnt_vnodecovered = NULLVP;
    211       1.1   mycroft 	ump = VFSTOUFS(mp);
    212       1.1   mycroft 	fs = ump->um_fs;
    213      1.15      fvdl 	(void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0);
    214  1.84.4.1       mjf 	(void)ffs_statvfs(mp, &mp->mnt_stat);
    215  1.84.4.2       mjf 	vfs_unbusy(mp, false);
    216       1.1   mycroft 	return (0);
    217       1.1   mycroft }
    218       1.1   mycroft 
    219       1.1   mycroft /*
    220       1.1   mycroft  * This is called early in boot to set the base address and size
    221       1.1   mycroft  * of the mini-root.
    222       1.1   mycroft  */
    223      1.10  christos int
    224      1.78  christos mfs_initminiroot(void *base)
    225       1.1   mycroft {
    226      1.78  christos 	struct fs *fs = (struct fs *)((char *)base + SBLOCK_UFS1);
    227       1.1   mycroft 
    228       1.1   mycroft 	/* check for valid super block */
    229      1.45      fvdl 	if (fs->fs_magic != FS_UFS1_MAGIC || fs->fs_bsize > MAXBSIZE ||
    230       1.1   mycroft 	    fs->fs_bsize < sizeof(struct fs))
    231       1.1   mycroft 		return (0);
    232       1.1   mycroft 	mountroot = mfs_mountroot;
    233       1.1   mycroft 	mfs_rootbase = base;
    234       1.1   mycroft 	mfs_rootsize = fs->fs_fsize * fs->fs_size;
    235      1.32       cgd 	rootdev = makedev(255, mfs_minor);
    236      1.32       cgd 	mfs_minor++;
    237       1.1   mycroft 	return (mfs_rootsize);
    238       1.1   mycroft }
    239       1.1   mycroft 
    240       1.1   mycroft /*
    241       1.1   mycroft  * VFS Operations.
    242       1.1   mycroft  *
    243       1.1   mycroft  * mount system call
    244       1.1   mycroft  */
    245       1.1   mycroft /* ARGSUSED */
    246       1.1   mycroft int
    247  1.84.4.1       mjf mfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
    248       1.1   mycroft {
    249  1.84.4.1       mjf 	struct lwp *l = curlwp;
    250       1.1   mycroft 	struct vnode *devvp;
    251      1.80       dsl 	struct mfs_args *args = data;
    252       1.1   mycroft 	struct ufsmount *ump;
    253      1.25  augustss 	struct fs *fs;
    254      1.25  augustss 	struct mfsnode *mfsp;
    255      1.71  christos 	struct proc *p;
    256      1.80       dsl 	int flags, error = 0;
    257      1.80       dsl 
    258      1.80       dsl 	if (*data_len < sizeof *args)
    259      1.80       dsl 		return EINVAL;
    260      1.37       chs 
    261      1.71  christos 	p = l->l_proc;
    262      1.41  christos 	if (mp->mnt_flag & MNT_GETARGS) {
    263      1.41  christos 		struct vnode *vp;
    264      1.41  christos 
    265      1.41  christos 		ump = VFSTOUFS(mp);
    266      1.41  christos 		if (ump == NULL)
    267      1.41  christos 			return EIO;
    268      1.41  christos 
    269      1.41  christos 		vp = ump->um_devvp;
    270      1.41  christos 		if (vp == NULL)
    271      1.41  christos 			return EIO;
    272      1.41  christos 
    273      1.41  christos 		mfsp = VTOMFS(vp);
    274      1.41  christos 		if (mfsp == NULL)
    275      1.41  christos 			return EIO;
    276      1.41  christos 
    277      1.80       dsl 		args->fspec = NULL;
    278      1.80       dsl 		args->base = mfsp->mfs_baseoff;
    279      1.80       dsl 		args->size = mfsp->mfs_size;
    280      1.80       dsl 		*data_len = sizeof *args;
    281      1.80       dsl 		return 0;
    282      1.41  christos 	}
    283      1.37       chs 	/*
    284      1.37       chs 	 * XXX turn off async to avoid hangs when writing lots of data.
    285      1.37       chs 	 * the problem is that MFS needs to allocate pages to clean pages,
    286      1.37       chs 	 * so if we wait until the last minute to clean pages then there
    287      1.37       chs 	 * may not be any pages available to do the cleaning.
    288      1.42       chs 	 * ... and since the default partially-synchronous mode turns out
    289      1.42       chs 	 * to not be sufficient under heavy load, make it full synchronous.
    290      1.37       chs 	 */
    291      1.37       chs 	mp->mnt_flag &= ~MNT_ASYNC;
    292      1.42       chs 	mp->mnt_flag |= MNT_SYNCHRONOUS;
    293       1.1   mycroft 
    294       1.1   mycroft 	/*
    295       1.1   mycroft 	 * If updating, check whether changing from read-only to
    296       1.1   mycroft 	 * read/write; if there is no device name, that's all we do.
    297       1.1   mycroft 	 */
    298       1.1   mycroft 	if (mp->mnt_flag & MNT_UPDATE) {
    299       1.1   mycroft 		ump = VFSTOUFS(mp);
    300       1.1   mycroft 		fs = ump->um_fs;
    301       1.1   mycroft 		if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
    302       1.1   mycroft 			flags = WRITECLOSE;
    303       1.1   mycroft 			if (mp->mnt_flag & MNT_FORCE)
    304       1.1   mycroft 				flags |= FORCECLOSE;
    305      1.71  christos 			error = ffs_flushfiles(mp, flags, l);
    306       1.1   mycroft 			if (error)
    307       1.1   mycroft 				return (error);
    308       1.1   mycroft 		}
    309      1.53       dbj 		if (fs->fs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR))
    310       1.1   mycroft 			fs->fs_ronly = 0;
    311      1.80       dsl 		if (args->fspec == NULL)
    312      1.69      jmmv 			return EINVAL;
    313       1.1   mycroft 		return (0);
    314       1.1   mycroft 	}
    315       1.1   mycroft 	error = getnewvnode(VT_MFS, (struct mount *)0, mfs_vnodeop_p, &devvp);
    316       1.1   mycroft 	if (error)
    317       1.1   mycroft 		return (error);
    318       1.1   mycroft 	devvp->v_type = VBLK;
    319  1.84.4.2       mjf 	spec_node_init(devvp, makedev(255, mfs_minor));
    320      1.32       cgd 	mfs_minor++;
    321       1.1   mycroft 	mfsp = (struct mfsnode *)malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    322       1.1   mycroft 	devvp->v_data = mfsp;
    323      1.80       dsl 	mfsp->mfs_baseoff = args->base;
    324      1.80       dsl 	mfsp->mfs_size = args->size;
    325       1.1   mycroft 	mfsp->mfs_vnode = devvp;
    326      1.26   thorpej 	mfsp->mfs_proc = p;
    327      1.39   hannken 	mfsp->mfs_shutdown = 0;
    328      1.70      yamt 	bufq_alloc(&mfsp->mfs_buflist, "fcfs", 0);
    329      1.71  christos 	if ((error = ffs_mountfs(devvp, mp, l)) != 0) {
    330      1.39   hannken 		mfsp->mfs_shutdown = 1;
    331       1.1   mycroft 		vrele(devvp);
    332       1.1   mycroft 		return (error);
    333       1.1   mycroft 	}
    334       1.1   mycroft 	ump = VFSTOUFS(mp);
    335       1.1   mycroft 	fs = ump->um_fs;
    336      1.80       dsl 	error = set_statvfs_info(path, UIO_USERSPACE, args->fspec,
    337      1.81     pooka 	    UIO_USERSPACE, mp->mnt_op->vfs_name, mp, l);
    338      1.58  christos 	if (error)
    339      1.58  christos 		return error;
    340      1.58  christos 	(void)strncpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,
    341      1.58  christos 		sizeof(fs->fs_fsmnt));
    342      1.58  christos 	fs->fs_fsmnt[sizeof(fs->fs_fsmnt) - 1] = '\0';
    343      1.57     enami 	/* XXX: cleanup on error */
    344      1.58  christos 	return 0;
    345       1.1   mycroft }
    346       1.1   mycroft 
    347       1.1   mycroft int	mfs_pri = PWAIT | PCATCH;		/* XXX prob. temp */
    348       1.1   mycroft 
    349       1.1   mycroft /*
    350       1.1   mycroft  * Used to grab the process and keep it in the kernel to service
    351       1.1   mycroft  * memory filesystem I/O requests.
    352       1.1   mycroft  *
    353      1.28   thorpej  * Loop servicing I/O requests.
    354      1.28   thorpej  * Copy the requested data into or out of the memory filesystem
    355      1.28   thorpej  * address space.
    356       1.1   mycroft  */
    357       1.1   mycroft /* ARGSUSED */
    358       1.1   mycroft int
    359  1.84.4.1       mjf mfs_start(struct mount *mp, int flags)
    360       1.1   mycroft {
    361  1.84.4.1       mjf 	struct lwp *l = curlwp;
    362      1.25  augustss 	struct vnode *vp = VFSTOUFS(mp)->um_devvp;
    363      1.25  augustss 	struct mfsnode *mfsp = VTOMFS(vp);
    364      1.77        ad 	struct proc *p;
    365      1.28   thorpej 	struct buf *bp;
    366      1.78  christos 	void *base;
    367      1.15      fvdl 	int sleepreturn = 0;
    368      1.77        ad 	ksiginfoq_t kq;
    369       1.1   mycroft 
    370      1.28   thorpej 	base = mfsp->mfs_baseoff;
    371      1.39   hannken 	while (mfsp->mfs_shutdown != 1) {
    372      1.70      yamt 		while ((bp = BUFQ_GET(mfsp->mfs_buflist)) != NULL) {
    373      1.30    simonb 			mfs_doio(bp, base);
    374      1.78  christos 			wakeup((void *)bp);
    375      1.30    simonb 		}
    376       1.1   mycroft 		/*
    377       1.1   mycroft 		 * If a non-ignored signal is received, try to unmount.
    378      1.15      fvdl 		 * If that fails, or the filesystem is already in the
    379      1.15      fvdl 		 * process of being unmounted, clear the signal (it has been
    380      1.15      fvdl 		 * "processed"), otherwise we will loop here, as tsleep
    381      1.15      fvdl 		 * will always return EINTR/ERESTART.
    382       1.1   mycroft 		 */
    383      1.15      fvdl 		if (sleepreturn != 0) {
    384      1.33   thorpej 			/*
    385      1.33   thorpej 			 * XXX Freeze syncer.  Must do this before locking
    386      1.33   thorpej 			 * the mount point.  See dounmount() for details.
    387      1.33   thorpej 			 */
    388      1.77        ad 			mutex_enter(&syncer_mutex);
    389  1.84.4.2       mjf 			if (vfs_trybusy(mp, RW_WRITER, NULL) != 0)
    390      1.77        ad 				mutex_exit(&syncer_mutex);
    391      1.77        ad 			else if (dounmount(mp, 0, l) != 0) {
    392      1.77        ad 				p = l->l_proc;
    393      1.77        ad 				ksiginfo_queue_init(&kq);
    394      1.77        ad 				mutex_enter(&p->p_smutex);
    395      1.77        ad 				sigclearall(p, NULL, &kq);
    396      1.77        ad 				mutex_exit(&p->p_smutex);
    397      1.77        ad 				ksiginfo_queue_drain(&kq);
    398      1.77        ad 			}
    399      1.15      fvdl 			sleepreturn = 0;
    400      1.12      fvdl 			continue;
    401       1.9   mycroft 		}
    402      1.28   thorpej 
    403      1.28   thorpej 		sleepreturn = tsleep(vp, mfs_pri, "mfsidl", 0);
    404       1.1   mycroft 	}
    405      1.70      yamt 	KASSERT(BUFQ_PEEK(mfsp->mfs_buflist) == NULL);
    406      1.70      yamt 	bufq_free(mfsp->mfs_buflist);
    407      1.15      fvdl 	return (sleepreturn);
    408       1.1   mycroft }
    409       1.1   mycroft 
    410       1.1   mycroft /*
    411       1.1   mycroft  * Get file system statistics.
    412       1.1   mycroft  */
    413      1.10  christos int
    414  1.84.4.1       mjf mfs_statvfs(struct mount *mp, struct statvfs *sbp)
    415       1.1   mycroft {
    416       1.1   mycroft 	int error;
    417       1.1   mycroft 
    418  1.84.4.1       mjf 	error = ffs_statvfs(mp, sbp);
    419      1.58  christos 	if (error)
    420      1.58  christos 		return error;
    421      1.58  christos 	(void)strncpy(sbp->f_fstypename, mp->mnt_op->vfs_name,
    422      1.58  christos 	    sizeof(sbp->f_fstypename));
    423      1.58  christos 	sbp->f_fstypename[sizeof(sbp->f_fstypename) - 1] = '\0';
    424      1.58  christos 	return 0;
    425       1.1   mycroft }
    426