From owner-svn-src-head@FreeBSD.ORG Tue Dec 16 21:13:12 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96F171065674; Tue, 16 Dec 2008 21:13:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 868398FC13; Tue, 16 Dec 2008 21:13:12 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBGLDCh0047830; Tue, 16 Dec 2008 21:13:12 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBGLDCkB047820; Tue, 16 Dec 2008 21:13:12 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200812162113.mBGLDCkB047820@svn.freebsd.org> From: Edward Tomasz Napierala Date: Tue, 16 Dec 2008 21:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186194 - in head: share/man/man9 sys/fs/hpfs sys/fs/msdosfs sys/fs/ntfs sys/fs/nwfs sys/fs/smbfs sys/gnu/fs/ext2fs sys/gnu/fs/reiserfs sys/gnu/fs/xfs/FreeBSD sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 21:13:12 -0000 Author: trasz Date: Tue Dec 16 21:13:11 2008 New Revision: 186194 URL: http://svn.freebsd.org/changeset/base/186194 Log: According to phk@, VOP_STRATEGY should never, _ever_, return anything other than 0. Make it so. This fixes "panic: VOP_STRATEGY failed bp=0xc320dd90 vp=0xc3b9f648", encountered when writing to an orphaned filesystem. Reason for the panic was the following assert: KASSERT(i == 0, ("VOP_STRATEGY failed bp=%p vp=%p", bp, bp->b_vp)); at vfs_bio:bufstrategy(). Reviewed by: scottl, phk Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: head/share/man/man9/VOP_STRATEGY.9 head/sys/fs/hpfs/hpfs_vnops.c head/sys/fs/msdosfs/msdosfs_vnops.c head/sys/fs/ntfs/ntfs_vnops.c head/sys/fs/nwfs/nwfs_vnops.c head/sys/fs/smbfs/smbfs_vnops.c head/sys/gnu/fs/ext2fs/ext2_vnops.c head/sys/gnu/fs/reiserfs/reiserfs_vnops.c head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/share/man/man9/VOP_STRATEGY.9 ============================================================================== --- head/share/man/man9/VOP_STRATEGY.9 Tue Dec 16 20:59:27 2008 (r186193) +++ head/share/man/man9/VOP_STRATEGY.9 Tue Dec 16 21:13:11 2008 (r186194) @@ -53,7 +53,9 @@ This call either reads or writes data fr .Pp The call may block. .Sh RETURN VALUES -Zero is returned on success, otherwise an error is returned. +Always zero. +Errors should be signalled by setting BIO_ERROR on b_ioflags field in struct buf, +and setting b_error to the appropriate errno value. .Sh SEE ALSO .\" .Xr buf 9 , .Xr vnode 9 Modified: head/sys/fs/hpfs/hpfs_vnops.c ============================================================================== --- head/sys/fs/hpfs/hpfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/fs/hpfs/hpfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -661,7 +661,7 @@ hpfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: head/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- head/sys/fs/msdosfs/msdosfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/fs/msdosfs/msdosfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -1880,7 +1880,7 @@ msdosfs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: head/sys/fs/ntfs/ntfs_vnops.c ============================================================================== --- head/sys/fs/ntfs/ntfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/fs/ntfs/ntfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -339,7 +339,7 @@ ntfs_strategy(ap) } } bufdone(bp); - return (error); + return (0); } static int Modified: head/sys/fs/nwfs/nwfs_vnops.c ============================================================================== --- head/sys/fs/nwfs/nwfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/fs/nwfs/nwfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -804,7 +804,7 @@ static int nwfs_strategy (ap) */ if ((bp->b_flags & B_ASYNC) == 0 ) error = nwfs_doio(ap->a_vp, bp, cr, td); - return (error); + return (0); } Modified: head/sys/fs/smbfs/smbfs_vnops.c ============================================================================== --- head/sys/fs/smbfs/smbfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/fs/smbfs/smbfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -864,7 +864,7 @@ smbfs_strategy (ap) if ((bp->b_flags & B_ASYNC) == 0 ) error = smbfs_doio(ap->a_vp, bp, cr, td); - return error; + return (0); } int Modified: head/sys/gnu/fs/ext2fs/ext2_vnops.c ============================================================================== --- head/sys/gnu/fs/ext2fs/ext2_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/gnu/fs/ext2fs/ext2_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -1399,7 +1399,7 @@ ext2_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: head/sys/gnu/fs/reiserfs/reiserfs_vnops.c ============================================================================== --- head/sys/gnu/fs/reiserfs/reiserfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/gnu/fs/reiserfs/reiserfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -350,8 +350,13 @@ reiserfs_strategy(struct vop_strategy_ar bp->b_ioflags |= BIO_ERROR; } + if (error) { + bp->b_ioflags |= BIO_ERROR; + bp->b_error = error; + } + bufdone(bp); - return (error); + return (0); } /* Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -1136,7 +1136,7 @@ _xfs_strategy( bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Tue Dec 16 20:59:27 2008 (r186193) +++ head/sys/ufs/ufs/ufs_vnops.c Tue Dec 16 21:13:11 2008 (r186194) @@ -2013,7 +2013,7 @@ ufs_strategy(ap) bp->b_error = error; bp->b_ioflags |= BIO_ERROR; bufdone(bp); - return (error); + return (0); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp);