ffs_vfsops.c (d9a8abf6c245f7f3f448269d58f71ef89536377b) ffs_vfsops.c (34816cb9aeca7b0ad3289c2de04cad0cd1b111ed)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1991, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 871 unchanged lines hidden (view full) ---

880 if ((newfs->fs_magic != FS_UFS1_MAGIC &&
881 newfs->fs_magic != FS_UFS2_MAGIC) ||
882 newfs->fs_bsize > MAXBSIZE ||
883 newfs->fs_bsize < sizeof(struct fs)) {
884 brelse(bp);
885 return (EIO); /* XXX needs translation */
886 }
887 /*
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1989, 1991, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 871 unchanged lines hidden (view full) ---

880 if ((newfs->fs_magic != FS_UFS1_MAGIC &&
881 newfs->fs_magic != FS_UFS2_MAGIC) ||
882 newfs->fs_bsize > MAXBSIZE ||
883 newfs->fs_bsize < sizeof(struct fs)) {
884 brelse(bp);
885 return (EIO); /* XXX needs translation */
886 }
887 /*
888 * Copy pointer fields back into superblock before copying in XXX
889 * new superblock. These should really be in the ufsmount. XXX
890 * Note that important parameters (eg fs_ncg) are unchanged.
888 * Preserve the summary information, read-only status, and
889 * superblock location by copying these fields into our new
890 * superblock before using it to update the existing superblock.
891 */
891 */
892 newfs->fs_csp = fs->fs_csp;
893 newfs->fs_maxcluster = fs->fs_maxcluster;
894 newfs->fs_contigdirs = fs->fs_contigdirs;
895 newfs->fs_active = fs->fs_active;
892 newfs->fs_si = fs->fs_si;
896 newfs->fs_ronly = fs->fs_ronly;
897 sblockloc = fs->fs_sblockloc;
898 bcopy(newfs, fs, (u_int)fs->fs_sbsize);
899 brelse(bp);
900 mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
901 ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc);
902 UFS_LOCK(ump);
903 if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {

--- 400 unchanged lines hidden (view full) ---

1304#endif /* !UFS_EXTATTR */
1305 etp = malloc(sizeof *ump->um_fsfail_task, M_UFSMNT, M_WAITOK | M_ZERO);
1306 etp->fsid = mp->mnt_stat.f_fsid;
1307 ump->um_fsfail_task = etp;
1308 return (0);
1309out:
1310 if (fs != NULL) {
1311 free(fs->fs_csp, M_UFSMNT);
893 newfs->fs_ronly = fs->fs_ronly;
894 sblockloc = fs->fs_sblockloc;
895 bcopy(newfs, fs, (u_int)fs->fs_sbsize);
896 brelse(bp);
897 mp->mnt_maxsymlinklen = fs->fs_maxsymlinklen;
898 ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc);
899 UFS_LOCK(ump);
900 if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {

--- 400 unchanged lines hidden (view full) ---

1301#endif /* !UFS_EXTATTR */
1302 etp = malloc(sizeof *ump->um_fsfail_task, M_UFSMNT, M_WAITOK | M_ZERO);
1303 etp->fsid = mp->mnt_stat.f_fsid;
1304 ump->um_fsfail_task = etp;
1305 return (0);
1306out:
1307 if (fs != NULL) {
1308 free(fs->fs_csp, M_UFSMNT);
1309 free(fs->fs_si, M_UFSMNT);
1312 free(fs, M_UFSMNT);
1313 }
1314 if (cp != NULL) {
1315 g_topology_lock();
1316 g_vfs_close(cp);
1317 g_topology_unlock();
1318 }
1319 if (ump) {

--- 221 unchanged lines hidden (view full) ---

1541 vrele(ump->um_odevvp);
1542 dev_rel(ump->um_dev);
1543 mtx_destroy(UFS_MTX(ump));
1544 if (mp->mnt_gjprovider != NULL) {
1545 free(mp->mnt_gjprovider, M_UFSMNT);
1546 mp->mnt_gjprovider = NULL;
1547 }
1548 free(fs->fs_csp, M_UFSMNT);
1310 free(fs, M_UFSMNT);
1311 }
1312 if (cp != NULL) {
1313 g_topology_lock();
1314 g_vfs_close(cp);
1315 g_topology_unlock();
1316 }
1317 if (ump) {

--- 221 unchanged lines hidden (view full) ---

1539 vrele(ump->um_odevvp);
1540 dev_rel(ump->um_dev);
1541 mtx_destroy(UFS_MTX(ump));
1542 if (mp->mnt_gjprovider != NULL) {
1543 free(mp->mnt_gjprovider, M_UFSMNT);
1544 mp->mnt_gjprovider = NULL;
1545 }
1546 free(fs->fs_csp, M_UFSMNT);
1547 free(fs->fs_si, M_UFSMNT);
1549 free(fs, M_UFSMNT);
1550 if (ump->um_fsfail_task != NULL)
1551 free(ump->um_fsfail_task, M_UFSMNT);
1552 free(ump, M_UFSMNT);
1553 mp->mnt_data = NULL;
1554 MNT_ILOCK(mp);
1555 mp->mnt_flag &= ~MNT_LOCAL;
1556 MNT_IUNLOCK(mp);

--- 732 unchanged lines hidden (view full) ---

2289 fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2);
2290 fs->fs_sblockloc = SBLOCK_UFS2;
2291 }
2292 if (MOUNTEDSOFTDEP(ump->um_mountp))
2293 softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, bp);
2294 bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
2295 fs = (struct fs *)bp->b_data;
2296 ffs_oldfscompat_write(fs, ump);
1548 free(fs, M_UFSMNT);
1549 if (ump->um_fsfail_task != NULL)
1550 free(ump->um_fsfail_task, M_UFSMNT);
1551 free(ump, M_UFSMNT);
1552 mp->mnt_data = NULL;
1553 MNT_ILOCK(mp);
1554 mp->mnt_flag &= ~MNT_LOCAL;
1555 MNT_IUNLOCK(mp);

--- 732 unchanged lines hidden (view full) ---

2288 fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2);
2289 fs->fs_sblockloc = SBLOCK_UFS2;
2290 }
2291 if (MOUNTEDSOFTDEP(ump->um_mountp))
2292 softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, bp);
2293 bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize);
2294 fs = (struct fs *)bp->b_data;
2295 ffs_oldfscompat_write(fs, ump);
2297 /*
2298 * Because we may have made changes to the superblock, we need to
2299 * recompute its check-hash.
2300 */
2296 /* Recalculate the superblock hash */
2301 fs->fs_ckhash = ffs_calc_sbhash(fs);
2302 if (devfdp->suspended)
2303 bp->b_flags |= B_VALIDSUSPWRT;
2304 if (devfdp->waitfor != MNT_WAIT)
2305 bawrite(bp);
2306 else if ((error = bwrite(bp)) != 0)
2307 devfdp->error = error;
2308 return (devfdp->error);

--- 365 unchanged lines hidden ---
2297 fs->fs_ckhash = ffs_calc_sbhash(fs);
2298 if (devfdp->suspended)
2299 bp->b_flags |= B_VALIDSUSPWRT;
2300 if (devfdp->waitfor != MNT_WAIT)
2301 bawrite(bp);
2302 else if ((error = bwrite(bp)) != 0)
2303 devfdp->error = error;
2304 return (devfdp->error);

--- 365 unchanged lines hidden ---