From owner-freebsd-fs@FreeBSD.ORG Mon Dec 31 10:04:32 2012 Return-Path: Delivered-To: fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6836011F; Mon, 31 Dec 2012 10:04:32 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from cpsmtpb-ews08.kpnxchange.com (cpsmtpb-ews08.kpnxchange.com [213.75.39.13]) by mx1.freebsd.org (Postfix) with ESMTP id B5B8F8FC12; Mon, 31 Dec 2012 10:04:30 +0000 (UTC) Received: from cpsps-ews03.kpnxchange.com ([10.94.84.170]) by cpsmtpb-ews08.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 31 Dec 2012 11:02:20 +0100 Received: from CPSMTPM-TLF102.kpnxchange.com ([195.121.3.5]) by cpsps-ews03.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 31 Dec 2012 11:02:20 +0100 Received: from sjakie.klop.ws ([212.182.167.131]) by CPSMTPM-TLF102.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 31 Dec 2012 11:03:21 +0100 Received: from 212-182-167-131.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id 78F1C5429; Mon, 31 Dec 2012 11:03:21 +0100 (CET) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: fs@freebsd.org, "Konstantin Belousov" Subject: Re: Nandfs use of MNT_VNODE_FOREACH References: <20121227230223.GN82219@kib.kiev.ua> Date: Mon, 31 Dec 2012 11:03:21 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Ronald Klop" Message-ID: In-Reply-To: <20121227230223.GN82219@kib.kiev.ua> User-Agent: Opera Mail/12.12 (FreeBSD) X-OriginalArrivalTime: 31 Dec 2012 10:03:21.0816 (UTC) FILETIME=[10B8FD80:01CDE73E] X-RcptDomain: freebsd.org Cc: gber@freebsd.org, cognet@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2012 10:04:32 -0000 On Fri, 28 Dec 2012 00:02:23 +0100, Konstantin Belousov wrote: > I took a look at removing MNT_VNODE_FOREACH interface in the HEAD, > and apparently we still have one user of the said interface, probably, > due to cross-commits. > > Namely, nandfs utilizes the interface. First, it is obsoleted and > is going to be removed. Second, I believe that MNT_VNODE_FOREACH_ACTIVE > would be better choice there, because intent of the loop is to do > something with each dirty vnode, and dirty vnode must be active, because > there are dirty buffers attached to it. > > That said, use of vget(LK_RETRY) and immediate check for VI_DOOMED > is not useful, I removed the LK_RETRY from the lockflags. Another issue > is > that intent was to avoid sleep for locked vnode, but the check is racy. > I used LK_NOWAIT instead. > > Check for mnt_syncer is also usually done as vp->v_type == VNON, but > lets postpone this. > > Could someone who uses the filesystem test the patch below, please ? > > diff --git a/sys/fs/nandfs/nandfs_segment.c > b/sys/fs/nandfs/nandfs_segment.c > index 836bead..a73b7f2 100644 > --- a/sys/fs/nandfs/nandfs_segment.c > +++ b/sys/fs/nandfs/nandfs_segment.c > @@ -481,36 +481,20 @@ nandfs_iterate_dirty_vnodes(struct mount *mp, > struct nandfs_seginfo *seginfo) > int error, lockreq, update; > td = curthread; > - lockreq = LK_EXCLUSIVE | LK_INTERLOCK | LK_RETRY; > + lockreq = LK_EXCLUSIVE | LK_INTERLOCK; > - MNT_ILOCK(mp); > - > - MNT_VNODE_FOREACH(vp, mp, mvp) { > + MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) { > update = 0; > if (mp->mnt_syncer == vp) > continue; > - if (VOP_ISLOCKED(vp)) > - continue; > - > - VI_LOCK(vp); > - MNT_IUNLOCK(mp); > - if (vp->v_iflag & VI_DOOMED) { > + if (VOP_ISLOCKED(vp)) { > VI_UNLOCK(vp); > - MNT_ILOCK(mp); > - continue; > - } > - > - if ((error = vget(vp, lockreq, td)) != 0) { > - MNT_ILOCK(mp); > continue; > } > - if (vp->v_iflag & VI_DOOMED) { > - vput(vp); > - MNT_ILOCK(mp); > + if (vget(vp, lockreq, td) != 0) > continue; > - } > nandfs_node = VTON(vp); > if (nandfs_node->nn_flags & IN_MODIFIED) { > @@ -532,12 +516,8 @@ nandfs_iterate_dirty_vnodes(struct mount *mp, > struct nandfs_seginfo *seginfo) > if (update) > nandfs_node_update(nandfs_node); > - > - MNT_ILOCK(mp); > } > - MNT_IUNLOCK(mp); > - > return (0); > } > It looks like it hangs. No DHCP yet, so no ping also. But I have remote debugging. ... [kernel boot messages] ... Trying to mount root from nandfs:/dev/gnand0s.root []... WARNING: NANDFS is considered to be a highly experimental feature in FreeBSD. after vfs_mountroot() start_init: trying /sbin/init sys_execve returned 0 Dec 31 09:57:01 init: init started (probe0:umass-sim0:0:0:0): Down reving Protocol Version from 2 to 0? pass0 at umass-sim0 bus 0 scbus0 target 0 lun 0 pass0: Removable Direct Access SCSI-0 device pass0: Serial Number AA00000000002542 pass0: 40.000MB/s transfers GEOM: new disk da0 da0 at umass-sim0 bus 0 scbus0 target 0 lun 0 da0: Removable Direct Access SCSI-0 device da0: Serial Number AA00000000002542 da0: 40.000MB/s transfers da0: 3894MB (7975296 512 byte sectors: 255H 63S/T 496C) Setting hostuuid: 64f53bc5-bfde-11d3-902f-005043016d4c. Setting hostid: 0x2afd1481. No suitable dump device was found. Entropy harvesting: interrupts ethernet point_to_point(da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL. CDB: 1e 0 0 0 1 0 (da0:umass-sim0:0:0:0): CAM status: Auto-Sense Retrieval Failed (da0:umass-sim0:0:0:0): Error 5, Unretryable error sha256: /kernel: No such file or directory kickstart. Starting file system checks: /dev/da0s2: FILE SYSTEM CLEAN; SKIPPING CHECKS /dev/da0s2: clean, 894198 free (2526 frags, 111459 blocks, 0.3% fragmentation) /dev/da0s1: FILESYSTEM CLEAN; SKIPPING CHECKS Mounting local file systems:. Writing entropy file:. Setting hostname: sh10.klop.ws. KDB: enter: Break to debugger [ thread pid 0 tid 100042 ] Stopped at kdb_enter+0x48: ldrb r15, [r15, r15, ror r15]! db> help alltrace b break bt c call capture continue countfreebufsd delete dhwatch dump dwatch examine findstack gdb halt hwatch kill match next p panic print ps reboot reset run s script scripts search set show step t textdump thread trace unscript until w watch watchdog where write x db> Da0 is not interesting. It was used for installing and is not mounted automatically. What debug info can I provide? Ronald.