diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2023-06-13 07:21:43 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2023-06-13 07:22:13 +0000 |
commit | f1549d7d522995bf5d821ae08cc2f500ba545285 (patch) | |
tree | fcda551c808c6aa123a039a0d33947a280d5d6a8 /sys | |
parent | d77ca41f7762bc909a83d87ebd95735b4021652f (diff) | |
download | src-f1549d7d522995bf5d821ae08cc2f500ba545285.tar.gz src-f1549d7d522995bf5d821ae08cc2f500ba545285.zip |
Write out corrected superblock when creating a UFS/FFS snapshot.
When taking a snapshot on a UFS version 1 filesystem we need to
call ffs_oldfscompat_write() to unwind any in-memory changes that
were made to the superblock before writing it. The cause of this bug
was that the trimmed down maximum file size was not being reverted.
PR: 271352
Tested-by: Peter Holm
MFC-after: 1 week
Sponsored-by: The FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 8c3fcdbf72b9..fa744f0fab79 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -207,7 +207,7 @@ ffs_snapshot(struct mount *mp, char *snapfile) long snaplistsize = 0; int32_t *lp; void *space; - struct fs *copy_fs = NULL, *fs; + struct fs *copy_fs = NULL, *fs, *bpfs; struct thread *td = curthread; struct inode *ip, *xp; struct buf *bp, *nbp, *ibp; @@ -828,8 +828,10 @@ resumefs: } else { loc = blkoff(fs, fs->fs_sblockloc); copy_fs->fs_fmod = 0; - copy_fs->fs_ckhash = ffs_calc_sbhash(copy_fs); - bcopy((char *)copy_fs, &nbp->b_data[loc], (u_int)fs->fs_sbsize); + bpfs = (struct fs *)&nbp->b_data[loc]; + bcopy((caddr_t)copy_fs, (caddr_t)bpfs, (u_int)fs->fs_sbsize); + ffs_oldfscompat_write(bpfs, ump); + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); bawrite(nbp); } /* |