diff options
author | kib <kib@FreeBSD.org> | 2013-01-01 16:14:48 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-01-01 16:14:48 +0000 |
commit | a280492f6ec061055ad6379cd9dec52f8b3fa615 (patch) | |
tree | 8e7985b61d58092788052ca1c50248ebd93236e5 /sys | |
parent | 2fad9bb720db4816b922d45d6f123dd6fd00cd1a (diff) | |
download | FreeBSD-src-a280492f6ec061055ad6379cd9dec52f8b3fa615.zip FreeBSD-src-a280492f6ec061055ad6379cd9dec52f8b3fa615.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_vnops.c | 3 | ||||
-rw-r--r-- | sys/sys/vnode.h | 1 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index cf49ecb..bbe837a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1667,7 +1667,8 @@ vfs_write_resume_flags(struct mount *mp, int flags) 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); diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 4371b40..f487f37 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -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) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 25ad79c..5f67ae5 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -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); |