Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2012 11:03:21 +0100
From:      "Ronald Klop" <ronald-freebsd8@klop.yi.org>
To:        fs@freebsd.org, "Konstantin Belousov" <kostikbel@gmail.com>
Cc:        gber@freebsd.org, cognet@freebsd.org
Subject:   Re: Nandfs use of MNT_VNODE_FOREACH
Message-ID:  <op.wp6d7vdo8527sy@212-182-167-131.ip.telfort.nl>
In-Reply-To: <20121227230223.GN82219@kib.kiev.ua>
References:  <20121227230223.GN82219@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 28 Dec 2012 00:02:23 +0100, Konstantin Belousov  
<kostikbel@gmail.com> 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: <USB 2.0 USB Flash Drive 1100> 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: <USB 2.0 USB Flash Drive 1100> 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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?op.wp6d7vdo8527sy>