From owner-svn-src-all@FreeBSD.ORG Tue Jan 20 11:27:45 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E5A810657A7; Tue, 20 Jan 2009 11:27:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B3368FC0A; Tue, 20 Jan 2009 11:27:45 +0000 (UTC) (envelope-from kib@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 n0KBRjDu043791; Tue, 20 Jan 2009 11:27:45 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0KBRjui043789; Tue, 20 Jan 2009 11:27:45 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200901201127.n0KBRjui043789@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 20 Jan 2009 11:27:45 +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: r187467 - in head/sys: kern ufs/ffs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jan 2009 11:27:54 -0000 Author: kib Date: Tue Jan 20 11:27:45 2009 New Revision: 187467 URL: http://svn.freebsd.org/changeset/base/187467 Log: FFS puts the extended attributes blocks at the negative blocks for the vnode, from -1 down. When vinvalbuf(vp, V_ALT) is done for the vnode, it incorrectly does vm_object_page_remove(0, 0), removing all pages from the underlying vm object, not only the pages that back the extended attributes data. Change vinvalbuf() to not remove any pages from the object when V_NORMAL or V_ALT are specified. Instead, the only in-tree caller in ffs_inode.c:ffs_truncate() that specifies V_ALT explicitely removes the corresponding page range. The V_NORMAL caller does vnode_pager_setsize(vp, 0) immediately after the call to vinvalbuf(V_NORMAL) already. Reported by: csjp Reviewed by: ups MFC after: 3 weeks Modified: head/sys/kern/vfs_subr.c head/sys/ufs/ffs/ffs_inode.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Tue Jan 20 08:13:45 2009 (r187466) +++ head/sys/kern/vfs_subr.c Tue Jan 20 11:27:45 2009 (r187467) @@ -1156,7 +1156,7 @@ bufobj_invalbuf(struct bufobj *bo, int f /* * Destroy the copy in the VM cache, too. */ - if (bo->bo_object != NULL) { + if (bo->bo_object != NULL && (flags & (V_ALT | V_NORMAL)) == 0) { VM_OBJECT_LOCK(bo->bo_object); vm_object_page_remove(bo->bo_object, 0, 0, (flags & V_SAVE) ? TRUE : FALSE); Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Tue Jan 20 08:13:45 2009 (r187466) +++ head/sys/ufs/ffs/ffs_inode.c Tue Jan 20 11:27:45 2009 (r187467) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -151,6 +152,7 @@ ffs_truncate(vp, length, flags, cred, td struct fs *fs; struct buf *bp; struct ufsmount *ump; + vm_object_t object; int needextclean, softdepslowdown, extblocks; int offset, size, level, nblocks; int i, error, allerror; @@ -205,6 +207,13 @@ ffs_truncate(vp, length, flags, cred, td (void) chkdq(ip, -extblocks, NOCRED, 0); #endif vinvalbuf(vp, V_ALT, 0, 0); + if ((object = vp->v_object) != NULL) { + VM_OBJECT_LOCK(object); + vm_object_page_remove(object, + OFF_TO_IDX(lblktosize(fs, -extblocks)), 0, + FALSE); + VM_OBJECT_UNLOCK(object); + } ip->i_din2->di_extsize = 0; for (i = 0; i < NXADDR; i++) { oldblks[i] = ip->i_din2->di_extb[i];