Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 1476607 Details for
Bug 1616389
fsck.gfs2 should honour the filesystem format
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Proposed patch (RHEL7 version)
bz1616389-fsck_gfs2_Don_t_check_fs_formats_we_don_t_recognise.patch (text/plain), 3.92 KB, created by
Andrew Price
on 2018-08-17 12:18:59 UTC
(
hide
)
Description:
Proposed patch (RHEL7 version)
Filename:
MIME Type:
Creator:
Andrew Price
Created:
2018-08-17 12:18:59 UTC
Size:
3.92 KB
patch
obsolete
>commit f91cd7bfb37c6e2dbe120b131f1292746cd94cba >Author: Andrew Price <anprice@redhat.com> >Date: Fri Aug 17 12:49:24 2018 +0100 > > fsck.gfs2: Don't check fs formats we don't recognise > > Currently fsck.gfs2 will ignore sb_fs_format but in order to support > future formats we need to make sure it doesn't try to check filesystems > with formats we don't recognise yet. > > Tests included. > > rhbz#1616389 > > Signed-off-by: Andrew Price <anprice@redhat.com> > >diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h >index 8af4eb41..db173c67 100644 >--- a/gfs2/fsck/fsck.h >+++ b/gfs2/fsck/fsck.h >@@ -4,6 +4,8 @@ > #include "libgfs2.h" > #include "osi_tree.h" > >+#define FSCK_MAX_FORMAT (1801) >+ > #define FSCK_HASH_SHIFT (13) > #define FSCK_HASH_SIZE (1 << FSCK_HASH_SHIFT) > #define FSCK_HASH_MASK (FSCK_HASH_SIZE - 1) >diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c >index 75f050b5..4e323ffa 100644 >--- a/gfs2/fsck/initialize.c >+++ b/gfs2/fsck/initialize.c >@@ -1332,12 +1332,12 @@ static int fill_super_block(struct gfs2_sbd *sdp) > if (sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize){ > log_crit( _("GFS superblock is larger than the blocksize!\n")); > log_debug("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n"); >- return -1; >+ return FSCK_ERROR; > } > > if (compute_constants(sdp)) { > log_crit("%s\n", _("Failed to compute file system constants")); >- exit(FSCK_ERROR); >+ return FSCK_ERROR; > } > ret = read_sb(sdp); > if (ret < 0) { >@@ -1346,10 +1346,15 @@ static int fill_super_block(struct gfs2_sbd *sdp) > /* Now that we've tried to repair it, re-read it. */ > ret = read_sb(sdp); > if (ret < 0) >- return -1; >+ return FSCK_ERROR; > } > if (sdp->gfs1) > sbd1 = (struct gfs_sb *)&sdp->sd_sb; >+ else if (sdp->sd_sb.sb_fs_format > FSCK_MAX_FORMAT) { >+ log_crit(_("Unsupported gfs2 format found: %"PRIu32"\n"), sdp->sd_sb.sb_fs_format); >+ log_crit(_("A newer fsck.gfs2 is required to check this file system.\n")); >+ return FSCK_USAGE; >+ } > return 0; > } > >@@ -1554,6 +1559,7 @@ int initialize(struct gfs2_sbd *sdp, int force_check, int preen, > int *all_clean) > { > int clean_journals = 0, open_flag; >+ int err; > > *all_clean = 0; > >@@ -1599,8 +1605,9 @@ int initialize(struct gfs2_sbd *sdp, int force_check, int preen, > } > > /* read in sb from disk */ >- if (fill_super_block(sdp)) >- return FSCK_ERROR; >+ err = fill_super_block(sdp); >+ if (err != FSCK_OK) >+ return err; > > /* Change lock protocol to be fsck_* instead of lock_* */ > if (!opts.no && preen_is_safe(sdp, preen, force_check)) { >diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c >index 61752031..d2d3e0e3 100644 >--- a/gfs2/libgfs2/super.c >+++ b/gfs2/libgfs2/super.c >@@ -29,6 +29,12 @@ int check_sb(struct gfs2_sb *sb) > errno = EIO; > return -1; > } >+ /* Check the format range but leave support checks to the utils */ >+ if (sb->sb_fs_format < GFS2_FORMAT_FS || >+ sb->sb_fs_format > GFS2_FORMAT_MULTI) { >+ errno = EINVAL; >+ return -1; >+ } > if (sb->sb_fs_format == GFS_FORMAT_FS && > sb->sb_header.mh_format == GFS_FORMAT_SB && > sb->sb_multihost_format == GFS_FORMAT_MULTI) { >diff --git a/tests/fsck.at b/tests/fsck.at >index 0dfeac33..d3cf3dbb 100644 >--- a/tests/fsck.at >+++ b/tests/fsck.at >@@ -45,3 +45,16 @@ AT_SETUP([Fix bad rindex entry #1]) > AT_KEYWORDS(fsck.gfs2 fsck) > GFS_NUKERG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [-i 1]) > AT_CLEANUP >+ >+AT_SETUP([gfs2 format versions]) >+AT_KEYWORDS(fsck.gfs2 fsck) >+GFS_TGT_REGEN >+AT_CHECK([mkfs.gfs2 -O -p lock_nolock ${GFS_TGT}], 0, [ignore], [ignore]) >+AT_CHECK([echo "set sb { sb_fs_format: 1802 }" | gfs2l ${GFS_TGT}], 0, [ignore], [ignore]) >+# Unsupported format, FSCK_USAGE == 16 >+AT_CHECK([fsck.gfs2 -y $GFS_TGT], 16, [ignore], [ignore]) >+# Format out of range >+AT_CHECK([echo "set sb { sb_fs_format: 4242 }" | gfs2l ${GFS_TGT}], 0, [ignore], [ignore]) >+AT_CHECK([fsck.gfs2 -y $GFS_TGT], 1, [ignore], [ignore]) >+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore]) >+AT_CLEANUP
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 1616389
: 1476607