summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2017-12-14 17:25:40 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2017-12-14 17:25:40 +0000
commit6f4652431354098dff2399cb72b78d1a0809917e (patch)
tree7644cbbc617d2a2814a85c159fa9a097c2139706
parent847ce87541972f72ba7dfee743b65ebed06ebaf4 (diff)
If switching RW->RO, then stop deferring timestamp writes...and possibly
other pending inode attribute changes. We appear to be missing UFS_UPDATE() calls in some paths with the result that bsd.rd remounting the newly created /mnt to RO would lose the GID changes on device inodes there. This only affected devices, as they're the only inodes where timestamp writes are delayed. ok deraadt@
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 15c0722cd62..a04cda2e70f 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.168 2017/12/11 17:13:34 deraadt Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.169 2017/12/14 17:25:39 guenther Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -1151,11 +1151,23 @@ ffs_sync_vnode(struct vnode *vp, void *arg) {
struct inode *ip;
int error;
+ if (vp->v_type == VNON)
+ return (0);
+
ip = VTOI(vp);
- if (vp->v_type == VNON ||
- ((ip->i_flag &
+
+ /*
+ * If unmounting or converting rw to ro, then stop deferring
+ * timestamp writes.
+ */
+ if (fsa->waitfor == MNT_WAIT && (ip->i_flag & IN_LAZYMOD)) {
+ ip->i_flag |= IN_MODIFIED;
+ UFS_UPDATE(ip, 1);
+ }
+
+ if ((ip->i_flag &
(IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
- LIST_EMPTY(&vp->v_dirtyblkhd)) ) {
+ LIST_EMPTY(&vp->v_dirtyblkhd)) {
return (0);
}