If ufs_balloc_range() fails, make sure to call ?fs_truncate() to
reset v_writesize to the right value. If v_writesize is left larger than the allocated blocks, we may have the same issue as the one described in http://mail-index.netbsd.org/tech-kern/2010/02/02/msg007156.html
This commit is contained in:
parent
a52d311628
commit
d6fd66fef6
sys/ufs
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_inode.c,v 1.107 2011/06/16 09:21:03 hannken Exp $ */
|
||||
/* $NetBSD: ffs_inode.c,v 1.108 2011/11/23 19:42:10 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 The NetBSD Foundation, Inc.
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.107 2011/06/16 09:21:03 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_inode.c,v 1.108 2011/11/23 19:42:10 bouyer Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -269,8 +269,11 @@ ffs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
uvm_vnp_setwritesize(ovp, eob);
|
||||
error = ufs_balloc_range(ovp, osize, eob - osize,
|
||||
cred, aflag);
|
||||
if (error)
|
||||
if (error) {
|
||||
(void) ffs_truncate(ovp, osize,
|
||||
ioflag & IO_SYNC, cred);
|
||||
return error;
|
||||
}
|
||||
if (ioflag & IO_SYNC) {
|
||||
mutex_enter(ovp->v_interlock);
|
||||
VOP_PUTPAGES(ovp,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lfs_inode.c,v 1.125 2011/07/11 08:27:40 hannken Exp $ */
|
||||
/* $NetBSD: lfs_inode.c,v 1.126 2011/11/23 19:42:10 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.125 2011/07/11 08:27:40 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.126 2011/11/23 19:42:10 bouyer Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_quota.h"
|
||||
@ -276,8 +276,11 @@ lfs_truncate(struct vnode *ovp, off_t length, int ioflag, kauth_cred_t cred)
|
||||
uvm_vnp_setwritesize(ovp, eob);
|
||||
error = ufs_balloc_range(ovp, osize,
|
||||
eob - osize, cred, aflags);
|
||||
if (error)
|
||||
if (error) {
|
||||
(void) lfs_truncate(ovp, osize,
|
||||
ioflag & IO_SYNC, cred);
|
||||
return error;
|
||||
}
|
||||
if (ioflag & IO_SYNC) {
|
||||
mutex_enter(ovp->v_interlock);
|
||||
VOP_PUTPAGES(ovp,
|
||||
|
Loading…
x
Reference in New Issue
Block a user