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
This commit is contained in:
Kirk McKusick 2022-09-27 08:57:30 -07:00
parent 3247bc7cd6
commit 27d673fbbb

View file

@ -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.