From: kn Date: Wed, 11 Jul 2018 17:44:57 +0000 (+0000) Subject: Prevent updating async option on softdep mount X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d06c8448c5885a451f2f0ce33fc96eaf52ec1979;p=openbsd Prevent updating async option on softdep mount `mount -uo async,nosoftdep /mnt' would set "async" but keep "softdep" untouched on a read/write mount. OK deraadt krw beck bluhm --- diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 0695d54a489..6c52beaa6f8 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.177 2018/05/27 06:02:15 visa Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.178 2018/07/11 17:44:57 kn Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -241,6 +241,16 @@ ffs_mount(struct mount *mp, const char *path, void *data, error = 0; ronly = fs->fs_ronly; + /* + * Soft updates won't be set if read/write, + * so "async" will be illegal. + */ + if (ronly == 0 && (mp->mnt_flag & MNT_ASYNC) && + (fs->fs_flags & FS_DOSOFTDEP)) { + error = EINVAL; + goto error_1; + } + if (ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) { /* Flush any dirty data */ VFS_SYNC(mp, MNT_WAIT, 0, p->p_ucred, p);