NetBSD Problem Report #38057

From martin@duskware.de  Mon Feb 18 16:39:51 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id E17A763B293
	for <gnats-bugs@gnats.netbsd.org>; Mon, 18 Feb 2008 16:39:51 +0000 (UTC)
Message-Id: <20080218162400.6D9F763B293@narn.NetBSD.org>
Date: Mon, 18 Feb 2008 16:24:00 +0000 (UTC)
From: pooka@iki.fi
Reply-To: pooka@iki.fi
To: netbsd-bugs-owner@NetBSD.org
Subject: ffs makes assuptions about devvp file system
X-Send-Pr-Version: www-1.0

>Number:         38057
>Category:       kern
>Synopsis:       ffs makes assuptions about devvp file system
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    ad
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 18 16:40:01 +0000 2008
>Closed-Date:    Tue Apr 29 18:19:22 +0000 2008
>Last-Modified:  Tue Apr 29 18:20:05 +0000 2008
>Originator:     Antti Kantee
>Release:        
>Organization:
oh no!  more fail systems
>Environment:
>Description:
ffs VFS_SYNC/VOP_FSYNC assumes that the device vnode the file system is mounted from will be ffs.  Otherwise correct routines will not be called, especially for softdep.  As a simple example, tmpfs relegates VOP_FSYNC to spec_fsync, which simply calls vflushbuf() without any regard for ffs_full_fsync() hoops and tricks.
>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/38057: ffs makes assuptions about devvp file system
Date: Tue, 19 Feb 2008 14:17:17 +0900 (JST)

 > >Number:         38057
 > >Category:       kern
 > >Synopsis:       ffs makes assuptions about devvp file system
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       high
 > >Responsible:    kern-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Mon Feb 18 16:40:01 +0000 2008
 > >Originator:     Antti Kantee
 > >Release:        
 > >Organization:
 > oh no!  more fail systems
 > >Environment:
 > >Description:
 > ffs VFS_SYNC/VOP_FSYNC assumes that the device vnode the file system is mounted from will be ffs.  Otherwise correct routines will not be called, especially for softdep.  As a simple example, tmpfs relegates VOP_FSYNC to spec_fsync, which simply calls vflushbuf() without any regard for ffs_full_fsync() hoops and tricks.
 > >How-To-Repeat:
 > 
 > >Fix:

 PR/33406 is related.

 YAMAMOTO Takashi

From: Antti Kantee <pooka@iki.fi>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/38057: ffs makes assuptions about devvp file system
Date: Tue, 19 Feb 2008 12:08:57 +0200

 On Tue Feb 19 2008 at 05:20:01 +0000, YAMAMOTO Takashi wrote:
 >  > >Description:
 >  > ffs VFS_SYNC/VOP_FSYNC assumes that the device vnode the file system is mounted from will be ffs.  Otherwise correct routines will not be called, especially for softdep.  As a simple example, tmpfs relegates VOP_FSYNC to spec_fsync, which simply calls vflushbuf() without any regard for ffs_full_fsync() hoops and tricks.
 >  > >How-To-Repeat:
 >  > 
 >  > >Fix:
 >  
 >  PR/33406 is related.

 Indeed it is.  I was searching for fsync, sync etc. from gnats, but
 33406 is cleverly disguised under softdep ;)

 This is an even more obvious problem for some code yet to be checked in,
 that it is for softdep.  I was thinking if it could be fixed in a general
 manner by requiring that VBLK devvp has the properies of the file system
 it is used for instead of the file system that the node resides on.

 -- 
 Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
 http://www.iki.fi/pooka/                          http://www.NetBSD.org/
     "la qualité la plus indispensable du cuisinier est l'exactitude"

From: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        pooka@iki.fi
Subject: Re: kern/38057: ffs makes assuptions about devvp file system
Date: Wed, 20 Feb 2008 23:38:35 +0900 (JST)

 >  This is an even more obvious problem for some code yet to be checked in,
 >  that it is for softdep.  I was thinking if it could be fixed in a general
 >  manner by requiring that VBLK devvp has the properies of the file system
 >  it is used for instead of the file system that the node resides on.

 how about:

 	flush_buffers_for_fsync(vp)
 	{
 		mp = vp->v_specmountpoint;
 		if (mp != NULL) {
 			VFS_foo(mp, vp);
 		} else {
 			vflushbuf();
 		}
 	}

 YAMAMOTO Takashi

