Date: Tue, 1 Jan 2013 16:14:48 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> 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 Message-ID: <201301011614.r01GEmKA093100@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301011614.r01GEmKA093100>