This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master in repository gfs2-utils.
commit 1da2f61160dc2a37436807708d4852bcd28ddcde Author: Andrew Price anprice@redhat.com AuthorDate: Wed Jan 6 13:38:51 2021 +0000
fsck.gfs2: Enable checking of format 1802
Format 1802 introduces trusted.* xattrs with type 4. Since the gfs2_ondisk.h kernel header may not match the booted kernel the validity check is now hard coded.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/fsck.h | 2 +- gfs2/fsck/pass1.c | 12 ++++++++++-- tests/fsck.at | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h index 877448c3..13dd7b37 100644 --- a/gfs2/fsck/fsck.h +++ b/gfs2/fsck/fsck.h @@ -4,7 +4,7 @@ #include "libgfs2.h" #include "osi_tree.h"
-#define FSCK_MAX_FORMAT (1801) +#define FSCK_MAX_FORMAT (1802)
#define FSCK_HASH_SHIFT (13) #define FSCK_HASH_SIZE (1 << FSCK_HASH_SHIFT) diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c index e6aec43e..88fc4dc4 100644 --- a/gfs2/fsck/pass1.c +++ b/gfs2/fsck/pass1.c @@ -998,6 +998,14 @@ static int ask_remove_eattr_entry(struct gfs2_sbd *sdp, return 1; }
+static int eatype_max(unsigned fs_format) +{ + int max = 4; + if (fs_format < 1802) + max = 3; + return max; +} + static int check_eattr_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *leaf_bh, struct gfs2_ea_header *ea_hdr, @@ -1038,11 +1046,11 @@ static int check_eattr_entries(struct gfs2_inode *ip, strncpy(ea_name, (char *)ea_hdr + sizeof(struct gfs2_ea_header), ea_hdr->ea_name_len);
- if (!GFS2_EATYPE_VALID(ea_hdr->ea_type) && + if (ea_hdr->ea_type > eatype_max(sdp->sd_sb.sb_fs_format) && ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){ /* Skip invalid entry */ log_err(_("EA (%s) type is invalid (%d > %d).\n"), - ea_name, ea_hdr->ea_type, GFS2_EATYPE_LAST); + ea_name, ea_hdr->ea_type, eatype_max(sdp->sd_sb.sb_fs_format)); return ask_remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev, 0, 0); } diff --git a/tests/fsck.at b/tests/fsck.at index fab28a50..727108f4 100644 --- a/tests/fsck.at +++ b/tests/fsck.at @@ -59,11 +59,13 @@ 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(GFS_RUN_OR_SKIP([echo "set sb { sb_fs_format: 1802 }" | gfs2l ${GFS_TGT}]), 0, [ignore], [ignore]) +AT_CHECK(GFS_RUN_OR_SKIP([echo "set sb { sb_fs_format: 1803 }" | 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(GFS_RUN_OR_SKIP([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_CHECK([mkfs.gfs2 -O -p lock_nolock -o format=1802 ${GFS_TGT}], 0, [ignore], [ignore]) +AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore]) AT_CLEANUP