From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/38057: ffs makes assuptions about devvp file system
Date: Thu, 21 Feb 2008 14:35:07 +0000

 On Wed, Feb 20, 2008 at 02:40:01PM +0000, YAMAMOTO Takashi wrote:
 > The following reply was made to PR kern/38057; it has been noted by GNATS.
 > 
 > From: yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi)
 > To: gnats-bugs@NetBSD.org
 > Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
 >         pooka@iki.fi
 > Subject: Re: kern/38057: ffs makes assuptions about devvp file system
 > Date: Wed, 20 Feb 2008 23:38:35 +0900 (JST)
 > 
 >  >  This is an even more obvious problem for some code yet to be checked in,
 >  >  that it is for softdep.  I was thinking if it could be fixed in a general
 >  >  manner by requiring that VBLK devvp has the properies of the file system
 >  >  it is used for instead of the file system that the node resides on.
 >  
 >  how about:
 >  
 >  	flush_buffers_for_fsync(vp)
 >  	{
 >  		mp = vp->v_specmountpoint;
 >  		if (mp != NULL) {
 >  			VFS_foo(mp, vp);
 >  		} else {
 >  			vflushbuf();
 >  		}
 >  	}

 In another direction but just as ugly, we could record it in the spec_node
 and have something like spec_synchook_set() and spec_synchook_clear() to
 be used on devvp.

 Andrew

Responsible-Changed-From-To: kern-bug-people->ad
Responsible-Changed-By: ad@NetBSD.org
Responsible-Changed-When: Tue, 04 Mar 2008 03:18:53 +0000
Responsible-Changed-Why:
take


State-Changed-From-To: open->closed
State-Changed-By: ad@NetBSD.org
State-Changed-When: Tue, 29 Apr 2008 18:19:22 +0000
State-Changed-Why:
fixed


