From owner-svn-src-all@FreeBSD.ORG Tue Jan 1 16:14:49 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 733D5AF0; Tue, 1 Jan 2013 16:14:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 37DFB8FC08; Tue, 1 Jan 2013 16:14:49 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r01GEnrd093103; Tue, 1 Jan 2013 16:14:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r01GEmKA093100; Tue, 1 Jan 2013 16:14:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201301011614.r01GEmKA093100@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 1 Jan 2013 16:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244925 - in head/sys: kern sys ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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, 01 Jan 2013 16:14:49 -0000 Author: kib Date: Tue Jan 1 16:14:48 2013 New Revision: 244925 URL: http://svnweb.freebsd.org/changeset/base/244925 Log: The process_deferred_inactive() function locks the vnodes of the ufs mount, which means that is must not be called while the snaplock is owned. The vfs_write_resume(9) does call the function as the VFS_SUSP_CLEAN() method, which is too early and falls into the region still protected by snaplock. Add yet another flag for the vfs_write_resume_flags() to avoid calling suspension cleanup handler after the suspend is lifted, and use it in the ffs_snapshot() call to vfs_write_resume. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h head/sys/ufs/ffs/ffs_snapshot.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Tue Jan 1 12:48:24 2013 (r244924) +++ head/sys/kern/vfs_vnops.c Tue Jan 1 16:14:48 2013 (r244925) @@ -1667,7 +1667,8 @@ vfs_write_resume_flags(struct mount *mp, mp->mnt_writeopcount++; } MNT_IUNLOCK(mp); - VFS_SUSP_CLEAN(mp); + if ((flags & VR_NO_SUSPCLR) == 0) + VFS_SUSP_CLEAN(mp); } else if ((flags & VR_START_WRITE) != 0) { MNT_REF(mp); vn_start_write_locked(mp, 0); Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Jan 1 12:48:24 2013 (r244924) +++ head/sys/sys/vnode.h Tue Jan 1 16:14:48 2013 (r244925) @@ -393,6 +393,7 @@ extern int vttoif_tab[]; #define V_XSLEEP 0x0004 /* vn_start_write: just return after sleep */ #define VR_START_WRITE 0x0001 /* vfs_write_resume: start write atomically */ +#define VR_NO_SUSPCLR 0x0002 /* vfs_write_resume: do not clear suspension */ #define VREF(vp) vref(vp) Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Tue Jan 1 12:48:24 2013 (r244924) +++ head/sys/ufs/ffs/ffs_snapshot.c Tue Jan 1 16:14:48 2013 (r244925) @@ -687,7 +687,7 @@ out1: /* * Resume operation on filesystem. */ - vfs_write_resume_flags(vp->v_mount, VR_START_WRITE); + vfs_write_resume_flags(vp->v_mount, VR_START_WRITE | VR_NO_SUSPCLR); if (collectsnapstats && starttime.tv_sec > 0) { nanotime(&endtime); timespecsub(&endtime, &starttime);