git: cab41e0dd31d - main - Do not allow snapshots on UFS filesystems using gjournal.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Thu, 25 Jul 2024 06:11:00 UTC
The branch main has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=cab41e0dd31d184bdb0d14403ca71a0f6c9a5e83

commit cab41e0dd31d184bdb0d14403ca71a0f6c9a5e83
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2024-07-25 06:09:58 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2024-07-25 06:10:47 +0000

    Do not allow snapshots on UFS filesystems using gjournal.
    
    The gjournal implementation does not properly handle the freeing
    of blocks that may be part of a snapshot. Adding this support to
    gjournal would require considerable effort. For now we simply
    do not allow snapshots to be taken on filesystems using gjournal.
    
    Reported by: ant_mail@inbox.ru
    PR:          280216
    MFC after:   1 week
---
 sys/ufs/ffs/ffs_snapshot.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index e0f87223942a..b0adb6c033c7 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -222,6 +222,15 @@ ffs_snapshot(struct mount *mp, char *snapfile)
 	ump = VFSTOUFS(mp);
 	fs = ump->um_fs;
 	sn = NULL;
+	/*
+	 * At the moment, filesystems using gjournal cannot support
+	 * taking snapshots.
+	 */
+	if ((mp->mnt_flag & MNT_GJOURNAL) != 0) {
+		vfs_mount_error(mp, "%s: Snapshots are not yet supported when "
+		    "using gjournal", fs->fs_fsmnt);
+		return (EOPNOTSUPP);
+	}
 	MNT_ILOCK(mp);
 	flag = mp->mnt_flag;
 	MNT_IUNLOCK(mp);