FreeBSD Bugzilla – Attachment 234455 Details for
Bug 264450
ufs: Partition recognized on 12.3 not recognized on CURRENT (2573e6ced996): Cannot find file system superblock .. Invalid fstype: Invalid argument
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed fix
diffs (text/plain), 4.63 KB, created by
Kirk McKusick
on 2022-06-05 05:58:55 UTC
(
hide
)
Description:
proposed fix
Filename:
MIME Type:
Creator:
Kirk McKusick
Created:
2022-06-05 05:58:55 UTC
Size:
4.63 KB
patch
obsolete
>diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c >index f25a6cba12f4..9c441be5d210 100644 >--- a/sys/ufs/ffs/ffs_subr.c >+++ b/sys/ufs/ffs/ffs_subr.c >@@ -309,6 +309,7 @@ readsuper(void *devfd, struct fs **fsp, off_t sblockloc, int isaltsblk, > * Verify the filesystem values. > */ > #define ILOG2(num) (fls(num) - 1) >+#define FAIL(code) { printf("Failed code %d\n", code); return (ENOENT); } > > static int > validate_sblock(struct fs *fs, int isaltsblk) >@@ -325,7 +326,7 @@ validate_sblock(struct fs *fs, int isaltsblk) > sizeof(ufs2_daddr_t)) || > fs->fs_nindir != fs->fs_bsize / sizeof(ufs2_daddr_t) || > fs->fs_inopb != fs->fs_bsize / sizeof(struct ufs2_dinode)) >- return (ENOENT); >+ FAIL(1); > } else if (fs->fs_magic == FS_UFS1_MAGIC) { > if ((!isaltsblk && (fs->fs_sblockloc > SBLOCK_UFS1 || > !(fs->fs_sblockactualloc == SBLOCK_UFS1 || >@@ -337,7 +338,6 @@ validate_sblock(struct fs *fs, int isaltsblk) > fs->fs_old_inodefmt != FS_44INODEFMT || > fs->fs_old_cgoffset != 0 || > fs->fs_old_cgmask != 0xffffffff || >- fs->fs_old_size != fs->fs_size || > fs->fs_old_rotdelay != 0 || > fs->fs_old_rps != 60 || > fs->fs_old_nspf != fs->fs_fsize / sectorsize || >@@ -350,23 +350,22 @@ validate_sblock(struct fs *fs, int isaltsblk) > fs->fs_old_spc != fs->fs_fpg * fs->fs_old_nspf || > fs->fs_old_nsect != fs->fs_old_spc || > fs->fs_old_npsect != fs->fs_old_spc || >- fs->fs_old_dsize != fs->fs_dsize || > fs->fs_old_ncyl != fs->fs_ncg) >- return (ENOENT); >+ FAIL(2); > } else { >- return (ENOENT); >+ FAIL(3); > } > if (fs->fs_bsize < MINBSIZE || fs->fs_bsize > MAXBSIZE || > fs->fs_bsize < roundup(sizeof(struct fs), DEV_BSIZE) || > fs->fs_sbsize > SBLOCKSIZE || fs->fs_sbsize < fs->fs_fsize || > !powerof2(fs->fs_bsize)) >- return (ENOENT); >+ FAIL(4); > if (fs->fs_fsize < sectorsize || fs->fs_fsize > fs->fs_bsize || > fs->fs_fsize * MAXFRAG < fs->fs_bsize || !powerof2(fs->fs_fsize)) >- return (ENOENT); >+ FAIL(5); > if (fs->fs_maxbsize < fs->fs_bsize || !powerof2(fs->fs_maxbsize) || > fs->fs_maxbsize > FS_MAXCONTIG * fs->fs_bsize) >- return (ENOENT); >+ FAIL(6); > if (fs->fs_bmask != ~(fs->fs_bsize - 1) || > fs->fs_fmask != ~(fs->fs_fsize - 1) || > fs->fs_qbmask != ~fs->fs_bmask || >@@ -377,7 +376,7 @@ validate_sblock(struct fs *fs, int isaltsblk) > fs->fs_fragshift != ILOG2(fs->fs_frag) || > fs->fs_frag > MAXFRAG || > fs->fs_fsbtodb != ILOG2(fs->fs_fsize / sectorsize)) >- return (ENOENT); >+ FAIL(7); > if (fs->fs_sblkno != > roundup(howmany(fs->fs_sblockloc + SBLOCKSIZE, fs->fs_fsize), > fs->fs_frag) || >@@ -385,8 +384,8 @@ validate_sblock(struct fs *fs, int isaltsblk) > roundup(howmany(SBLOCKSIZE, fs->fs_fsize), fs->fs_frag) || > fs->fs_iblkno != fs->fs_cblkno + fs->fs_frag || > fs->fs_dblkno != fs->fs_iblkno + fs->fs_ipg / INOPF(fs) || >- fs->fs_cgsize != fragroundup(fs, CGSIZE(fs))) >- return (ENOENT); >+ fs->fs_cgsize > fs->fs_bsize) >+ FAIL(8); > if (fs->fs_csaddr != cgdmin(fs, 0) || > fs->fs_cssize != > fragroundup(fs, fs->fs_ncg * sizeof(struct csum)) || >@@ -395,14 +394,14 @@ validate_sblock(struct fs *fs, int isaltsblk) > howmany(fs->fs_cssize, fs->fs_fsize) || > fs->fs_metaspace < 0 || fs->fs_metaspace > fs->fs_fpg / 2 || > fs->fs_minfree > 99) >- return (ENOENT); >+ FAIL(9); > maxfilesize = fs->fs_bsize * UFS_NDADDR - 1; > for (sizepb = fs->fs_bsize, i = 0; i < UFS_NIADDR; i++) { > sizepb *= NINDIR(fs); > maxfilesize += sizepb; > } > if (fs->fs_maxfilesize != maxfilesize) >- return (ENOENT); >+ FAIL(10); > /* > * These values have a tight interaction with each other that > * makes it hard to tightly bound them. So we can only check >@@ -420,10 +419,10 @@ validate_sblock(struct fs *fs, int isaltsblk) > fs->fs_fpg < minfpg || fs->fs_fpg > fs->fs_size || > fs->fs_ipg * fs->fs_ncg > (((int64_t)(1)) << 32) - INOPB(fs) || > fs->fs_ipg > fs->fs_fpg || fs->fs_size < 8 * fs->fs_frag) >- return (ENOENT); >+ FAIL(11); > if (fs->fs_size <= (fs->fs_ncg - 1) * fs->fs_fpg || > fs->fs_size > fs->fs_ncg * fs->fs_fpg) >- return (ENOENT); >+ FAIL(12); > /* > * With file system clustering it is possible to allocate > * many contiguous blocks. The kernel variable maxphys defines >@@ -445,12 +444,12 @@ validate_sblock(struct fs *fs, int isaltsblk) > */ > if (fs->fs_maxcontig < 1 || > fs->fs_maxcontig > MAX(256, maxphys / fs->fs_bsize)) >- return (ENOENT); >+ FAIL(13); > if (fs->fs_maxcontig < 0 || > (fs->fs_maxcontig == 0 && fs->fs_contigsumsize != 0) || > (fs->fs_maxcontig > 1 && > fs->fs_contigsumsize != MIN(fs->fs_maxcontig, FS_MAXCONTIG))) >- return (ENOENT); >+ FAIL(14); > return (0); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 264450
:
234446
| 234455 |
248471
|
248551
|
248613