mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00:00
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
This commit is contained in:
parent
d77ca41f77
commit
f1549d7d52
|
@ -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 @@ ffs_snapshot(struct mount *mp, char *snapfile)
|
|||
} 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);
|
||||
}
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue