git: ab2dbd9b871d - main - ffs_mount(): fix snapshotting
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 17 Mar 2022 01:40:19 UTC
The branch main has been updated by rew:
URL: https://cgit.FreeBSD.org/src/commit/?id=ab2dbd9b871dd00afc6ad78acb386ffa48b6b053
commit ab2dbd9b871dd00afc6ad78acb386ffa48b6b053
Author: Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-03-17 01:27:34 +0000
Commit: Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-03-17 01:32:37 +0000
ffs_mount(): fix snapshotting
Commit 0455cc7104ec broke snapshotting for ffs. In that commit,
ffs_mount() was changed so the namei() lookup for a disk device happens
before ffs_snapshot(). This caused the issue where namei() would lookup
the snapshot file and fail because the file doesn't exist. Even if it did
exist, taking a snapshot would still fail since it's not a disk device.
Fix this by taking a snapshot of the filesystem as-is and return without
altering ro/rw or any other attributes that are passed in.
Reported by: pho
Reviewed by: mckusick
Fixes: 0455cc7104ec ("ffs_mount(): return early if namei() fails to lookup disk device")
Differential Revision: https://reviews.freebsd.org/D34562
---
sys/ufs/ffs/ffs_vfsops.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 578e71014a23..455508cf9969 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -410,6 +410,12 @@ ffs_mount(struct mount *mp)
mp->mnt_flag |= mntorflags;
MNT_IUNLOCK(mp);
+ /*
+ * If this is a snapshot request, take the snapshot.
+ */
+ if (mp->mnt_flag & MNT_SNAPSHOT)
+ return (ffs_snapshot(mp, fspec));
+
/*
* Must not call namei() while owning busy ref.
*/
@@ -684,11 +690,6 @@ ffs_mount(struct mount *mp)
MNT_IUNLOCK(mp);
}
- /*
- * If this is a snapshot request, take the snapshot.
- */
- if (mp->mnt_flag & MNT_SNAPSHOT)
- return (ffs_snapshot(mp, fspec));
}
MNT_ILOCK(mp);