From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38057 CVS commit: src/sys
Date: Tue, 29 Apr 2008 18:18:10 +0000 (UTC)

 Module Name:	src
 Committed By:	ad
 Date:		Tue Apr 29 18:18:09 UTC 2008

 Modified Files:
 	src/sys/coda: coda_vfsops.c
 	src/sys/fs/adosfs: advfsops.c
 	src/sys/fs/cd9660: cd9660_vfsops.c
 	src/sys/fs/filecorefs: filecore_vfsops.c
 	src/sys/fs/hfs: hfs_vfsops.c hfs_vnops.c
 	src/sys/fs/msdosfs: msdosfs_vfsops.c
 	src/sys/fs/ntfs: ntfs_vfsops.c
 	src/sys/fs/ptyfs: ptyfs_vfsops.c
 	src/sys/fs/puffs: puffs_vfsops.c
 	src/sys/fs/smbfs: smbfs_vfsops.c
 	src/sys/fs/sysvbfs: sysvbfs.c
 	src/sys/fs/tmpfs: tmpfs_vfsops.c
 	src/sys/fs/udf: udf_vfsops.c
 	src/sys/fs/union: union_vfsops.c
 	src/sys/fs/unionfs: unionfs_vfsops.c
 	src/sys/miscfs/fdesc: fdesc_vfsops.c
 	src/sys/miscfs/kernfs: kernfs_vfsops.c
 	src/sys/miscfs/nullfs: null_vfsops.c
 	src/sys/miscfs/overlay: overlay_vfsops.c
 	src/sys/miscfs/portal: portal_vfsops.c
 	src/sys/miscfs/procfs: procfs_vfsops.c
 	src/sys/miscfs/specfs: spec_vnops.c
 	src/sys/miscfs/umapfs: umap_vfsops.c
 	src/sys/nfs: nfs_vfsops.c
 	src/sys/sys: mount.h vnode.h
 	src/sys/ufs/ext2fs: ext2fs_vfsops.c ext2fs_vnops.c
 	src/sys/ufs/ffs: ffs_softdep.c ffs_vfsops.c ffs_vnops.c
 	src/sys/ufs/lfs: lfs_vfsops.c
 	src/sys/ufs/mfs: mfs_vfsops.c

 Log Message:
 PR kern/38057 ffs makes assuptions about devvp file system
 PR kern/33406 softdeps get stuck in endless loop

 Introduce VFS_FSYNC() and call it when syncing a block device, if it
 has a mounted file system.


 To generate a diff of this commit:
 cvs rdiff -r1.64 -r1.65 src/sys/coda/coda_vfsops.c
 cvs rdiff -r1.49 -r1.50 src/sys/fs/adosfs/advfsops.c
 cvs rdiff -r1.57 -r1.58 src/sys/fs/cd9660/cd9660_vfsops.c
 cvs rdiff -r1.49 -r1.50 src/sys/fs/filecorefs/filecore_vfsops.c
 cvs rdiff -r1.16 -r1.17 src/sys/fs/hfs/hfs_vfsops.c
 cvs rdiff -r1.9 -r1.10 src/sys/fs/hfs/hfs_vnops.c
 cvs rdiff -r1.61 -r1.62 src/sys/fs/msdosfs/msdosfs_vfsops.c
 cvs rdiff -r1.65 -r1.66 src/sys/fs/ntfs/ntfs_vfsops.c
 cvs rdiff -r1.31 -r1.32 src/sys/fs/ptyfs/ptyfs_vfsops.c
 cvs rdiff -r1.78 -r1.79 src/sys/fs/puffs/puffs_vfsops.c
 cvs rdiff -r1.78 -r1.79 src/sys/fs/smbfs/smbfs_vfsops.c
 cvs rdiff -r1.10 -r1.11 src/sys/fs/sysvbfs/sysvbfs.c
 cvs rdiff -r1.39 -r1.40 src/sys/fs/tmpfs/tmpfs_vfsops.c
 cvs rdiff -r1.35 -r1.36 src/sys/fs/udf/udf_vfsops.c
 cvs rdiff -r1.52 -r1.53 src/sys/fs/union/union_vfsops.c
 cvs rdiff -r1.1 -r1.2 src/sys/fs/unionfs/unionfs_vfsops.c
 cvs rdiff -r1.73 -r1.74 src/sys/miscfs/fdesc/fdesc_vfsops.c
 cvs rdiff -r1.83 -r1.84 src/sys/miscfs/kernfs/kernfs_vfsops.c
 cvs rdiff -r1.73 -r1.74 src/sys/miscfs/nullfs/null_vfsops.c
 cvs rdiff -r1.48 -r1.49 src/sys/miscfs/overlay/overlay_vfsops.c
 cvs rdiff -r1.71 -r1.72 src/sys/miscfs/portal/portal_vfsops.c
 cvs rdiff -r1.77 -r1.78 src/sys/miscfs/procfs/procfs_vfsops.c
 cvs rdiff -r1.117 -r1.118 src/sys/miscfs/specfs/spec_vnops.c
 cvs rdiff -r1.75 -r1.76 src/sys/miscfs/umapfs/umap_vfsops.c
 cvs rdiff -r1.196 -r1.197 src/sys/nfs/nfs_vfsops.c
 cvs rdiff -r1.173 -r1.174 src/sys/sys/mount.h
 cvs rdiff -r1.192 -r1.193 src/sys/sys/vnode.h
 cvs rdiff -r1.131 -r1.132 src/sys/ufs/ext2fs/ext2fs_vfsops.c
 cvs rdiff -r1.81 -r1.82 src/sys/ufs/ext2fs/ext2fs_vnops.c
 cvs rdiff -r1.109 -r1.110 src/sys/ufs/ffs/ffs_softdep.c
 cvs rdiff -r1.223 -r1.224 src/sys/ufs/ffs/ffs_vfsops.c
 cvs rdiff -r1.98 -r1.99 src/sys/ufs/ffs/ffs_vnops.c
 cvs rdiff -r1.256 -r1.257 src/sys/ufs/lfs/lfs_vfsops.c
 cvs rdiff -r1.92 -r1.93 src/sys/ufs/mfs/mfs_vfsops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.