From 769f0c92c9cbe0444927982730118526e7ca50ca Mon Sep 17 00:00:00 2001 From: hannken Date: Thu, 13 Apr 2017 09:54:18 +0000 Subject: [PATCH] Switch procfs_domounts() to mountlist iterator. --- sys/miscfs/procfs/procfs_linux.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sys/miscfs/procfs/procfs_linux.c b/sys/miscfs/procfs/procfs_linux.c index d2ea07d21825..b8f93ed86cac 100644 --- a/sys/miscfs/procfs/procfs_linux.c +++ b/sys/miscfs/procfs/procfs_linux.c @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_linux.c,v 1.72 2016/03/28 17:23:47 mlelstv Exp $ */ +/* $NetBSD: procfs_linux.c,v 1.73 2017/04/13 09:54:18 hannken Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.72 2016/03/28 17:23:47 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.73 2017/04/13 09:54:18 hannken Exp $"); #include #include @@ -603,26 +603,22 @@ procfs_domounts(struct lwp *curl, struct proc *p, { char *bf, *mtab = NULL; size_t mtabsz = 0; - struct mount *mp, *nmp; + mount_iterator_t *iter; + struct mount *mp; int error = 0, root = 0; struct cwdinfo *cwdi = curl->l_proc->p_cwdi; bf = malloc(LBFSZ, M_TEMP, M_WAITOK); - mutex_enter(&mountlist_lock); - for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { + mountlist_iterator_init(&iter); + while ((mp = mountlist_iterator_next(iter)) != NULL) { struct statvfs sfs; - if (vfs_busy(mp, &nmp)) - continue; - if ((error = dostatvfs(mp, &sfs, curl, MNT_WAIT, 0)) == 0) root |= procfs_format_sfs(&mtab, &mtabsz, bf, LBFSZ, &sfs, curl, 0); - - vfs_unbusy(mp, false, &nmp); } - mutex_exit(&mountlist_lock); + mountlist_iterator_destroy(iter); /* * If we are inside a chroot that is not itself a mount point,