From ffc768b21357cb4a79e850f6af4a0655e167ce73 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:09:14 +0000 Subject: import gfs2-utils-3.1.10-6.el7 --- diff --git a/SOURCES/bz1482542-gfs2_edit_savemeta_Fix_up_saving_of_dinodes_symlinks.patch b/SOURCES/bz1482542-gfs2_edit_savemeta_Fix_up_saving_of_dinodes_symlinks.patch new file mode 100644 index 0000000..7c5596e --- /dev/null +++ b/SOURCES/bz1482542-gfs2_edit_savemeta_Fix_up_saving_of_dinodes_symlinks.patch @@ -0,0 +1,91 @@ +commit 52fce21ef94182fbe99b4e4344bdab42c6c95868 +Author: Andrew Price +Date: Thu Aug 17 17:45:31 2017 +0100 + + gfs2_edit savemeta: Fix up saving of dinodes/symlinks + + Factor out the code that decides whether to save the dinode contents, + improve its error reporting (and don't exit) and make sure contents of + symlink dinodes are saved. + + Resolves: rhbz#1482542 + + Signed-off-by: Andrew Price + +diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c +index dee405bc..04f67fc7 100644 +--- a/gfs2/edit/savemeta.c ++++ b/gfs2/edit/savemeta.c +@@ -190,6 +190,38 @@ static const char *anthropomorphize(unsigned long long inhuman_value) + return out_val; + } + ++static int di_save_len(struct gfs2_buffer_head *bh, uint64_t owner) ++{ ++ struct gfs2_inode *inode; ++ struct gfs2_dinode *dn; ++ int len; ++ ++ if (sbd.gfs1) ++ inode = lgfs2_gfs_inode_get(&sbd, bh); ++ else ++ inode = lgfs2_inode_get(&sbd, bh); ++ ++ if (inode == NULL) { ++ fprintf(stderr, "Error reading inode at %"PRIu64": %s\n", ++ bh->b_blocknr, strerror(errno)); ++ return 0; /* Skip the block */ ++ } ++ dn = &inode->i_di; ++ len = sizeof(struct gfs2_dinode); ++ ++ /* Do not save (user) data from the inode block unless they are ++ indirect pointers, dirents, symlinks or fs internal data */ ++ if (dn->di_height != 0 || ++ S_ISDIR(dn->di_mode) || ++ S_ISLNK(dn->di_mode) || ++ (sbd.gfs1 && dn->__pad1 == GFS_FILE_DIR) || ++ block_is_systemfile(owner)) ++ len = sbd.bsize; ++ ++ inode_put(&inode); ++ return len; ++} ++ + /* + * get_gfs_struct_info - get block type and structure length + * +@@ -205,7 +237,6 @@ static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, uint64_t owner, + int *block_type, int *gstruct_len) + { + struct gfs2_meta_header mh; +- struct gfs2_inode *inode; + + if (block_type != NULL) + *block_type = 0; +@@ -229,24 +260,7 @@ static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, uint64_t owner, + *gstruct_len = sbd.bsize; + break; + case GFS2_METATYPE_DI: /* 4 (disk inode) */ +- if (sbd.gfs1) { +- inode = lgfs2_gfs_inode_get(&sbd, lbh); +- } else { +- inode = lgfs2_inode_get(&sbd, lbh); +- } +- if (inode == NULL) { +- perror("Error reading inode"); +- exit(-1); +- } +- if (S_ISDIR(inode->i_di.di_mode) || +- (sbd.gfs1 && inode->i_di.__pad1 == GFS_FILE_DIR)) +- *gstruct_len = sbd.bsize; +- else if (!inode->i_di.di_height && !block_is_systemfile(owner) && +- !S_ISDIR(inode->i_di.di_mode)) +- *gstruct_len = sizeof(struct gfs2_dinode); +- else +- *gstruct_len = sbd.bsize; +- inode_put(&inode); ++ *gstruct_len = di_save_len(lbh, owner); + break; + case GFS2_METATYPE_IN: /* 5 (indir inode blklst) */ + *gstruct_len = sbd.bsize; /*sizeof(struct gfs_indirect);*/ diff --git a/SOURCES/bz1507091-fsck_gfs2_Make_p_n_and_y_conflicting_options.patch b/SOURCES/bz1507091-fsck_gfs2_Make_p_n_and_y_conflicting_options.patch new file mode 100644 index 0000000..90048c6 --- /dev/null +++ b/SOURCES/bz1507091-fsck_gfs2_Make_p_n_and_y_conflicting_options.patch @@ -0,0 +1,148 @@ +commit 1061c4767b1d511a9461cd3bcf2e40239cf77d8a +Author: Andrew Price +Date: Tue Oct 31 11:19:38 2017 +0000 + + fsck.gfs2: Make -p, -n and -y conflicting options + + Exit with FSCK_USAGE when these options are used in combination. Also + update the man page to make this behaviour explicit with other tweaks + for conciseness. Tests included. + + Resolves: rhbz#1507091 + + Signed-off-by: Andrew Price + +diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c +index cd260ef3..ecdcd0f6 100644 +--- a/gfs2/fsck/main.c ++++ b/gfs2/fsck/main.c +@@ -75,6 +75,11 @@ static int read_cmdline(int argc, char **argv, struct gfs2_options *gopts) + switch(c) { + + case 'a': ++ case 'p': ++ if (gopts->yes || gopts->no) { ++ fprintf(stderr, _("Options -p/-a, -y and -n may not be used together\n")); ++ return FSCK_USAGE; ++ } + preen = 1; + gopts->yes = 1; + break; +@@ -86,12 +91,12 @@ static int read_cmdline(int argc, char **argv, struct gfs2_options *gopts) + exit(FSCK_OK); + break; + case 'n': ++ if (gopts->yes || preen) { ++ fprintf(stderr, _("Options -p/-a, -y and -n may not be used together\n")); ++ return FSCK_USAGE; ++ } + gopts->no = 1; + break; +- case 'p': +- preen = 1; +- gopts->yes = 1; +- break; + case 'q': + decrease_verbosity(); + break; +@@ -103,6 +108,10 @@ static int read_cmdline(int argc, char **argv, struct gfs2_options *gopts) + exit(FSCK_OK); + break; + case 'y': ++ if (gopts->no || preen) { ++ fprintf(stderr, _("Options -p/-a, -y and -n may not be used together\n")); ++ return FSCK_USAGE; ++ } + gopts->yes = 1; + break; + case ':': +diff --git a/gfs2/man/fsck.gfs2.8 b/gfs2/man/fsck.gfs2.8 +index 56dcddcd..b2b326fb 100644 +--- a/gfs2/man/fsck.gfs2.8 ++++ b/gfs2/man/fsck.gfs2.8 +@@ -40,7 +40,7 @@ administration. + .SH OPTIONS + .TP + \fB-a\fP +-Same as the -p (preen) option. ++Same as the \fB-p\fP (preen) option. + .TP + \fB-f\fP + Force checking even if the file system seems clean. +@@ -54,29 +54,26 @@ This prints out the proper command line usage syntax. + Quiet. + .TP + \fB-n\fP +-No to all questions. +- +-By specifying this option, fsck.gfs2 will only show the changes that ++No to all questions. By specifying this option, fsck.gfs2 will only show the changes that + would be made, but not make any changes to the filesystem. ++ ++This option may not be used with the \fB-y\fP or \fB-p\fP/\fB-a\fP options. + .TP + \fB-p\fP +-Preen (same as -a: automatically repair the file system if it is dirty, +-and safe to do so, otherwise exit.) ++Automatically repair ("preen") the file system if it is dirty and safe to do so, ++otherwise exit. ++ ++If the file system has locking protocol \fIlock_nolock\fR, it is considered a ++non-shared storage device and it is considered safe. If the locking protocol ++is lock_dlm and \fB-a\fP or \fB-p\fP was specified, the check is considered unsafe as it ++cannot be determined whether the device is mounted by other nodes in the cluster. ++In this case a warning is given if any damage or dirty journals are found. The ++file system should then be unmounted from all nodes in the cluster and ++fsck.gfs2 should be run manually without the \fB-a\fP or \fB-p\fP options. + +-Note: If the file system has locking protocol lock_nolock, the file system +-is considered a non-shared storage device and the fsck is deemed safe. +-However, fsck.gfs2 does not know whether it was called automatically +-from the init process, due to options in the /etc/fstab file. Therefore, if +-the locking protocol is lock_dlm and -a or -p was specified, fsck.gfs2 +-cannot determine whether the disk is mounted by other nodes in the cluster. +-Therefore, the fsck is deemed to be unsafe and a warning is given +-if any damage or dirty journals are found. In that case, the file system +-should be unmounted from all nodes in the cluster and fsck.gfs2 should be +-run manually without the -a or -p options. ++This option may not be used with the \fB-n\fP or \fB-y\fP options. + .TP + \fB-V\fP +-Version. +- + Print out the program version information. + .TP + \fB-v\fP +@@ -85,7 +82,7 @@ Verbose operation. + Print more information while running. + .TP + \fB-y\fP +-Yes to all questions. +- +-By specifying this option, fsck.gfs2 will not prompt before making ++Yes to all questions. By specifying this option, fsck.gfs2 will not prompt before making + changes. ++ ++This option may not be used with the \fB-n\fP or \fB-p\fP/\fB-a\fP options. +diff --git a/tests/fsck.at b/tests/fsck.at +index b9953fb4..0dfeac33 100644 +--- a/tests/fsck.at ++++ b/tests/fsck.at +@@ -1,6 +1,17 @@ + AT_TESTED([fsck.gfs2]) + AT_BANNER([fsck.gfs2 tests]) + ++AT_SETUP([Conflicting options]) ++AT_KEYWORDS(fsck.gfs2 fsck) ++# Error code 16 is FSCK_USAGE ++AT_CHECK([fsck.gfs2 -y -n $GFS_TGT], 16, [ignore], [ignore]) ++AT_CHECK([fsck.gfs2 -n -y $GFS_TGT], 16, [ignore], [ignore]) ++AT_CHECK([fsck.gfs2 -n -p $GFS_TGT], 16, [ignore], [ignore]) ++AT_CHECK([fsck.gfs2 -p -n $GFS_TGT], 16, [ignore], [ignore]) ++AT_CHECK([fsck.gfs2 -y -p $GFS_TGT], 16, [ignore], [ignore]) ++AT_CHECK([fsck.gfs2 -p -y $GFS_TGT], 16, [ignore], [ignore]) ++AT_CLEANUP ++ + AT_SETUP([Fix invalid block sizes]) + AT_KEYWORDS(fsck.gfs2 fsck) + GFS_LANG_CHECK([mkfs.gfs2 -O -p lock_nolock $GFS_TGT], [set sb { sb_bsize: 0 }]) diff --git a/SOURCES/bz1518938-gfs2_edit_Print_offsets_of_indirect_pointers.patch b/SOURCES/bz1518938-gfs2_edit_Print_offsets_of_indirect_pointers.patch new file mode 100644 index 0000000..bc8e6f6 --- /dev/null +++ b/SOURCES/bz1518938-gfs2_edit_Print_offsets_of_indirect_pointers.patch @@ -0,0 +1,81 @@ +commit 1a093d1233a4d5ef83d6141928f5de693f1333ee +Author: Andrew Price +Date: Thu Nov 30 19:00:31 2017 +0000 + + gfs2_edit: Print offsets of indirect pointers + + When printing indirect pointers gfs2_edit doesn't keep track of the + location of the pointer within the indirect block and only prints an + index for each non-zero pointer. Instead, store the offset of each + non-zero pointer and print it when displaying indirect blocks, as it is + done in interactive mode. + + Resolves: rhbz#1518938 + + Signed-off-by: Andrew Price + +diff --git a/gfs2/edit/extended.c b/gfs2/edit/extended.c +index e8048532..214fdba4 100644 +--- a/gfs2/edit/extended.c ++++ b/gfs2/edit/extended.c +@@ -51,6 +51,7 @@ static int get_height(void) + static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt) + { + unsigned int x, y; ++ off_t headoff; + uint64_t p; + int i_blocks; + +@@ -62,15 +63,14 @@ static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt) + iinf->ii[x].dirents = 0; + memset(&iinf->ii[x].dirent, 0, sizeof(struct gfs2_dirents)); + } +- for (x = (sbd.gfs1 ? sizeof(struct gfs_indirect): +- sizeof(struct gfs2_meta_header)), y = 0; +- x < sbd.bsize; +- x += sizeof(uint64_t), y++) { ++ headoff = sbd.gfs1 ? sizeof(struct gfs_indirect) : sizeof(struct gfs2_meta_header); ++ for (x = headoff, y = 0; x < sbd.bsize; x += sizeof(uint64_t), y++) { + p = be64_to_cpu(*(uint64_t *)(diebuf + x)); + if (p) { + iinf->ii[i_blocks].block = p; + iinf->ii[i_blocks].mp.mp_list[hgt] = i_blocks; + iinf->ii[i_blocks].is_dir = FALSE; ++ iinf->ii[i_blocks].ptroff = (x - headoff) / sizeof(uint64_t); + i_blocks++; + } + } +@@ -177,7 +177,7 @@ static int display_indirect(struct iinfo *ind, int indblocks, int level, + for (h = 0; h < level; h++) + print_gfs2(" "); + } +- print_gfs2("%d => ", pndx); ++ print_gfs2("%d: 0x%"PRIx64" => ", pndx, ind->ii[pndx].ptroff); + if (termlines) + move(line,9); + print_gfs2("0x%"PRIx64" / %"PRId64, ind->ii[pndx].block, +diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c +index 3d0f10dd..8abadd21 100644 +--- a/gfs2/edit/gfs2hex.c ++++ b/gfs2/edit/gfs2hex.c +@@ -255,6 +255,8 @@ void do_dinode_extended(struct gfs2_dinode *dine, struct gfs2_buffer_head *lbh) + indirect->ii[indirect_blocks].mp.mp_list[0] = + ptroff; + indirect->ii[indirect_blocks].is_dir = FALSE; ++ indirect->ii[indirect_blocks].ptroff = ++ (x - sizeof(*dine)) / sizeof(uint64_t); + indirect_blocks++; + } + ptroff++; +diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h +index 4f7207b0..d2992d8e 100644 +--- a/gfs2/edit/hexedit.h ++++ b/gfs2/edit/hexedit.h +@@ -81,6 +81,7 @@ struct indirect_info { + struct gfs2_leaf lf; + struct metapath mp; + struct gfs2_dirents dirent[64]; ++ uint64_t ptroff; + }; + + struct iinfo { diff --git a/SPECS/gfs2-utils.spec b/SPECS/gfs2-utils.spec index c01780f..af5c842 100644 --- a/SPECS/gfs2-utils.spec +++ b/SPECS/gfs2-utils.spec @@ -12,7 +12,7 @@ Name: gfs2-utils Version: 3.1.10 -Release: 3%{?dist} +Release: 6%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Kernel Summary: Utilities for managing the global file system (GFS2) @@ -29,7 +29,7 @@ BuildRequires: flex BuildRequires: libblkid-devel BuildRequires: libuuid-devel BuildRequires: check-devel -URL: https://fedorahosted.org/cluster/wiki/HomePage +URL: https://pagure.io/gfs2-utils %if 0%{?rhel} > 0 ExclusiveArch: x86_64 s390x ppc64le @@ -47,7 +47,9 @@ Patch1: bz1436772-gfs2_grow_Disable_rgrp_alignment_when_dev_topology_is_unsuitab Patch2: bz1440269-1-mkfs_gfs2_Free_unnecessary_cached_pages_disable_readahead.patch Patch3: bz1440269-2-mkfs_gfs2_Fix_resource_group_alignment_issue.patch Patch4: bz1440269-3-libgfs2_Issue_one_write_per_rgrp_when_creating_them.patch - +Patch5: bz1482542-gfs2_edit_savemeta_Fix_up_saving_of_dinodes_symlinks.patch +Patch6: bz1507091-fsck_gfs2_Make_p_n_and_y_conflicting_options.patch +Patch7: bz1518938-gfs2_edit_Print_offsets_of_indirect_pointers.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -58,6 +60,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %patch2 -p1 -b .bz1440269-1-mkfs_gfs2_Free_unnecessary_cached_pages_disable_readahead %patch3 -p1 -b .bz1440269-2-mkfs_gfs2_Fix_resource_group_alignment_issue %patch4 -p1 -b .bz1440269-3-libgfs2_Issue_one_write_per_rgrp_when_creating_them +%patch5 -p1 -b .bz1482542-gfs2_edit_savemeta_Fix_up_saving_of_dinodes_symlinks +%patch6 -p1 -b .bz1507091-fsck_gfs2_Make_p_n_and_y_conflicting_options +%patch7 -p1 -b .bz1518938-gfs2_edit_Print_offsets_of_indirect_pointers %build ./autogen.sh @@ -103,6 +108,20 @@ file systems. %{_prefix}/lib/udev/rules.d/82-gfs2-withdraw.rules %changelog +* Tue Dec 05 2017 Andrew Price - 3.1.10-6 +- gfs2_edit: Print offsets of indirect pointers + Resolves: rhbz#1518938 + +* Thu Nov 02 2017 Andrew Price - 3.1.10-5 +- Update URL in spec file + Resolves: rhbz#1501738 +- fsck.gfs2: Make -p, -n and -y conflicting options + Resolves: rhbz#1507091 + +* Fri Aug 18 2017 Andrew Price - 3.1.10-4 +- gfs2_edit savemeta: Fix up saving of dinodes/symlinks + Resolves: rhbz#1482542 + * Tue Apr 18 2017 Andrew Price - 3.1.10-3 - libgfs2: Issue one write per rgrp when creating them - mkfs.gfs2: Fix resource group alignment issue