On Thu, Nov 22, 2012 at 12:46:54PM +0100, Manuel Bouyer wrote: > @@ -521,6 +527,16 @@ out: > (void) UFS_TRUNCATE(vp, osize, ioflag & IO_SYNC, ap->a_cred); > uio->uio_offset -= resid - uio->uio_resid; > uio->uio_resid = resid; > + if (error == EDQUOT || error == ENOSPC) { > + /* if the process keeps writing (e.g. nfsd), > + * UFS_TRUNCATE() may be very expensive as it > + * walks the page list. As a workaround flush and > + * free all pages associated with this vnode > + */ > + (void)VOP_PUTPAGES(vp, 0, 0, > + PGO_ALLPAGES |PGO_CLEANIT | PGO_FREE | PGO_SYNCIO | > + PGO_JOURNALLOCKED); > + } > } else if (resid > uio->uio_resid && (ioflag & IO_SYNC) == IO_SYNC) > error = UFS_UPDATE(vp, NULL, NULL, UPDATE_WAIT); > else
And we should probably do this on any erorr, no only space-related errors. I've adjusted my local tree. -- Manuel Bouyer <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --