aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2022-09-27 15:57:30 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2022-09-27 15:58:10 +0000
commit27d673fbbb79b1b829484ec127da59b45f623ebd (patch)
treec20a7f7c385e3b9410433548975043e3a4dbafe2
parent3247bc7cd65275ac30f717b9dcd8a295e92e1e1e (diff)
downloadsrc-27d673fbbb79b1b829484ec127da59b45f623ebd.tar.gz
src-27d673fbbb79b1b829484ec127da59b45f623ebd.zip
When taking a snapshot on a UFS/FFS filesystem, it must be mounted.
The "update" mount option must be specified when the "snapshot" mount option is used. Return EINVAL if the "snapshot" option is specified without the "update" option also requested. Reported by: Robert Morris Reviewed by: kib PR: 265362 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 4768d610b287..8f6e186b44b2 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -413,8 +413,11 @@ ffs_mount(struct mount *mp)
/*
* If this is a snapshot request, take the snapshot.
*/
- if (mp->mnt_flag & MNT_SNAPSHOT)
+ if (mp->mnt_flag & MNT_SNAPSHOT) {
+ if ((mp->mnt_flag & MNT_UPDATE) == 0)
+ return (EINVAL);
return (ffs_snapshot(mp, fspec));
+ }
/*
* Must not call namei() while owning busy ref.