Browse Source

xfsprogs package update

Signed-off-by: basebuilder_pel7x64builder0 <basebuilder@powerel.org>
master
basebuilder_pel7x64builder0 5 years ago
parent
commit
31addb9657
  1. 128
      SOURCES/xfsprogs-4.10.0-xfs_db-fix-the-source-command-when-passed-as-a-c-opt.patch
  2. 20
      SOURCES/xfsprogs-4.10.0-xfs_metadump-ignore-0-entries.patch
  3. 12
      SOURCES/xfsprogs-4.11.0-xfs_repair-warn-about-dirty-log-with-n-option.patch
  4. 86
      SOURCES/xfsprogs-4.12.0-mkfs.xfs-allow-specification-of-0-data-stripe-width-.patch
  5. 108
      SOURCES/xfsprogs-4.12.0-xfs_db-improve-argument-naming-in-set_cur-and-set_io.patch
  6. 10
      SOURCES/xfsprogs-4.12.0-xfs_db-properly-set-inode-type.patch
  7. 12
      SOURCES/xfsprogs-4.12.0-xfs_db-update-buffer-size-when-new-type-is-set.patch
  8. 12
      SOURCES/xfsprogs-4.13.0-mkfs.xfs-Don-t-stagger-AG-for-a-single-disk.patch
  9. 10
      SOURCES/xfsprogs-4.13.0-xfs_repair-don-t-use-do_warn-for-normal-log-message.patch
  10. 55
      SOURCES/xfsprogs-4.14.0-db-increase-metadump-s-default-overly-long-extent-di.patch
  11. 35
      SOURCES/xfsprogs-4.15.0-xfs_copy-accept-CRC-version-of-ABTB_MAGIC-in-ASSERT.patch
  12. 37
      SOURCES/xfsprogs-4.15.0-xfs_db-fix-crash-when-field-list-selector-string-has.patch
  13. 97
      SOURCES/xfsprogs-4.15.0-xfsprogs-update-dead-urls.patch
  14. 16
      SOURCES/xfsprogs-4.16-xfs_repair-handle-corrupt-log.patch
  15. 194
      SOURCES/xfsprogs-4.17.0-xfs_io-add-label-command.patch
  16. 64
      SOURCES/xfsprogs-4.17.0-xfsprogs-be-careful-about-what-we-stat-in-platform_c.patch
  17. 51
      SOURCES/xfsprogs-4.18-repair-root-parent.patch
  18. 50
      SOURCES/xfsprogs-4.5.0-change-mkfs-options.patch
  19. 6
      SOURCES/xfsprogs-4.5.0-fix-headers.patch
  20. 9
      SOURCES/xfsprogs-4.5.0-revert-AGFL-pack.patch
  21. 102
      SOURCES/xfsprogs-4.5.0-revert-xfs_db-sparse-inodes.patch
  22. 30
      SOURCES/xfsprogs-4.5.0-xfs_repair-exit-value-memory.patch
  23. 60
      SOURCES/xfsprogs-4.5.0-xfs_repair-quota-inodes.patch
  24. 36
      SOURCES/xfsprogs-4.5.0-xfs_repair-rtino-version.patch
  25. 15
      SOURCES/xfsprogs-4.7.0-defang-frag.patch
  26. 34
      SOURCES/xfsprogs-4.7.0-fix-agf-limit-errors.patch
  27. 168
      SOURCES/xfsprogs-4.7.0-quota-fixes.patch
  28. 4
      SOURCES/xfsprogs-4.8.0-mkfs.xfs-clarify-ftype-defaults-in-manpage.patch
  29. 32
      SOURCES/xfsprogs-4.8.0-replace-ustat.patch
  30. 42
      SOURCES/xfsprogs-4.8.0-xfs_copy-UUID.patch
  31. 12
      SOURCES/xfsprogs-4.8.0-xfs_repair-exit-with-status-2-if-log-dirtiness-is-un.patch
  32. 35
      SOURCES/xfsprogs-4.9-xfs_io-fix-m-option.patch
  33. 14
      SOURCES/xfsprogs-4.9.0-junk-attr-leaf-count-zero.patch
  34. 8
      SOURCES/xfsprogs-revert-off64_t.patch
  35. 24
      SOURCES/xfsprogs-wrapper.h
  36. 49
      SPECS/xfsprogs.spec

128
SOURCES/xfsprogs-4.10.0-xfs_db-fix-the-source-command-when-passed-as-a-c-opt.patch

@ -0,0 +1,128 @@
From c8dc4235614292020f82a031545d66c000b455f9 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Wed, 25 Jan 2017 20:02:43 -0600
Subject: [PATCH] xfs_db: fix the 'source' command when passed as a -c option

The 'source' command is supposed to read commands out of a file and
execute them. This works great when done from an interactive command
line, but it doesn't work at all when invoked from the command line
because we never actually do anything with the opened file.

So don't load stdin into the input stack when we're only executing
command line options, and use that to decide if source_f is executing
from the command line so that we can actually run the input loop. We'll
use this for the per-field fuzzing xfstests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
db/init.c | 2 +-
db/input.c | 43 +++++++++++++++++++++++++++++++++----------
2 files changed, 34 insertions(+), 11 deletions(-)

Index: xfsprogs-4.5.0/db/init.c
===================================================================
--- xfsprogs-4.5.0.orig/db/init.c
+++ xfsprogs-4.5.0/db/init.c
@@ -192,7 +192,6 @@ main(
char **v;
int start_iocur_sp;
- pushfile(stdin);
init(argc, argv);
start_iocur_sp = iocur_sp;
@@ -207,6 +206,7 @@ main(
goto close_devices;
}
+ pushfile(stdin);
while (!done) {
if ((input = fetchline()) == NULL)
break;
Index: xfsprogs-4.5.0/db/input.c
===================================================================
--- xfsprogs-4.5.0.orig/db/input.c
+++ xfsprogs-4.5.0/db/input.c
@@ -156,7 +156,7 @@ fetchline_internal(void)
rval = NULL;
for (rlen = iscont = 0; ; ) {
- if (inputstacksize == 1) {
+ if (curinput == stdin) {
if (iscont)
dbprintf("... ");
else
@@ -181,18 +181,24 @@ fetchline_internal(void)
}
if (ferror(curinput) || feof(curinput) ||
(len = strlen(buf)) == 0) {
- popfile();
- if (curinput == NULL) {
+ /*
+ * No more input at this inputstack level; pop
+ * our fd off and return so that a lower
+ * level fetchline can handle us. If this was
+ * an interactive session, print a newline
+ * because ^D doesn't emit one.
+ */
+ if (curinput == stdin)
dbprintf("\n");
- return NULL;
- }
+
+ popfile();
iscont = 0;
rlen = 0;
if (rval) {
xfree(rval);
rval = NULL;
}
- continue;
+ return NULL;
}
if (inputstacksize == 1)
logprintf("%s", buf);
@@ -225,7 +231,9 @@ fetchline(void)
if (inputstacksize == 1) {
line = readline(get_prompt());
- if (line && *line) {
+ if (!line)
+ dbprintf("\n");
+ else if (line && *line) {
add_history(line);
logprintf("%s", line);
}
@@ -314,12 +322,27 @@ source_f(
char **argv)
{
FILE *f;
+ int c, done = 0;
+ char *input;
+ char **v;
f = fopen(argv[1], "r");
- if (f == NULL)
+ if (f == NULL) {
dbprintf(_("can't open %s\n"), argv[0]);
- else
- pushfile(f);
+ return 0;
+ }
+
+ /* Run the sourced commands now. */
+ pushfile(f);
+ while (!done) {
+ if ((input = fetchline_internal()) == NULL)
+ break;
+ v = breakline(input, &c);
+ if (c)
+ done = command(c, v);
+ doneline(input, v);
+ }
+
return 0;
}

20
SOURCES/xfsprogs-4.10.0-xfs_metadump-ignore-0-entries.patch

@ -3,18 +3,18 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Wed Feb 15 21:48:31 2017 -0600 Date: Wed Feb 15 21:48:31 2017 -0600


xfs_metadump: ignore attr leaf with 0 entries xfs_metadump: ignore attr leaf with 0 entries

Another in the ongoing saga of attribute leaves with zero Another in the ongoing saga of attribute leaves with zero
entries; in this case, if we try to metadump an inode with entries; in this case, if we try to metadump an inode with
a zero-entries attribute leaf, the zeroing code will go off a zero-entries attribute leaf, the zeroing code will go off
the rails and segfault at: the rails and segfault at:

memset(&entries[nentries], 0, memset(&entries[nentries], 0,
first_name - (char *)&entries[nentries]); first_name - (char *)&entries[nentries]);

because first_name is null, and we try to memset a large because first_name is null, and we try to memset a large
(negative) number. (negative) number.

Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
@ -24,12 +24,12 @@ index 38519f1..66952f6 100644
--- a/db/metadump.c --- a/db/metadump.c
+++ b/db/metadump.c +++ b/db/metadump.c
@@ -1654,7 +1654,8 @@ process_attr_block( @@ -1654,7 +1654,8 @@ process_attr_block(
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &hdr, leaf); xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &hdr, leaf);

nentries = hdr.count; nentries = hdr.count;
- if (nentries * sizeof(xfs_attr_leaf_entry_t) + - if (nentries * sizeof(xfs_attr_leaf_entry_t) +
+ if (nentries == 0 || + if (nentries == 0 ||
+ nentries * sizeof(xfs_attr_leaf_entry_t) + + nentries * sizeof(xfs_attr_leaf_entry_t) +
xfs_attr3_leaf_hdr_size(leaf) > xfs_attr3_leaf_hdr_size(leaf) >
XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) { XFS_ATTR3_RMT_BUF_SPACE(mp, bs)) {
if (show_warnings) if (show_warnings)

12
SOURCES/xfsprogs-4.11.0-xfs_repair-warn-about-dirty-log-with-n-option.patch

@ -19,14 +19,14 @@ Index: xfsprogs-4.5.0/repair/phase2.c
--- xfsprogs-4.5.0.orig/repair/phase2.c --- xfsprogs-4.5.0.orig/repair/phase2.c
+++ xfsprogs-4.5.0/repair/phase2.c +++ xfsprogs-4.5.0/repair/phase2.c
@@ -89,11 +89,16 @@ zero_log( @@ -89,11 +89,16 @@ zero_log(
_("zero_log: head block %" PRId64 " tail block %" PRId64 "\n"), _("zero_log: head block %" PRId64 " tail block %" PRId64 "\n"),
head_blk, tail_blk); head_blk, tail_blk);
} }
- if (!no_modify && head_blk != tail_blk) { - if (!no_modify && head_blk != tail_blk) {
- if (zap_log) { - if (zap_log) {
+ if (head_blk != tail_blk) { + if (head_blk != tail_blk) {
+ if (!no_modify && zap_log) { + if (!no_modify && zap_log) {
do_warn(_( do_warn(_(
"ALERT: The filesystem has valuable metadata changes in a log which is being\n" "ALERT: The filesystem has valuable metadata changes in a log which is being\n"
"destroyed because the -L option was used.\n")); "destroyed because the -L option was used.\n"));
+ } else if (no_modify) { + } else if (no_modify) {
@ -34,6 +34,6 @@ Index: xfsprogs-4.5.0/repair/phase2.c
+"ALERT: The filesystem has valuable metadata changes in a log which is being\n" +"ALERT: The filesystem has valuable metadata changes in a log which is being\n"
+"ignored because the -n option was used. Expect spurious inconsistencies\n" +"ignored because the -n option was used. Expect spurious inconsistencies\n"
+"which may be resolved by first mounting the filesystem to replay the log.\n")); +"which may be resolved by first mounting the filesystem to replay the log.\n"));
} else { } else {
do_warn(_( do_warn(_(
"ERROR: The filesystem has valuable metadata changes in a log which needs to\n" "ERROR: The filesystem has valuable metadata changes in a log which needs to\n"

86
SOURCES/xfsprogs-4.12.0-mkfs.xfs-allow-specification-of-0-data-stripe-width-.patch

@ -25,62 +25,62 @@ Index: xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
--- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c --- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c
+++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c +++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
@@ -909,6 +909,7 @@ main( @@ -909,6 +909,7 @@ main(
int dsw; int dsw;
int dsunit; int dsunit;
int dswidth; int dswidth;
+ int dsflag; + int dsflag;
int force_overwrite; int force_overwrite;
struct fsxattr fsx; struct fsxattr fsx;
int iaflag; int iaflag;
@@ -1012,7 +1013,7 @@ main( @@ -1012,7 +1013,7 @@ main(
dfile = logfile = rtfile = NULL; dfile = logfile = rtfile = NULL;
dsize = logsize = rtsize = rtextsize = protofile = NULL; dsize = logsize = rtsize = rtextsize = protofile = NULL;
dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0; dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0;
- nodsflag = norsflag = 0; - nodsflag = norsflag = 0;
+ dsflag = nodsflag = norsflag = 0; + dsflag = nodsflag = norsflag = 0;
force_overwrite = 0; force_overwrite = 0;
worst_freelist = 0; worst_freelist = 0;
lazy_sb_counters = 1; lazy_sb_counters = 1;
@@ -1137,6 +1138,7 @@ main( @@ -1137,6 +1138,7 @@ main(
exit(1); exit(1);
} }
dsunit = cvtnum(0, 0, value); dsunit = cvtnum(0, 0, value);
+ dsflag = 1; + dsflag = 1;
break; break;
case D_SWIDTH: case D_SWIDTH:
if (!value || *value == '\0') if (!value || *value == '\0')
@@ -1153,6 +1155,7 @@ main( @@ -1153,6 +1155,7 @@ main(
exit(1); exit(1);
} }
dswidth = cvtnum(0, 0, value); dswidth = cvtnum(0, 0, value);
+ dsflag = 1; + dsflag = 1;
break; break;
case D_SU: case D_SU:
if (!value || *value == '\0') if (!value || *value == '\0')
@@ -1164,6 +1167,7 @@ main( @@ -1164,6 +1167,7 @@ main(
D_SU); D_SU);
dsu = cvtnum( dsu = cvtnum(
blocksize, sectorsize, value); blocksize, sectorsize, value);
+ dsflag = 1; + dsflag = 1;
break; break;
case D_SW: case D_SW:
if (!value || *value == '\0') if (!value || *value == '\0')
@@ -1180,6 +1184,7 @@ main( @@ -1180,6 +1184,7 @@ main(
exit(1); exit(1);
} }
dsw = cvtnum(0, 0, value); dsw = cvtnum(0, 0, value);
+ dsflag = 1; + dsflag = 1;
break; break;
case D_NOALIGN: case D_NOALIGN:
if (dsu) if (dsu)
@@ -2078,6 +2083,10 @@ _("warning: sparse inodes not supported @@ -2078,6 +2083,10 @@ _("warning: sparse inodes not supported
calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize, calc_stripe_factors(dsu, dsw, sectorsize, lsu, lsectorsize,
&dsunit, &dswidth, &lsunit); &dsunit, &dswidth, &lsunit);

+ /* If sunit & swidth were manually specified as 0, same as noalign */ + /* If sunit & swidth were manually specified as 0, same as noalign */
+ if (dsflag && !dsunit && !dswidth) + if (dsflag && !dsunit && !dswidth)
+ nodsflag = 1; + nodsflag = 1;
+ +
xi.setblksize = sectorsize; xi.setblksize = sectorsize;

/* /*

108
SOURCES/xfsprogs-4.12.0-xfs_db-improve-argument-naming-in-set_cur-and-set_io.patch

@ -23,7 +23,7 @@ Index: xfsprogs-rhel7.5/db/io.c
--- xfsprogs-rhel7.5.orig/db/io.c --- xfsprogs-rhel7.5.orig/db/io.c
+++ xfsprogs-rhel7.5/db/io.c +++ xfsprogs-rhel7.5/db/io.c
@@ -487,9 +487,9 @@ write_cur(void) @@ -487,9 +487,9 @@ write_cur(void)

void void
set_cur( set_cur(
- const typ_t *t, - const typ_t *t,
@ -32,101 +32,101 @@ Index: xfsprogs-rhel7.5/db/io.c
+ const typ_t *type, + const typ_t *type,
+ xfs_daddr_t blknum, + xfs_daddr_t blknum,
+ int len, + int len,
int ring_flag, int ring_flag,
bbmap_t *bbmap) bbmap_t *bbmap)
{ {
@@ -497,14 +497,13 @@ set_cur( @@ -497,14 +497,13 @@ set_cur(
xfs_ino_t dirino; xfs_ino_t dirino;
xfs_ino_t ino; xfs_ino_t ino;
__uint16_t mode; __uint16_t mode;
- const struct xfs_buf_ops *ops = t ? t->bops : NULL; - const struct xfs_buf_ops *ops = t ? t->bops : NULL;
+ const struct xfs_buf_ops *ops = type ? type->bops : NULL; + const struct xfs_buf_ops *ops = type ? type->bops : NULL;

if (iocur_sp < 0) { if (iocur_sp < 0) {
dbprintf(_("set_cur no stack element to set\n")); dbprintf(_("set_cur no stack element to set\n"));
return; return;
} }

- -
ino = iocur_top->ino; ino = iocur_top->ino;
dirino = iocur_top->dirino; dirino = iocur_top->dirino;
mode = iocur_top->mode; mode = iocur_top->mode;
@@ -514,7 +513,7 @@ set_cur( @@ -514,7 +513,7 @@ set_cur(
if (bbmap) { if (bbmap) {
#ifdef DEBUG_BBMAP #ifdef DEBUG_BBMAP
int i; int i;
- printf(_("xfs_db got a bbmap for %lld\n"), (long long)d); - printf(_("xfs_db got a bbmap for %lld\n"), (long long)d);
+ printf(_("xfs_db got a bbmap for %lld\n"), (long long)blknum); + printf(_("xfs_db got a bbmap for %lld\n"), (long long)blknum);
printf(_("\tblock map")); printf(_("\tblock map"));
for (i = 0; i < bbmap->nmaps; i++) for (i = 0; i < bbmap->nmaps; i++)
printf(" %lld:%d", (long long)bbmap->b[i].bm_bn, printf(" %lld:%d", (long long)bbmap->b[i].bm_bn,
@@ -528,7 +527,7 @@ set_cur( @@ -528,7 +527,7 @@ set_cur(
bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b, bp = libxfs_readbuf_map(mp->m_ddev_targp, bbmap->b,
bbmap->nmaps, 0, ops); bbmap->nmaps, 0, ops);
} else { } else {
- bp = libxfs_readbuf(mp->m_ddev_targp, d, c, 0, ops); - bp = libxfs_readbuf(mp->m_ddev_targp, d, c, 0, ops);
+ bp = libxfs_readbuf(mp->m_ddev_targp, blknum, len, 0, ops); + bp = libxfs_readbuf(mp->m_ddev_targp, blknum, len, 0, ops);
iocur_top->bbmap = NULL; iocur_top->bbmap = NULL;
} }

@@ -544,13 +543,13 @@ set_cur( @@ -544,13 +543,13 @@ set_cur(
if (!ops) if (!ops)
bp->b_flags |= LIBXFS_B_UNCHECKED; bp->b_flags |= LIBXFS_B_UNCHECKED;

- iocur_top->bb = d; - iocur_top->bb = d;
- iocur_top->blen = c; - iocur_top->blen = c;
+ iocur_top->bb = blknum; + iocur_top->bb = blknum;
+ iocur_top->blen = len; + iocur_top->blen = len;
iocur_top->boff = 0; iocur_top->boff = 0;
iocur_top->data = iocur_top->buf; iocur_top->data = iocur_top->buf;
- iocur_top->len = BBTOB(c); - iocur_top->len = BBTOB(c);
- iocur_top->off = d << BBSHIFT; - iocur_top->off = d << BBSHIFT;
- iocur_top->typ = cur_typ = t; - iocur_top->typ = cur_typ = t;
+ iocur_top->len = BBTOB(len); + iocur_top->len = BBTOB(len);
+ iocur_top->off = blknum << BBSHIFT; + iocur_top->off = blknum << BBSHIFT;
+ iocur_top->typ = cur_typ = type; + iocur_top->typ = cur_typ = type;
iocur_top->ino = ino; iocur_top->ino = ino;
iocur_top->dirino = dirino; iocur_top->dirino = dirino;
iocur_top->mode = mode; iocur_top->mode = mode;
@@ -564,23 +563,24 @@ set_cur( @@ -564,23 +563,24 @@ set_cur(

void void
set_iocur_type( set_iocur_type(
- const typ_t *t) - const typ_t *t)
+ const typ_t *type) + const typ_t *type)
{ {
struct xfs_buf *bp = iocur_top->bp; struct xfs_buf *bp = iocur_top->bp;

/* adjust buffer size for types with fields & hence fsize() */ /* adjust buffer size for types with fields & hence fsize() */
- if (t->fields) { - if (t->fields) {
+ if (type->fields) { + if (type->fields) {
int bb_count; /* type's size in basic blocks */ int bb_count; /* type's size in basic blocks */

- bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0))); - bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0)));
- set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL); - set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
+ bb_count = BTOBB(byteize(fsize(type->fields, + bb_count = BTOBB(byteize(fsize(type->fields,
+ iocur_top->data, 0, 0))); + iocur_top->data, 0, 0)));
+ set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL); + set_cur(type, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
} }
- iocur_top->typ = t; - iocur_top->typ = t;
+ iocur_top->typ = type; + iocur_top->typ = type;

/* verify the buffer if the type has one. */ /* verify the buffer if the type has one. */
if (!bp) if (!bp)
return; return;
- if (!t->bops) { - if (!t->bops) {
+ if (!type->bops) { + if (!type->bops) {
bp->b_ops = NULL; bp->b_ops = NULL;
bp->b_flags |= LIBXFS_B_UNCHECKED; bp->b_flags |= LIBXFS_B_UNCHECKED;
return; return;
@@ -588,7 +588,7 @@ set_iocur_type( @@ -588,7 +588,7 @@ set_iocur_type(
if (!(bp->b_flags & LIBXFS_B_UPTODATE)) if (!(bp->b_flags & LIBXFS_B_UPTODATE))
return; return;
bp->b_error = 0; bp->b_error = 0;
- bp->b_ops = t->bops; - bp->b_ops = t->bops;
+ bp->b_ops = type->bops; + bp->b_ops = type->bops;
bp->b_ops->verify_read(bp); bp->b_ops->verify_read(bp);
bp->b_flags &= ~LIBXFS_B_UNCHECKED; bp->b_flags &= ~LIBXFS_B_UNCHECKED;
} }
Index: xfsprogs-rhel7.5/db/io.h Index: xfsprogs-rhel7.5/db/io.h
=================================================================== ===================================================================
@ -144,5 +144,5 @@ Index: xfsprogs-rhel7.5/db/io.h
-extern void set_iocur_type(const struct typ *t); -extern void set_iocur_type(const struct typ *t);
+extern void set_iocur_type(const struct typ *type); +extern void set_iocur_type(const struct typ *type);
extern void xfs_dummy_verify(struct xfs_buf *bp); extern void xfs_dummy_verify(struct xfs_buf *bp);

/* /*

10
SOURCES/xfsprogs-4.12.0-xfs_db-properly-set-inode-type.patch

@ -35,8 +35,8 @@ Index: xfsprogs-rhel7.5/db/io.c
+++ xfsprogs-rhel7.5/db/io.c +++ xfsprogs-rhel7.5/db/io.c
@@ -567,6 +567,22 @@ set_iocur_type( @@ -567,6 +567,22 @@ set_iocur_type(
{ {
struct xfs_buf *bp = iocur_top->bp; struct xfs_buf *bp = iocur_top->bp;

+ /* Inodes are special; verifier checks all inodes in the chunk */ + /* Inodes are special; verifier checks all inodes in the chunk */
+ if (type->typnm == TYP_INODE) { + if (type->typnm == TYP_INODE) {
+ xfs_daddr_t b = iocur_top->bb; + xfs_daddr_t b = iocur_top->bb;
@ -53,6 +53,6 @@ Index: xfsprogs-rhel7.5/db/io.c
+ return; + return;
+ } + }
+ +
/* adjust buffer size for types with fields & hence fsize() */ /* adjust buffer size for types with fields & hence fsize() */
if (type->fields) { if (type->fields) {
int bb_count; /* type's size in basic blocks */ int bb_count; /* type's size in basic blocks */

12
SOURCES/xfsprogs-4.12.0-xfs_db-update-buffer-size-when-new-type-is-set.patch

@ -46,13 +46,13 @@ Index: xfsprogs-rhel7.5/db/io.c
#include "init.h" #include "init.h"
#include "malloc.h" #include "malloc.h"
+#include "bit.h" +#include "bit.h"

static int pop_f(int argc, char **argv); static int pop_f(int argc, char **argv);
static void pop_help(void); static void pop_help(void);
@@ -567,6 +568,13 @@ set_iocur_type( @@ -567,6 +568,13 @@ set_iocur_type(
{ {
struct xfs_buf *bp = iocur_top->bp; struct xfs_buf *bp = iocur_top->bp;

+ /* adjust buffer size for types with fields & hence fsize() */ + /* adjust buffer size for types with fields & hence fsize() */
+ if (t->fields) { + if (t->fields) {
+ int bb_count; /* type's size in basic blocks */ + int bb_count; /* type's size in basic blocks */
@ -60,6 +60,6 @@ Index: xfsprogs-rhel7.5/db/io.c
+ bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0))); + bb_count = BTOBB(byteize(fsize(t->fields, iocur_top->data, 0, 0)));
+ set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL); + set_cur(t, iocur_top->bb, bb_count, DB_RING_IGN, NULL);
+ } + }
iocur_top->typ = t; iocur_top->typ = t;

/* verify the buffer if the type has one. */ /* verify the buffer if the type has one. */

12
SOURCES/xfsprogs-4.13.0-mkfs.xfs-Don-t-stagger-AG-for-a-single-disk.patch

@ -42,13 +42,13 @@ Index: xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
--- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c --- xfsprogs-rhel7.5.orig/mkfs/xfs_mkfs.c
+++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c +++ xfsprogs-rhel7.5/mkfs/xfs_mkfs.c
@@ -2308,7 +2308,9 @@ reported by the device (%u).\n"), @@ -2308,7 +2308,9 @@ reported by the device (%u).\n"),
} }
} }
} }
- if (dswidth && ((agsize % dswidth) == 0) && (agcount > 1)) { - if (dswidth && ((agsize % dswidth) == 0) && (agcount > 1)) {
+ if (dswidth && ((agsize % dswidth) == 0) + if (dswidth && ((agsize % dswidth) == 0)
+ && (dswidth != dsunit) + && (dswidth != dsunit)
+ && (agcount > 1)) { + && (agcount > 1)) {
/* This is a non-optimal configuration because all AGs /* This is a non-optimal configuration because all AGs
* start on the same disk in the stripe. Changing * start on the same disk in the stripe. Changing
* the AG size by one sunit will guarantee that this * the AG size by one sunit will guarantee that this

10
SOURCES/xfsprogs-4.13.0-xfs_repair-don-t-use-do_warn-for-normal-log-message.patch

@ -25,10 +25,10 @@ Index: xfsprogs-4.5.0/repair/phase2.c
+++ xfsprogs-4.5.0/repair/phase2.c +++ xfsprogs-4.5.0/repair/phase2.c
@@ -85,7 +85,7 @@ zero_log( @@ -85,7 +85,7 @@ zero_log(
"attempt a repair.\n")); "attempt a repair.\n"));
} else { } else {
if (verbose) { if (verbose) {
- do_warn( - do_warn(
+ do_log( + do_log(
_("zero_log: head block %" PRId64 " tail block %" PRId64 "\n"), _("zero_log: head block %" PRId64 " tail block %" PRId64 "\n"),
head_blk, tail_blk); head_blk, tail_blk);
} }

55
SOURCES/xfsprogs-4.14.0-db-increase-metadump-s-default-overly-long-extent-di.patch

@ -0,0 +1,55 @@
From 921c30674e9bc719e7c2747deb6deb04be2adb4b Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 9 Nov 2017 11:35:22 -0600
Subject: [PATCH] db: increase metadump's default overly long extent discard
threshold

Back in 88b8e1d6d7 ("Make xfs_metadump more robust against bad data"),
metadump grew the ability to ignore a directory extent if it was longer
than 20 blocks. Presumably this was to protect metadump from dumping
absurdly long extents resulting from bmbt corruption, but it's certainly
possible to create a directory with an extent longer than 20 blocks.
Hilariously, the discards happen with no warning unless the caller
explicitly set -w.

This was raised to 1000 blocks in 7431d134fe8 ("Increase default maximum
extent size for xfs_metadump when copying..."), but it's still possible
to create a directory with an extent longer than 1000 blocks.

Increase the threshold to MAXEXTLEN blocks because it's totally valid
for the filesystem to create extents up to that length.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
db/metadump.c | 2 +-
man/man8/xfs_metadump.8 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

Index: xfsprogs-4.5.0/db/metadump.c
===================================================================
--- xfsprogs-4.5.0.orig/db/metadump.c
+++ xfsprogs-4.5.0/db/metadump.c
@@ -32,7 +32,7 @@
#include "field.h"
#include "dir2.h"
-#define DEFAULT_MAX_EXT_SIZE 1000
+#define DEFAULT_MAX_EXT_SIZE MAXEXTLEN
/*
* It's possible that multiple files in a directory (or attributes
Index: xfsprogs-4.5.0/man/man8/xfs_metadump.8
===================================================================
--- xfsprogs-4.5.0.orig/man/man8/xfs_metadump.8
+++ xfsprogs-4.5.0/man/man8/xfs_metadump.8
@@ -114,7 +114,7 @@ copied.
.B \-m
Set the maximum size of an allowed metadata extent. Extremely large metadata
extents are likely to be corrupt, and will be skipped if they exceed
-this value. The default size is 1000 blocks.
+this value. The default size is 2097151 blocks.
.TP
.B \-o
Disables obfuscation of file names and extended attributes.

35
SOURCES/xfsprogs-4.15.0-xfs_copy-accept-CRC-version-of-ABTB_MAGIC-in-ASSERT.patch

@ -0,0 +1,35 @@
From d0ca5d8a3875a423b522ee9767cbeb3d47bed420 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Thu, 25 Jan 2018 13:55:01 -0600
Subject: [PATCH] xfs_copy: accept CRC version of ABTB_MAGIC in ASSERT

Not sure how this was missed for so long, but to handle CRC
filesystems, this ASSERT on block magic must accept CRC magic
as well.

Reported-by: Radek Burkat <radek@pinkbike.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
copy/xfs_copy.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index fb37375..16ee4d9 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -1140,7 +1140,8 @@ main(int argc, char **argv)
((char *) btree_buf.data +
pos - btree_buf.position);
- ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
+ ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC ||
+ be32_to_cpu(block->bb_magic) == XFS_ABTB_CRC_MAGIC);
}
/*
--
2.9.5

37
SOURCES/xfsprogs-4.15.0-xfs_db-fix-crash-when-field-list-selector-string-has.patch

@ -0,0 +1,37 @@
From 945e47e2fcc5d1cec693122286da06d8ab829c52 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 4 Jan 2018 13:58:29 -0600
Subject: [PATCH] xfs_db: fix crash when field list selector string has
trailing slash

If I run the following command:

xfs_db /dev/sdf -x -c 'agf 0' -c 'addr refcntroot' -c 'addr ptrs[1]\'

it errors out with "bad character in field \" and
then ftok_free crashes on an invalid free() because picking up the
previous token (the closing bracket) xrealloc'd the token array to be 5
elements long but never set the last element's tok pointer.
Consequently the ftok_free tries to free whatever garbage pointer is in
that last element and kaboom.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
[sandeen: slightly clarify commit log]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
db/flist.c | 1 +
1 file changed, 1 insertion(+)

Index: xfsprogs-4.5.0/db/flist.c
===================================================================
--- xfsprogs-4.5.0.orig/db/flist.c
+++ xfsprogs-4.5.0/db/flist.c
@@ -400,6 +400,7 @@ flist_split(
strncpy(a, s, l);
a[l] = '\0';
v = xrealloc(v, (nv + 2) * sizeof(*v));
+ v[nv + 1].tok = NULL;
v[nv].tok = a;
v[nv].tokty = t;
nv++;

97
SOURCES/xfsprogs-4.15.0-xfsprogs-update-dead-urls.patch

@ -0,0 +1,97 @@
From 50663dc149619aef23bcb43e6fdf48bc60487374 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <darrick.wong@oracle.com>
Date: Thu, 25 Jan 2018 13:55:01 -0600
Subject: [PATCH] xfsprogs: update dead urls

Since oss.sgi.com is dead and xfs.org is slowly migrating to
xfs.wiki.kernel.org, update all the documentation links to point to the
current landing pads.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
README | 2 +-
debian/control | 6 +++---
debian/copyright | 2 +-
debian/watch | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)

Index: xfsprogs-4.5.0/README
===================================================================
--- xfsprogs-4.5.0.orig/README
+++ xfsprogs-4.5.0/README
@@ -9,4 +9,4 @@ and references to other XFS manual pages
For more information and details on how to contribute to the
XFS project see the web pages at:
- http://oss.sgi.com/projects/xfs/
+ https://xfs.wiki.kernel.org/
Index: xfsprogs-4.5.0/debian/control
===================================================================
--- xfsprogs-4.5.0.orig/debian/control
+++ xfsprogs-4.5.0/debian/control
@@ -24,7 +24,7 @@ Description: Utilities for managing the
Btrees (directories, extents, free space) to aid both performance
and scalability.
.
- Refer to the documentation at http://oss.sgi.com/projects/xfs/
+ Refer to the documentation at https://xfs.wiki.kernel.org/
for complete details.
Package: xfslibs-dev
Index: xfsprogs-4.5.0/debian/copyright
===================================================================
--- xfsprogs-4.5.0.orig/debian/copyright
+++ xfsprogs-4.5.0/debian/copyright
@@ -1,7 +1,7 @@
This package was debianized by Nathan Scott nathans@debian.org on
Sun, 19 Nov 2000 07:37:09 -0500.
-It can be downloaded from ftp://oss.sgi.com/projects/xfs/download/
+It can be downloaded from https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/
Copyright:
Index: xfsprogs-4.5.0/debian/watch
===================================================================
--- xfsprogs-4.5.0.orig/debian/watch
+++ xfsprogs-4.5.0/debian/watch
@@ -1,3 +1,3 @@
version=3
opts=uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \
-ftp://oss.sgi.com/projects/xfs/cmd_tars/xfsprogs-(.+)\.tar\.gz
+https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/xfsprogs-(.+)\.tar\.xz
Index: xfsprogs-4.5.0/libxfs/util.c
===================================================================
--- xfsprogs-4.5.0.orig/libxfs/util.c
+++ xfsprogs-4.5.0/libxfs/util.c
@@ -690,7 +690,7 @@ libxfs_fs_repair_cmn_err(int level, xfs_
fprintf(stderr, " This is a bug.\n");
fprintf(stderr, "%s version %s\n", progname, VERSION);
fprintf(stderr, "Please capture the filesystem metadata with "
- "xfs_metadump and\nreport it to xfs@oss.sgi.com.\n");
+ "xfs_metadump and\nreport it to linux-xfs@vger.kernel.org.\n");
va_end(ap);
}
Index: xfsprogs-4.5.0/man/man8/xfs_mdrestore.8
===================================================================
--- xfsprogs-4.5.0.orig/man/man8/xfs_mdrestore.8
+++ xfsprogs-4.5.0/man/man8/xfs_mdrestore.8
@@ -51,4 +51,4 @@ returns an exit code of 0 if all the met
.BR xfs (5)
.SH BUGS
Email bug reports to
-.BR xfs@oss.sgi.com .
+.BR linux-xfs@vger.kernel.org .
Index: xfsprogs-4.5.0/man/man8/xfs_metadump.8
===================================================================
--- xfsprogs-4.5.0.orig/man/man8/xfs_metadump.8
+++ xfsprogs-4.5.0/man/man8/xfs_metadump.8
@@ -154,4 +154,4 @@ command.
.BR xfs (5)
.SH BUGS
Email bug reports to
-.BR xfs@oss.sgi.com .
+.BR linux-xfs@vger.kernel.org .

16
SOURCES/xfsprogs-4.16-xfs_repair-handle-corrupt-log.patch

@ -12,17 +12,17 @@ Index: xfsprogs-4.5.0/repair/phase2.c
--- xfsprogs-4.5.0.orig/repair/phase2.c --- xfsprogs-4.5.0.orig/repair/phase2.c
+++ xfsprogs-4.5.0/repair/phase2.c +++ xfsprogs-4.5.0/repair/phase2.c
@@ -78,12 +78,13 @@ zero_log( @@ -78,12 +78,13 @@ zero_log(
do_warn( do_warn(
_("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"), _("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"),
error); error);
- if (!no_modify && !zap_log) - if (!no_modify && !zap_log)
+ if (!no_modify && !zap_log) { + if (!no_modify && !zap_log) {
do_warn(_( do_warn(_(
"ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n" "ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n"
"filesystem to replay the log or use the -L option to destroy the log and\n" "filesystem to replay the log or use the -L option to destroy the log and\n"
"attempt a repair.\n")); "attempt a repair.\n"));
exit(2); exit(2);
+ } + }
} else { } else {
if (verbose) { if (verbose) {
do_log( do_log(

194
SOURCES/xfsprogs-4.17.0-xfs_io-add-label-command.patch

@ -0,0 +1,194 @@
From cfa10b0f972005b38ed294bca66cebf2f65298ec Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Thu, 24 May 2018 14:48:33 -0500
Subject: [PATCH] xfs_io: add label command

This adds an online get/set/clear label command to xfs_io.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
io/Makefile | 6 +--
io/init.c | 1 +
io/io.h | 1 +
io/label.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
man/man8/xfs_io.8 | 13 +++++++
5 files changed, 126 insertions(+), 3 deletions(-)
create mode 100644 io/label.c

Index: xfsprogs-4.5.0/io/Makefile
===================================================================
--- xfsprogs-4.5.0.orig/io/Makefile
+++ xfsprogs-4.5.0/io/Makefile
@@ -9,7 +9,7 @@ LTCOMMAND = xfs_io
LSRCFILES = xfs_bmap.sh xfs_freeze.sh xfs_mkfile.sh
HFILES = init.h io.h
CFILES = init.c \
- attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c link.c \
+ attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c label.c link.c \
mmap.c open.c parent.c pread.c prealloc.c pwrite.c seek.c shutdown.c \
sync.c truncate.c reflink.c
Index: xfsprogs-4.5.0/io/init.c
===================================================================
--- xfsprogs-4.5.0.orig/io/init.c
+++ xfsprogs-4.5.0/io/init.c
@@ -65,6 +65,7 @@ init_commands(void)
help_init();
imap_init();
inject_init();
+ label_init();
seek_init();
madvise_init();
mincore_init();
Index: xfsprogs-4.5.0/io/io.h
===================================================================
--- xfsprogs-4.5.0.orig/io/io.h
+++ xfsprogs-4.5.0/io/io.h
@@ -102,6 +102,7 @@ extern void getrusage_init(void);
extern void help_init(void);
extern void imap_init(void);
extern void inject_init(void);
+extern void label_init(void);
extern void mmap_init(void);
extern void open_init(void);
extern void parent_init(void);
Index: xfsprogs-4.5.0/io/label.c
===================================================================
--- /dev/null
+++ xfsprogs-4.5.0/io/label.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2018 Red Hat, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+#include "platform_defs.h"
+#include "libxfs.h"
+#include "path.h"
+#include "command.h"
+#include "init.h"
+#include "io.h"
+
+#ifndef FS_IOC_GETFSLABEL
+/* Max chars for the interface; fs limits may differ */
+#define FSLABEL_MAX 256
+#define FS_IOC_GETFSLABEL _IOR(0x94, 49, char[FSLABEL_MAX])
+#define FS_IOC_SETFSLABEL _IOW(0x94, 50, char[FSLABEL_MAX])
+#endif
+
+static cmdinfo_t label_cmd;
+
+static void
+label_help(void)
+{
+ printf(_(
+"\n"
+" Manipulate or query the filesystem label while mounted.\n"
+"\n"
+" With no arguments, displays the current filesystem label.\n"
+" -s newlabel -- set the filesystem label to newlabel\n"
+" -c -- clear the filesystem label (sets to NULL string)\n"
+"\n"));
+}
+
+static int
+label_f(
+ int argc,
+ char **argv)
+{
+ int c;
+ int error;
+ char label[FSLABEL_MAX];
+
+ if (argc == 1) {
+ memset(label, 0, sizeof(label));
+ error = ioctl(file->fd, FS_IOC_GETFSLABEL, &label);
+ goto out;
+ }
+
+ while ((c = getopt(argc, argv, "cs:")) != EOF) {
+ switch (c) {
+ case 'c':
+ label[0] = '\0';
+ break;
+ case 's':
+ strncpy(label, optarg, sizeof(label));
+ break;
+ default:
+ return command_usage(&label_cmd);
+ }
+ }
+
+ /* Check for trailing arguments */
+ if (argc != optind)
+ return command_usage(&label_cmd);
+
+ error = ioctl(file->fd, FS_IOC_SETFSLABEL, label);
+out:
+ if (error) {
+ perror("label");
+ exitcode = 1;
+ } else {
+ printf("label = \"%s\"\n", label);
+ }
+
+ return 0;
+}
+
+void
+label_init(void)
+{
+ label_cmd.name = "label";
+ label_cmd.cfunc = label_f;
+ label_cmd.argmin = 0;
+ label_cmd.argmax = 3;
+ label_cmd.args = _("[-s label|-c]");
+ label_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+ label_cmd.oneline =
+ _("query, set, or clear the filesystem label while mounted");
+ label_cmd.help = label_help;
+
+ add_command(&label_cmd);
+}
Index: xfsprogs-4.5.0/man/man8/xfs_io.8
===================================================================
--- xfsprogs-4.5.0.orig/man/man8/xfs_io.8
+++ xfsprogs-4.5.0/man/man8/xfs_io.8
@@ -812,7 +812,19 @@ verbose output will be printed.
.IP
.B [NOTE: Not currently operational on Linux.]
.PD
-
+.TP
+.BI "label" " " "[ -c | -s " label " ] "
+On filesystems that support online label manipulation, get, set, or clear the
+filesystem label. With no options, print the current filesystem label. The
+.B \-c
+option clears the filesystem label by setting it to the null string. The
+.BI "\-s " label
+option sets the filesystem label to
+.IR label .
+If the label is longer than the filesystem will accept,
+.B xfs_io
+will print an error message. XFS filesystem labels can be at most 12
+characters long.
.SH SEE ALSO
.BR mkfs.xfs (8),
.BR xfsctl (3),

64
SOURCES/xfsprogs-4.17.0-xfsprogs-be-careful-about-what-we-stat-in-platform_c.patch

@ -0,0 +1,64 @@
From 98c4a01c21b99b13d8aaa406ab15b7424ee5ef9f Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Wed, 23 May 2018 16:30:49 -0500
Subject: [PATCH] xfsprogs: be careful about what we stat in
platform_check_mount

After we lost ustat(2) in commit 4e7a824, we ended up with a slightly
bonkers method to determine if our target block device was mounted:
it goes through every entry returned by getmntent and stats the dir
to see if its underlying device matches ours.

Unfortunately that dir might be a hung nfs server and sadness ensues.

So just do a really simple sanity check before we try to stat the
mountpoint: does its device start with a / ? If not, skip it.

Fixes: 4e7a824 ("libxfs/linux.c: Replace use of ustat by stat")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
libfrog/linux.c | 10 ++++++++++
1 file changed, 10 insertions(+)

Index: xfsprogs-4.5.0/libxfs/linux.c
===================================================================
--- xfsprogs-4.5.0.orig/libxfs/linux.c
+++ xfsprogs-4.5.0/libxfs/linux.c
@@ -68,7 +68,17 @@ platform_check_ismounted(char *name, cha
progname, name);
return 1;
}
+ /*
+ * This whole business is to work out if our block device is mounted
+ * after we lost ustat(2), see:
+ * 4e7a824 libxfs/linux.c: Replace use of ustat by stat
+ * We don't really want to stat every single mounted directory,
+ * as that may include tmpfs, cgroups, procfs or - worst - hung nfs
+ * servers. So first, a simple check: does the "dev" start with "/" ?
+ */
while ((mnt = getmntent(f)) != NULL) {
+ if (mnt->mnt_fsname[0] != '/')
+ continue;
if (stat64(mnt->mnt_dir, &mst) < 0)
continue;
if (mst.st_dev != s->st_rdev)
@@ -99,7 +109,17 @@ platform_check_iswritable(char *name, ch
"mounted filesystem\n"), progname, name);
return fatal;
}
+ /*
+ * This whole business is to work out if our block device is mounted
+ * after we lost ustat(2), see:
+ * 4e7a824 libxfs/linux.c: Replace use of ustat by stat
+ * We don't really want to stat every single mounted directory,
+ * as that may include tmpfs, cgroups, procfs or - worst - hung nfs
+ * servers. So first, a simple check: does the "dev" start with "/" ?
+ */
while ((mnt = getmntent(f)) != NULL) {
+ if (mnt->mnt_fsname[0] != '/')
+ continue;
if (stat64(mnt->mnt_fsname, &mst) < 0)
continue;
if ((mst.st_mode & S_IFMT) != S_IFBLK)

51
SOURCES/xfsprogs-4.18-repair-root-parent.patch

@ -0,0 +1,51 @@
xfs_repair: Fix root inode's parent when it's bogus for sf directory

Currently when root inode is in short-form and its parent ino
has an invalid value, process_sf_dir2() ends up not fixing it,
because if verify_inum() fails we never get to the next case which
would fix the root inode's parent pointer.

This behavior triggers the following assert on process_dir2():

ASSERT((ino != mp->m_sb.sb_rootino && ino != *parent) ||
(ino == mp->m_sb.sb_rootino &&
(ino == *parent || need_root_dotdot == 1)));

This patch fixes this behavior by making sure we always properly
handle rootino parent pointer in process_sf_dir2()

Signed-off-by: Marco Benatto <mbenatto@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>

---

Note: reviewed but not yet merged upstream

repair/dir2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/repair/dir2.c b/repair/dir2.c
index e162d2b..225f926 100644
--- a/repair/dir2.c
+++ b/repair/dir2.c
@@ -495,8 +495,10 @@ _("corrected entry offsets in directory %" PRIu64 "\n"),
/*
* if parent entry is bogus, null it out. we'll fix it later .
+ * If the validation fails for the root inode we fix it in
+ * the next else case.
*/
- if (verify_inum(mp, *parent)) {
+ if (verify_inum(mp, *parent) && ino != mp->m_sb.sb_rootino) {
do_warn(
_("bogus .. inode number (%" PRIu64 ") in directory inode %" PRIu64 ", "),
--
2.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html


50
SOURCES/xfsprogs-4.5.0-change-mkfs-options.patch

@ -20,7 +20,7 @@ Index: xfsprogs-4.5.0/man/man8/mkfs.xfs.8
.B \-m crc=0 .B \-m crc=0
is used, the free inode btree feature is not supported and is disabled. is used, the free inode btree feature is not supported and is disabled.
.TP .TP
@@ -419,21 +420,8 @@ If the value is omitted, 1 is assumed. @@ -419,21 +420,8 @@ If the value is omitted, 1 is assumed.
in release version 3.2.0.) in release version 3.2.0.)
.TP .TP
.BI sparse[= value ] .BI sparse[= value ]
@ -49,45 +49,45 @@ Index: xfsprogs-4.5.0/mkfs/xfs_mkfs.c
--- xfsprogs-4.5.0.orig/mkfs/xfs_mkfs.c --- xfsprogs-4.5.0.orig/mkfs/xfs_mkfs.c
+++ xfsprogs-4.5.0/mkfs/xfs_mkfs.c +++ xfsprogs-4.5.0/mkfs/xfs_mkfs.c
@@ -105,8 +105,6 @@ char *iopts[] = { @@ -105,8 +105,6 @@ char *iopts[] = {
"attr", "attr",
#define I_PROJID32BIT 6 #define I_PROJID32BIT 6
"projid32bit", "projid32bit",
-#define I_SPINODES 7 -#define I_SPINODES 7
- "sparse", - "sparse",
NULL NULL
}; };

@@ -1019,7 +1017,7 @@ main( @@ -1019,7 +1017,7 @@ main(
worst_freelist = 0; worst_freelist = 0;
lazy_sb_counters = 1; lazy_sb_counters = 1;
crcs_enabled = 1; crcs_enabled = 1;
- finobt = 1; - finobt = 1;
+ finobt = 0; + finobt = 0;
finobtflag = false; finobtflag = false;
spinodes = 0; spinodes = 0;
memset(&fsx, 0, sizeof(fsx)); memset(&fsx, 0, sizeof(fsx));
@@ -1343,6 +1341,7 @@ main( @@ -1343,6 +1341,7 @@ main(
illegal(value, "i projid32bit"); illegal(value, "i projid32bit");
projid16bit = c ? 0 : 1; projid16bit = c ? 0 : 1;
break; break;
+#if 0 +#if 0
case I_SPINODES: case I_SPINODES:
if (!value || *value == '\0') if (!value || *value == '\0')
value = "1"; value = "1";
@@ -1350,6 +1349,7 @@ main( @@ -1350,6 +1349,7 @@ main(
if (spinodes < 0 || spinodes > 1) if (spinodes < 0 || spinodes > 1)
illegal(value, "i spinodes"); illegal(value, "i spinodes");
break; break;
+#endif +#endif
default: default:
unknown('i', value); unknown('i', value);
} }
@@ -3213,7 +3213,7 @@ usage( void ) @@ -3213,7 +3213,7 @@ usage( void )
sectlog=n|sectsize=num\n\ sectlog=n|sectsize=num\n\
/* force overwrite */ [-f]\n\ /* force overwrite */ [-f]\n\
/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,\n\ /* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,\n\
- projid32bit=0|1,sparse=0|1]\n\ - projid32bit=0|1,sparse=0|1]\n\
+ projid32bit=0|1]\n\ + projid32bit=0|1]\n\
/* no discard */ [-K]\n\ /* no discard */ [-K]\n\
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n\ /* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n\
sunit=value|su=num,sectlog=n|sectsize=num,\n\ sunit=value|su=num,sectlog=n|sectsize=num,\n\

6
SOURCES/xfsprogs-4.5.0-fix-headers.patch

@ -25,7 +25,7 @@ index b9622ba..1f17e1c 100644
@@ -542,12 +542,8 @@ typedef struct xfs_swapext @@ -542,12 +542,8 @@ typedef struct xfs_swapext
#define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection) #define XFS_IOC_ERROR_CLEARALL _IOW ('X', 117, struct xfs_error_injection)
/* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */ /* XFS_IOC_ATTRCTL_BY_HANDLE -- deprecated 118 */

-/* XFS_IOC_FREEZE -- FIFREEZE 119 */ -/* XFS_IOC_FREEZE -- FIFREEZE 119 */
-/* XFS_IOC_THAW -- FITHAW 120 */ -/* XFS_IOC_THAW -- FITHAW 120 */
-#ifndef FIFREEZE -#ifndef FIFREEZE
@ -34,7 +34,7 @@ index b9622ba..1f17e1c 100644
-#endif -#endif
+#define XFS_IOC_FREEZE _IOWR('X', 119, int) /* aka FIFREEZE */ +#define XFS_IOC_FREEZE _IOWR('X', 119, int) /* aka FIFREEZE */
+#define XFS_IOC_THAW _IOWR('X', 120, int) /* aka FITHAW */ +#define XFS_IOC_THAW _IOWR('X', 120, int) /* aka FITHAW */

#define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq) #define XFS_IOC_FSSETDM_BY_HANDLE _IOW ('X', 121, struct xfs_fsop_setdm_handlereq)
#define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq) #define XFS_IOC_ATTRLIST_BY_HANDLE _IOW ('X', 122, struct xfs_fsop_attrlist_handlereq)


@ -47,6 +47,6 @@ index cc0f70c..0c616f4 100644
#include <asm/types.h> #include <asm/types.h>
#include <mntent.h> #include <mntent.h>
+#include <linux/fs.h> /* fsxattr defintion for new kernels */ +#include <linux/fs.h> /* fsxattr defintion for new kernels */

static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p) static __inline__ int xfsctl(const char *path, int fd, int cmd, void *p)
{ {

9
SOURCES/xfsprogs-4.5.0-revert-AGFL-pack.patch

@ -2,10 +2,11 @@ reverted:
--- b/libxfs/xfs_format.h --- b/libxfs/xfs_format.h
+++ a/libxfs/xfs_format.h +++ a/libxfs/xfs_format.h
@@ -787,7 +787,7 @@ @@ -787,7 +787,7 @@
__be64 agfl_lsn; __be64 agfl_lsn;
__be32 agfl_crc; __be32 agfl_crc;
__be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */ __be32 agfl_bno[]; /* actually XFS_AGFL_SIZE(mp) */
+} xfs_agfl_t; +} xfs_agfl_t;
-} __attribute__((packed)) xfs_agfl_t; -} __attribute__((packed)) xfs_agfl_t;

#define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc) #define XFS_AGFL_CRC_OFF offsetof(struct xfs_agfl, agfl_crc)

102
SOURCES/xfsprogs-4.5.0-revert-xfs_db-sparse-inodes.patch

@ -3,13 +3,13 @@ Author: Brian Foster <bfoster@redhat.com>
Date: Tue Jun 21 12:58:57 2016 +1000 Date: Tue Jun 21 12:58:57 2016 +1000


xfs_db: Revert "xfs_db: make check work for sparse inodes" xfs_db: Revert "xfs_db: make check work for sparse inodes"

This reverts commit bb2f98b78f20f4abbfbbd442162d9f535c84888a which This reverts commit bb2f98b78f20f4abbfbbd442162d9f535c84888a which
introduced support for multi-record inode chunks in introduced support for multi-record inode chunks in
xfs_db/xfs_check. However, it doesn't currently handle filesystems xfs_db/xfs_check. However, it doesn't currently handle filesystems
with multi-record inode chunks correctly. For example, do the with multi-record inode chunks correctly. For example, do the
following on a 64k page size arch such as ppc64: following on a 64k page size arch such as ppc64:

# mkfs.xfs -f -b size=64k <dev> # mkfs.xfs -f -b size=64k <dev>
# xfs_db -c check <dev> # xfs_db -c check <dev>
bad magic number 0 for inode 1152 bad magic number 0 for inode 1152
@ -19,15 +19,15 @@ Date: Tue Jun 21 12:58:57 2016 +1000
bad magic number 0 for inode 1156 bad magic number 0 for inode 1156
bad magic number 0 for inode 1157 bad magic number 0 for inode 1157
... ...

This boils down to a regression in the inode record processing code This boils down to a regression in the inode record processing code
(scanfunc_ino()) in db/check.c. Specifically, the cblocks value can (scanfunc_ino()) in db/check.c. Specifically, the cblocks value can
end up being zero after it is shifted by mp->m_sb.sb_inopblog (i.e., end up being zero after it is shifted by mp->m_sb.sb_inopblog (i.e.,
64 >> 7 == 0 for an -isize=512 -bsize=64k fs). 64 >> 7 == 0 for an -isize=512 -bsize=64k fs).

Fixing this problem is easier to do from scratch, so revert the Fixing this problem is easier to do from scratch, so revert the
oringial commit first. oringial commit first.

Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -37,9 +37,9 @@ index 0871ed7..750ecc1 100644
--- a/db/check.c --- a/db/check.c
+++ b/db/check.c +++ b/db/check.c
@@ -4311,51 +4311,6 @@ scanfunc_cnt( @@ -4311,51 +4311,6 @@ scanfunc_cnt(
scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_cnt, TYP_CNTBT); scan_sbtree(agf, be32_to_cpu(pp[i]), level, 0, scanfunc_cnt, TYP_CNTBT);
} }

-static bool -static bool
-ino_issparse( -ino_issparse(
- struct xfs_inobt_rec *rp, - struct xfs_inobt_rec *rp,
@ -87,11 +87,11 @@ index 0871ed7..750ecc1 100644
- -
static void static void
scanfunc_ino( scanfunc_ino(
struct xfs_btree_block *block, struct xfs_btree_block *block,
@@ -4373,13 +4328,6 @@ scanfunc_ino( @@ -4373,13 +4328,6 @@ scanfunc_ino(
int off; int off;
xfs_inobt_ptr_t *pp; xfs_inobt_ptr_t *pp;
xfs_inobt_rec_t *rp; xfs_inobt_rec_t *rp;
- bool sparse, crc; - bool sparse, crc;
- int inodes_per_chunk; - int inodes_per_chunk;
- int freecount; - int freecount;
@ -99,21 +99,21 @@ index 0871ed7..750ecc1 100644
- __u16 holemask; - __u16 holemask;
- xfs_agino_t rino; - xfs_agino_t rino;
- xfs_extlen_t cblocks; - xfs_extlen_t cblocks;

if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC && if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_IBT_CRC_MAGIC) { be32_to_cpu(block->bb_magic) != XFS_IBT_CRC_MAGIC) {
@@ -4407,111 +4355,59 @@ scanfunc_ino( @@ -4407,111 +4355,59 @@ scanfunc_ino(
return; return;
} }
rp = XFS_INOBT_REC_ADDR(mp, block, 1); rp = XFS_INOBT_REC_ADDR(mp, block, 1);
- sparse = xfs_sb_version_hassparseinodes(&mp->m_sb); - sparse = xfs_sb_version_hassparseinodes(&mp->m_sb);
- crc = xfs_sb_version_hascrc(&mp->m_sb); - crc = xfs_sb_version_hascrc(&mp->m_sb);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) { for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
- nfree = 0; - nfree = 0;
- -
- /* First let's look at the inode chunk alignment */ - /* First let's look at the inode chunk alignment */
agino = be32_to_cpu(rp[i].ir_startino); agino = be32_to_cpu(rp[i].ir_startino);
off = XFS_INO_TO_OFFSET(mp, agino); off = XFS_INO_TO_OFFSET(mp, agino);
- if (off == 0 && - if (off == 0 &&
- (sbversion & XFS_SB_VERSION_ALIGNBIT) && - (sbversion & XFS_SB_VERSION_ALIGNBIT) &&
- mp->m_sb.sb_inoalignmt && - mp->m_sb.sb_inoalignmt &&
@ -131,13 +131,13 @@ index 0871ed7..750ecc1 100644
+ mp->m_sb.sb_inoalignmt && + mp->m_sb.sb_inoalignmt &&
+ (XFS_INO_TO_AGBNO(mp, agino) % + (XFS_INO_TO_AGBNO(mp, agino) %
+ mp->m_sb.sb_inoalignmt)) + mp->m_sb.sb_inoalignmt))
sbversion &= ~XFS_SB_VERSION_ALIGNBIT; sbversion &= ~XFS_SB_VERSION_ALIGNBIT;
+ set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino), + set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino),
+ (xfs_extlen_t)MAX(1, + (xfs_extlen_t)MAX(1,
+ XFS_INODES_PER_CHUNK >> + XFS_INODES_PER_CHUNK >>
+ mp->m_sb.sb_inopblog), + mp->m_sb.sb_inopblog),
+ DBM_INODE, seqno, bno); + DBM_INODE, seqno, bno);
} }
- -
- /* Move on to examining the inode chunks */ - /* Move on to examining the inode chunks */
- if (sparse) { - if (sparse) {
@ -178,7 +178,7 @@ index 0871ed7..750ecc1 100644
+ if (iocur_top->data == NULL) { + if (iocur_top->data == NULL) {
+ if (!sflag) + if (!sflag)
+ dbprintf(_("can't read inode block " + dbprintf(_("can't read inode block "
"%u/%u\n"), "%u/%u\n"),
- seqno, rino, seqno, bno); - seqno, rino, seqno, bno);
- error++; - error++;
- } - }
@ -218,7 +218,7 @@ index 0871ed7..750ecc1 100644
+ seqno, + seqno,
+ XFS_AGINO_TO_AGBNO(mp, agino)); + XFS_AGINO_TO_AGBNO(mp, agino));
+ error++; + error++;
pop_cur(); pop_cur();
- -
- startidx = find_zero_ino_bit(holemask, endidx); - startidx = find_zero_ino_bit(holemask, endidx);
- endidx = find_one_ino_bit(holemask, startidx); - endidx = find_one_ino_bit(holemask, startidx);
@ -240,41 +240,41 @@ index 0871ed7..750ecc1 100644
+ isfree); + isfree);
+ } + }
+ if (nfree != be32_to_cpu(rp[i].ir_u.f.ir_freecount)) { + if (nfree != be32_to_cpu(rp[i].ir_u.f.ir_freecount)) {
if (!sflag) if (!sflag)
dbprintf(_("ir_freecount/free mismatch, " dbprintf(_("ir_freecount/free mismatch, "
"inode chunk %u/%u, freecount " "inode chunk %u/%u, freecount "
"%d nfree %d\n"), "%d nfree %d\n"),
seqno, agino, seqno, agino,
- freecount, nfree); - freecount, nfree);
+ be32_to_cpu(rp[i].ir_u.f.ir_freecount), nfree); + be32_to_cpu(rp[i].ir_u.f.ir_freecount), nfree);
error++; error++;
} }
+ pop_cur(); + pop_cur();
} }
return; return;
} }
@@ -4543,11 +4439,6 @@ scanfunc_fino( @@ -4543,11 +4439,6 @@ scanfunc_fino(
int off; int off;
xfs_inobt_ptr_t *pp; xfs_inobt_ptr_t *pp;
struct xfs_inobt_rec *rp; struct xfs_inobt_rec *rp;
- bool sparse, crc; - bool sparse, crc;
- int startidx, endidx; - int startidx, endidx;
- __u16 holemask; - __u16 holemask;
- xfs_agino_t rino; - xfs_agino_t rino;
- xfs_extlen_t cblocks; - xfs_extlen_t cblocks;

if (be32_to_cpu(block->bb_magic) != XFS_FIBT_MAGIC && if (be32_to_cpu(block->bb_magic) != XFS_FIBT_MAGIC &&
be32_to_cpu(block->bb_magic) != XFS_FIBT_CRC_MAGIC) { be32_to_cpu(block->bb_magic) != XFS_FIBT_CRC_MAGIC) {
@@ -4575,63 +4466,21 @@ scanfunc_fino( @@ -4575,63 +4466,21 @@ scanfunc_fino(
return; return;
} }
rp = XFS_INOBT_REC_ADDR(mp, block, 1); rp = XFS_INOBT_REC_ADDR(mp, block, 1);
- sparse = xfs_sb_version_hassparseinodes(&mp->m_sb); - sparse = xfs_sb_version_hassparseinodes(&mp->m_sb);
- crc = xfs_sb_version_hascrc(&mp->m_sb); - crc = xfs_sb_version_hascrc(&mp->m_sb);
for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) { for (i = 0; i < be16_to_cpu(block->bb_numrecs); i++) {
- /* First let's look at the inode chunk alignment */ - /* First let's look at the inode chunk alignment */
agino = be32_to_cpu(rp[i].ir_startino); agino = be32_to_cpu(rp[i].ir_startino);
off = XFS_INO_TO_OFFSET(mp, agino); off = XFS_INO_TO_OFFSET(mp, agino);
- if (off == 0 && - if (off == 0 &&
- (sbversion & XFS_SB_VERSION_ALIGNBIT) && - (sbversion & XFS_SB_VERSION_ALIGNBIT) &&
- mp->m_sb.sb_inoalignmt && - mp->m_sb.sb_inoalignmt &&
@ -292,13 +292,13 @@ index 0871ed7..750ecc1 100644
+ mp->m_sb.sb_inoalignmt && + mp->m_sb.sb_inoalignmt &&
+ (XFS_INO_TO_AGBNO(mp, agino) % + (XFS_INO_TO_AGBNO(mp, agino) %
+ mp->m_sb.sb_inoalignmt)) + mp->m_sb.sb_inoalignmt))
sbversion &= ~XFS_SB_VERSION_ALIGNBIT; sbversion &= ~XFS_SB_VERSION_ALIGNBIT;
+ check_set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino), + check_set_dbmap(seqno, XFS_AGINO_TO_AGBNO(mp, agino),
+ (xfs_extlen_t)MAX(1, + (xfs_extlen_t)MAX(1,
+ XFS_INODES_PER_CHUNK >> + XFS_INODES_PER_CHUNK >>
+ mp->m_sb.sb_inopblog), + mp->m_sb.sb_inopblog),
+ DBM_INODE, DBM_INODE, seqno, bno); + DBM_INODE, DBM_INODE, seqno, bno);
} }
- -
- /* Move on to examining the inode chunks */ - /* Move on to examining the inode chunks */
- if (sparse) { - if (sparse) {
@ -336,6 +336,6 @@ index 0871ed7..750ecc1 100644
- startidx = find_zero_ino_bit(holemask, endidx); - startidx = find_zero_ino_bit(holemask, endidx);
- endidx = find_one_ino_bit(holemask, startidx); - endidx = find_one_ino_bit(holemask, startidx);
- } while (endidx < XFS_INODES_PER_CHUNK); - } while (endidx < XFS_INODES_PER_CHUNK);
} }
return; return;
} }

30
SOURCES/xfsprogs-4.5.0-xfs_repair-exit-value-memory.patch

@ -28,29 +28,31 @@ index 9d91f2d..bbf0edc 100644
--- a/repair/xfs_repair.c --- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c +++ b/repair/xfs_repair.c
@@ -851,16 +851,16 @@ main(int argc, char **argv) @@ -851,16 +851,16 @@ main(int argc, char **argv)
"with the -m option. Please increase it to at least %lu.\n"), "with the -m option. Please increase it to at least %lu.\n"),
mem_used / 1024); mem_used / 1024);
} }
- do_warn( - do_warn(
+ do_log( + do_log(
_("Memory available for repair (%luMB) may not be sufficient.\n" _("Memory available for repair (%luMB) may not be sufficient.\n"
"At least %luMB is needed to repair this filesystem efficiently\n" "At least %luMB is needed to repair this filesystem efficiently\n"
"If repair fails due to lack of memory, please\n"), "If repair fails due to lack of memory, please\n"),
max_mem / 1024, mem_used / 1024); max_mem / 1024, mem_used / 1024);
if (do_prefetch) if (do_prefetch)
- do_warn( - do_warn(
+ do_log( + do_log(
_("turn prefetching off (-P) to reduce the memory footprint.\n")); _("turn prefetching off (-P) to reduce the memory footprint.\n"));
else else
- do_warn( - do_warn(
+ do_log( + do_log(
_("increase system RAM and/or swap space to at least %luMB.\n"), _("increase system RAM and/or swap space to at least %luMB.\n"),
mem_used * 2 / 1024); mem_used * 2 / 1024);

-- --
2.5.5 2.5.5


_______________________________________________ _______________________________________________
xfs mailing list xfs mailing list
xfs@oss.sgi.com xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs http://oss.sgi.com/mailman/listinfo/xfs



60
SOURCES/xfsprogs-4.5.0-xfs_repair-quota-inodes.patch

@ -36,58 +36,60 @@ index 45db6ae..44f3e3e 100644
--- a/libxfs/xfs_sb.c --- a/libxfs/xfs_sb.c
+++ b/libxfs/xfs_sb.c +++ b/libxfs/xfs_sb.c
@@ -316,13 +316,16 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp) @@ -316,13 +316,16 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)
XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD; XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD;
sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD); sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD);

- if (sbp->sb_qflags & XFS_PQUOTA_ACCT) { - if (sbp->sb_qflags & XFS_PQUOTA_ACCT) {
+ if (sbp->sb_qflags & XFS_PQUOTA_ACCT && + if (sbp->sb_qflags & XFS_PQUOTA_ACCT &&
+ sbp->sb_gquotino != NULLFSINO) { + sbp->sb_gquotino != NULLFSINO) {
/* /*
* In older version of superblock, on-disk superblock only * In older version of superblock, on-disk superblock only
* has sb_gquotino, and in-core superblock has both sb_gquotino * has sb_gquotino, and in-core superblock has both sb_gquotino
* and sb_pquotino. But, only one of them is supported at any * and sb_pquotino. But, only one of them is supported at any
* point of time. So, if PQUOTA is set in disk superblock, * point of time. So, if PQUOTA is set in disk superblock,
- * copy over sb_gquotino to sb_pquotino. - * copy over sb_gquotino to sb_pquotino.
+ * copy over sb_gquotino to sb_pquotino. The NULLFSINO test + * copy over sb_gquotino to sb_pquotino. The NULLFSINO test
+ * above is to make sure we don't do this twice and wipe them + * above is to make sure we don't do this twice and wipe them
+ * both out! + * both out!
*/ */
sbp->sb_pquotino = sbp->sb_gquotino; sbp->sb_pquotino = sbp->sb_gquotino;
sbp->sb_gquotino = NULLFSINO; sbp->sb_gquotino = NULLFSINO;
diff --git a/repair/sb.c b/repair/sb.c diff --git a/repair/sb.c b/repair/sb.c
index 3965953..8087242 100644 index 3965953..8087242 100644
--- a/repair/sb.c --- a/repair/sb.c
+++ b/repair/sb.c +++ b/repair/sb.c
@@ -155,7 +155,6 @@ __find_secondary_sb( @@ -155,7 +155,6 @@ __find_secondary_sb(
for (i = 0; !done && i < bsize; i += BBSIZE) { for (i = 0; !done && i < bsize; i += BBSIZE) {
c_bufsb = (char *)sb + i; c_bufsb = (char *)sb + i;
libxfs_sb_from_disk(&bufsb, (xfs_dsb_t *)c_bufsb); libxfs_sb_from_disk(&bufsb, (xfs_dsb_t *)c_bufsb);
- libxfs_sb_quota_from_disk(&bufsb); - libxfs_sb_quota_from_disk(&bufsb);

if (verify_sb(c_bufsb, &bufsb, 0) != XR_OK) if (verify_sb(c_bufsb, &bufsb, 0) != XR_OK)
continue; continue;
@@ -568,7 +567,6 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno) @@ -568,7 +567,6 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno)
do_error("%s\n", strerror(error)); do_error("%s\n", strerror(error));
} }
libxfs_sb_from_disk(sbp, buf); libxfs_sb_from_disk(sbp, buf);
- libxfs_sb_quota_from_disk(sbp); - libxfs_sb_quota_from_disk(sbp);

rval = verify_sb((char *)buf, sbp, agno == 0); rval = verify_sb((char *)buf, sbp, agno == 0);
free(buf); free(buf);
diff --git a/repair/scan.c b/repair/scan.c diff --git a/repair/scan.c b/repair/scan.c
index 964ff06..366ce16 100644 index 964ff06..366ce16 100644
--- a/repair/scan.c --- a/repair/scan.c
+++ b/repair/scan.c +++ b/repair/scan.c
@@ -1622,7 +1622,6 @@ scan_ag( @@ -1622,7 +1622,6 @@ scan_ag(
goto out_free_sb; goto out_free_sb;
} }
libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf)); libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf));
- libxfs_sb_quota_from_disk(sb); - libxfs_sb_quota_from_disk(sb);

agfbuf = libxfs_readbuf(mp->m_dev, agfbuf = libxfs_readbuf(mp->m_dev,
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)), XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),


_______________________________________________ _______________________________________________
xfs mailing list xfs mailing list
xfs@oss.sgi.com xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs http://oss.sgi.com/mailman/listinfo/xfs



36
SOURCES/xfsprogs-4.5.0-xfs_repair-rtino-version.patch

@ -3,27 +3,27 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Tue Jun 21 12:55:15 2016 +1000 Date: Tue Jun 21 12:55:15 2016 +1000


xfs_repair: set rsumino version to 2 xfs_repair: set rsumino version to 2

If we run xfs/033 with "-m crc=0", the test fails with a repair If we run xfs/033 with "-m crc=0", the test fails with a repair
output difference: output difference:

Phase 7 - verify and correct link counts... Phase 7 - verify and correct link counts...
+resetting inode INO nlinks from 0 to 1 +resetting inode INO nlinks from 0 to 1
done done

This is because when we zero out the realtime summary inode and This is because when we zero out the realtime summary inode and
rebuild it, we set its version to 1, then set its ip->i_d.di_nlink rebuild it, we set its version to 1, then set its ip->i_d.di_nlink
to 1. This is a little odd, because v1 inodes store their link to 1. This is a little odd, because v1 inodes store their link
count in di_onlink... count in di_onlink...

Then, later in repair we call xfs_inode_from_disk(), which sees the Then, later in repair we call xfs_inode_from_disk(), which sees the
version one inode, and converts it to version 2 in part by copying version one inode, and converts it to version 2 in part by copying
di_onlink to di_nlink. But we never *set* di_onlink, so di_nlink di_onlink to di_nlink. But we never *set* di_onlink, so di_nlink
gets reset to zero, and this error is discovered later in repair. gets reset to zero, and this error is discovered later in repair.

Interestingly, mk_rbmino() was changed in 138659f1 to set version 2; Interestingly, mk_rbmino() was changed in 138659f1 to set version 2;
it looks like mk_rsumino was just missed. it looks like mk_rsumino was just missed.

Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -33,20 +33,20 @@ Index: xfsprogs-4.5.0/repair/phase6.c
--- xfsprogs-4.5.0.orig/repair/phase6.c --- xfsprogs-4.5.0.orig/repair/phase6.c
+++ xfsprogs-4.5.0/repair/phase6.c +++ xfsprogs-4.5.0/repair/phase6.c
@@ -507,7 +507,7 @@ mk_rbmino(xfs_mount_t *mp) @@ -507,7 +507,7 @@ mk_rbmino(xfs_mount_t *mp)
error); error);
} }

- vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 1; - vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 1;
+ vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2; + vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2;
memset(&ip->i_d, 0, xfs_icdinode_size(vers)); memset(&ip->i_d, 0, xfs_icdinode_size(vers));

ip->i_d.di_magic = XFS_DINODE_MAGIC; ip->i_d.di_magic = XFS_DINODE_MAGIC;
@@ -766,7 +766,7 @@ mk_rsumino(xfs_mount_t *mp) @@ -766,7 +766,7 @@ mk_rsumino(xfs_mount_t *mp)
error); error);
} }

- vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 1; - vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 1;
+ vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2; + vers = xfs_sb_version_hascrc(&mp->m_sb) ? 3 : 2;
memset(&ip->i_d, 0, xfs_icdinode_size(vers)); memset(&ip->i_d, 0, xfs_icdinode_size(vers));

ip->i_d.di_magic = XFS_DINODE_MAGIC; ip->i_d.di_magic = XFS_DINODE_MAGIC;

15
SOURCES/xfsprogs-4.7.0-defang-frag.patch

@ -3,16 +3,16 @@ Author: Eric Sandeen <sandeen@sandeen.net>
Date: Mon May 30 10:35:56 2016 +1000 Date: Mon May 30 10:35:56 2016 +1000


xfs_db: defang frag command xfs_db: defang frag command

Too many people freak out about this fictitious "fragmentation Too many people freak out about this fictitious "fragmentation
factor." As shown in the fact, it is largely meaningless, because factor." As shown in the fact, it is largely meaningless, because
the number approaches 100% extremely quickly for just a few the number approaches 100% extremely quickly for just a few
extents per file. extents per file.

I thought about removing it altogether, but perhaps a note I thought about removing it altogether, but perhaps a note
about its uselessness, and a more soothing metric (avg extents about its uselessness, and a more soothing metric (avg extents
per file) might be useful. per file) might be useful.

Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -22,12 +22,13 @@ Index: xfsprogs-4.5.0/db/frag.c
--- xfsprogs-4.5.0.orig/db/frag.c --- xfsprogs-4.5.0.orig/db/frag.c
+++ xfsprogs-4.5.0/db/frag.c +++ xfsprogs-4.5.0/db/frag.c
@@ -172,6 +172,10 @@ frag_f( @@ -172,6 +172,10 @@ frag_f(
answer = 0.0; answer = 0.0;
dbprintf(_("actual %llu, ideal %llu, fragmentation factor %.2f%%\n"), dbprintf(_("actual %llu, ideal %llu, fragmentation factor %.2f%%\n"),
extcount_actual, extcount_ideal, answer); extcount_actual, extcount_ideal, answer);
+ dbprintf(_("Note, this number is largely meaningless.\n")); + dbprintf(_("Note, this number is largely meaningless.\n"));
+ answer = (double)extcount_actual / (double)extcount_ideal; + answer = (double)extcount_actual / (double)extcount_ideal;
+ dbprintf(_("Files on this filesystem average %.2f extents per file\n"), + dbprintf(_("Files on this filesystem average %.2f extents per file\n"),
+ answer); + answer);
return 0; return 0;
} }

34
SOURCES/xfsprogs-4.7.0-fix-agf-limit-errors.patch

@ -3,16 +3,16 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Tue May 10 17:16:06 2016 +1000 Date: Tue May 10 17:16:06 2016 +1000


xfs_repair: fix agf limit error messages xfs_repair: fix agf limit error messages

Today we see errors like: Today we see errors like:

"fllast 118 in agf 94 too large (max = 118)" "fllast 118 in agf 94 too large (max = 118)"

which makes no sense. which makes no sense.

If we are erroring on X >= Y, Y is clearly not the maximum allowable If we are erroring on X >= Y, Y is clearly not the maximum allowable
value. value.

Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -22,20 +22,20 @@ Index: xfsprogs-4.5.0/repair/agheader.c
--- xfsprogs-4.5.0.orig/repair/agheader.c --- xfsprogs-4.5.0.orig/repair/agheader.c
+++ xfsprogs-4.5.0/repair/agheader.c +++ xfsprogs-4.5.0/repair/agheader.c
@@ -94,7 +94,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_ @@ -94,7 +94,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_
if (be32_to_cpu(agf->agf_flfirst) >= XFS_AGFL_SIZE(mp)) { if (be32_to_cpu(agf->agf_flfirst) >= XFS_AGFL_SIZE(mp)) {
do_warn(_("flfirst %d in agf %d too large (max = %zu)\n"), do_warn(_("flfirst %d in agf %d too large (max = %zu)\n"),
be32_to_cpu(agf->agf_flfirst), be32_to_cpu(agf->agf_flfirst),
- i, XFS_AGFL_SIZE(mp)); - i, XFS_AGFL_SIZE(mp));
+ i, XFS_AGFL_SIZE(mp) - 1); + i, XFS_AGFL_SIZE(mp) - 1);
if (!no_modify) if (!no_modify)
agf->agf_flfirst = cpu_to_be32(0); agf->agf_flfirst = cpu_to_be32(0);
} }
@@ -102,7 +102,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_ @@ -102,7 +102,7 @@ verify_set_agf(xfs_mount_t *mp, xfs_agf_
if (be32_to_cpu(agf->agf_fllast) >= XFS_AGFL_SIZE(mp)) { if (be32_to_cpu(agf->agf_fllast) >= XFS_AGFL_SIZE(mp)) {
do_warn(_("fllast %d in agf %d too large (max = %zu)\n"), do_warn(_("fllast %d in agf %d too large (max = %zu)\n"),
be32_to_cpu(agf->agf_fllast), be32_to_cpu(agf->agf_fllast),
- i, XFS_AGFL_SIZE(mp)); - i, XFS_AGFL_SIZE(mp));
+ i, XFS_AGFL_SIZE(mp) - 1); + i, XFS_AGFL_SIZE(mp) - 1);
if (!no_modify) if (!no_modify)
agf->agf_fllast = cpu_to_be32(0); agf->agf_fllast = cpu_to_be32(0);
} }

168
SOURCES/xfsprogs-4.7.0-quota-fixes.patch

@ -3,16 +3,16 @@ Author: Zorro Lang <zlang@redhat.com>
Date: Thu Aug 4 11:29:49 2016 +1000 Date: Thu Aug 4 11:29:49 2016 +1000


xfs_quota: fall back silently if XFS_GETNEXTQUOTA fails xfs_quota: fall back silently if XFS_GETNEXTQUOTA fails

After XFS_GETNEXTQUOTA feature has been merged into linux kernel and After XFS_GETNEXTQUOTA feature has been merged into linux kernel and
xfsprogs, xfs_quota use Q_XGETNEXTQUOTA for report and dump, and xfsprogs, xfs_quota use Q_XGETNEXTQUOTA for report and dump, and
fall back to old XFS_GETQUOTA ioctl if XFS_GETNEXTQUOTA fails. fall back to old XFS_GETQUOTA ioctl if XFS_GETNEXTQUOTA fails.

But when XFS_GETNEXTQUOTA fails, xfs_quota print a warning as But when XFS_GETNEXTQUOTA fails, xfs_quota print a warning as
"XFS_GETQUOTA: Invalid argument". That's due to kernel can't "XFS_GETQUOTA: Invalid argument". That's due to kernel can't
recognize XFS_GETNEXTQUOTA ioctl and return EINVAL. At this time, recognize XFS_GETNEXTQUOTA ioctl and return EINVAL. At this time,
the warning is helpless, xfs_quota just need to fall back. the warning is helpless, xfs_quota just need to fall back.

Signed-off-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -22,31 +22,31 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Fri Jun 3 11:04:15 2016 +1000 Date: Fri Jun 3 11:04:15 2016 +1000


xfs_quota: only round up timer reporting > 1 day xfs_quota: only round up timer reporting > 1 day

I was too hasty with: I was too hasty with:

d1fe6ff xfs_quota: remove extra 30 seconds from time limit reporting d1fe6ff xfs_quota: remove extra 30 seconds from time limit reporting

The point of that extra 30s, turns out, was to allow the user The point of that extra 30s, turns out, was to allow the user
to set a limit, query it, and get back what they just set, if to set a limit, query it, and get back what they just set, if
it is set to more than a day. it is set to more than a day.

Without it, if we set a grace period to i.e. 3 days, and query it Without it, if we set a grace period to i.e. 3 days, and query it
1 second later, the rounding in the time_to_string function returns 1 second later, the rounding in the time_to_string function returns
"2 days" not "3 days" as it did before, because we are at "2 days" not "3 days" as it did before, because we are at
2 days 23:59:59 and it essentially applies a floor() for 2 days 23:59:59 and it essentially applies a floor() for
brevity. I guess this was confusing. brevity. I guess this was confusing.

(I've run into this same conundrum on my stove digital timer; (I've run into this same conundrum on my stove digital timer;
if you set it to 10m, it blinks "10" at you twice so that you if you set it to 10m, it blinks "10" at you twice so that you
know what you set, then quickly flips to 9 as it counts down). know what you set, then quickly flips to 9 as it counts down).

In some cases, however (and this is the case that prompted the In some cases, however (and this is the case that prompted the
prior patch), we display a full "XYZ days hh:mm:ss" - we do this prior patch), we display a full "XYZ days hh:mm:ss" - we do this
if the verbose flag is set, or if the timer is less than one day. if the verbose flag is set, or if the timer is less than one day.
In these cases, we should not add the 30s, because we are showing In these cases, we should not add the 30s, because we are showing
full time resolution to the user. full time resolution to the user.

Reported-by: Zorro Lang <zlang@redhat.com> Reported-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com>
@ -58,17 +58,17 @@ Author: Eric Sandeen <sandeen@sandeen.net>
Date: Mon May 30 12:21:31 2016 +1000 Date: Mon May 30 12:21:31 2016 +1000


xfs_quota: check report_mount return value xfs_quota: check report_mount return value

The new call to report_mount doesn't check the return value The new call to report_mount doesn't check the return value
like every other caller does... like every other caller does...

Returning 1 means it printed something; if the terse flag Returning 1 means it printed something; if the terse flag
is used and there is no usage, nothing gets printed. is used and there is no usage, nothing gets printed.
If we set the NO_HEADER_FLAG anyway, then we won't see If we set the NO_HEADER_FLAG anyway, then we won't see
the header for subsequent entries as we expect. the header for subsequent entries as we expect.

For example, project ID 0 has no usage in this case: For example, project ID 0 has no usage in this case:

# xfs_quota -x -c "report -a" /mnt/test # xfs_quota -x -c "report -a" /mnt/test
Project quota on /mnt/test (/dev/sdb1) Project quota on /mnt/test (/dev/sdb1)
Blocks Blocks
@ -76,22 +76,22 @@ Date: Mon May 30 12:21:31 2016 +1000
---------- -------------------------------------------------- ---------- --------------------------------------------------
#0 0 0 0 00 [--------] #0 0 0 0 00 [--------]
project 2048 4 4 00 [--none--] project 2048 4 4 00 [--none--]

So using the terse flag results in no header when it prints So using the terse flag results in no header when it prints
projects with usage: projects with usage:

# xfs_quota -x -c "report -t -a" /mnt/test # xfs_quota -x -c "report -t -a" /mnt/test
project 2048 4 4 00 [--none--] project 2048 4 4 00 [--none--]

With this fix it prints the header as expected: With this fix it prints the header as expected:

# xfs_quota -x -c "report -t -a" /mnt/test # xfs_quota -x -c "report -t -a" /mnt/test
Project quota on /mnt/test (/dev/sdb1) Project quota on /mnt/test (/dev/sdb1)
Blocks Blocks
Project ID Used Soft Hard Warn/Grace Project ID Used Soft Hard Warn/Grace
---------- -------------------------------------------------- ---------- --------------------------------------------------
project 2048 4 4 00 [--none--] project 2048 4 4 00 [--none--]

Addresses-Coverity-Id: 1361552 Addresses-Coverity-Id: 1361552
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com>
@ -103,19 +103,19 @@ Author: Zorro Lang <zlang@redhat.com>
Date: Tue May 10 17:16:06 2016 +1000 Date: Tue May 10 17:16:06 2016 +1000


xfs_quota: print quota id number if the name can't be found xfs_quota: print quota id number if the name can't be found

When use GETNEXTQUOTA ioctl to report project quota, it always When use GETNEXTQUOTA ioctl to report project quota, it always
report an unexpected quota: report an unexpected quota:

(null) 0 0 0 00 [--------] (null) 0 0 0 00 [--------]

The ID 0 store the default quota, even if no one set default quota, The ID 0 store the default quota, even if no one set default quota,
it still have quota accounting, but not enforced. So GETNEXTQUOTA it still have quota accounting, but not enforced. So GETNEXTQUOTA
can find and report this undefined quota. can find and report this undefined quota.

From this problem, I thought if others' quota name miss, (null) will From this problem, I thought if others' quota name miss, (null) will
be printed too. e.g. be printed too. e.g.

# xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt # xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt
# xfs_quota -xc "report -u" $mnt # xfs_quota -xc "report -u" $mnt
User ID Used Soft Hard Warn/Grace User ID Used Soft Hard Warn/Grace
@ -128,15 +128,15 @@ Date: Tue May 10 17:16:06 2016 +1000
---------- -------------------------------------------------- ---------- --------------------------------------------------
root 0 0 0 00 [--------] root 0 0 0 00 [--------]
(null) 0 307200 409600 00 [--------] (null) 0 307200 409600 00 [--------]

So this problem same with above id 0's problem. To deal with this, So this problem same with above id 0's problem. To deal with this,
this patch will print id number if the name can't be found. this patch will print id number if the name can't be found.

However, if we use the old GETQUOTA ioctl, it won't print project id However, if we use the old GETQUOTA ioctl, it won't print project id
0 quota information if it's not defined. That's different with 0 quota information if it's not defined. That's different with
GETNEXTQUOTA. For keep consistent, this patch also print project id GETNEXTQUOTA. For keep consistent, this patch also print project id
0 when use old GETQUOTA. 0 when use old GETQUOTA.

Signed-off-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de>
@ -147,23 +147,23 @@ Author: Zorro Lang <zlang@redhat.com>
Date: Tue May 10 17:16:06 2016 +1000 Date: Tue May 10 17:16:06 2016 +1000


xfs_quota: fully support users and groups beginning with digits xfs_quota: fully support users and groups beginning with digits

A normal user or group name allow beginning with digits, but xfs_quota A normal user or group name allow beginning with digits, but xfs_quota
can't create a limit for that user or group. The reason is 'strtoul' can't create a limit for that user or group. The reason is 'strtoul'
function only translate digits at the beginning, it will ignore function only translate digits at the beginning, it will ignore
letters after digits. letters after digits.

There's a commit fd537fc50eeade63bbd2a66105f39d04a011a7f5, it try to There's a commit fd537fc50eeade63bbd2a66105f39d04a011a7f5, it try to
fix "xfsprogs: xfs_quota allow user or group names beginning with fix "xfsprogs: xfs_quota allow user or group names beginning with
digits". But it doesn't effect 'limit' command, so a command likes: digits". But it doesn't effect 'limit' command, so a command likes:

xfs_quota 'limit .... 12345678-user' xxxx xfs_quota 'limit .... 12345678-user' xxxx

will try to create limit for username="12345678", not "12345678-user". will try to create limit for username="12345678", not "12345678-user".

This patch will fix this problem, and a test case xfs/138 in xfstests This patch will fix this problem, and a test case xfs/138 in xfstests
is used to reproduce this bug. is used to reproduce this bug.

Signed-off-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -173,16 +173,16 @@ Author: Eric Sandeen <sandeen@sandeen.net>
Date: Wed Feb 17 17:03:02 2016 +1100 Date: Wed Feb 17 17:03:02 2016 +1100


xfs: wire up Q_XGETNEXTQUOTA / get_nextdqblk xfs: wire up Q_XGETNEXTQUOTA / get_nextdqblk

Source kernel commit 296c24e26ee3af2dbfecb482e6bc9560bd34c455 Source kernel commit 296c24e26ee3af2dbfecb482e6bc9560bd34c455

Add code to allow the Q_XGETNEXTQUOTA quotactl to quickly find Add code to allow the Q_XGETNEXTQUOTA quotactl to quickly find
all active quotas by examining the quota inode, and skipping all active quotas by examining the quota inode, and skipping
over unallocated or uninitialized regions. over unallocated or uninitialized regions.

Userspace can then use this interface rather than i.e. a Userspace can then use this interface rather than i.e. a
getpwent() loop when asked to report all active quotas. getpwent() loop when asked to report all active quotas.

Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -191,46 +191,46 @@ Index: xfsprogs-4.5.0/quota/report.c
--- xfsprogs-4.5.0.orig/quota/report.c --- xfsprogs-4.5.0.orig/quota/report.c
+++ xfsprogs-4.5.0/quota/report.c +++ xfsprogs-4.5.0/quota/report.c
@@ -90,8 +90,10 @@ dump_file( @@ -90,8 +90,10 @@ dump_file(
else else
cmd = XFS_GETQUOTA; cmd = XFS_GETQUOTA;

+ /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA */ + /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA */
if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) { if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) {
- if (errno != ENOENT && errno != ENOSYS && errno != ESRCH) - if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
+ if (errno != ENOENT && errno != ENOSYS && errno != ESRCH && + if (errno != ENOENT && errno != ENOSYS && errno != ESRCH &&
+ cmd == XFS_GETQUOTA) + cmd == XFS_GETQUOTA)
perror("XFS_GETQUOTA"); perror("XFS_GETQUOTA");
return 0; return 0;
} }
@@ -347,8 +349,10 @@ report_mount( @@ -347,8 +349,10 @@ report_mount(
else else
cmd = XFS_GETQUOTA; cmd = XFS_GETQUOTA;

+ /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA*/ + /* Fall back silently if XFS_GETNEXTQUOTA fails, warn on XFS_GETQUOTA*/
if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) { if (xfsquotactl(cmd, dev, type, id, (void *)&d) < 0) {
- if (errno != ENOENT && errno != ENOSYS && errno != ESRCH) - if (errno != ENOENT && errno != ENOSYS && errno != ESRCH)
+ if (errno != ENOENT && errno != ENOSYS && errno != ESRCH && + if (errno != ENOENT && errno != ENOSYS && errno != ESRCH &&
+ cmd == XFS_GETQUOTA) + cmd == XFS_GETQUOTA)
perror("XFS_GETQUOTA"); perror("XFS_GETQUOTA");
return 0; return 0;
} }
@@ -389,7 +393,11 @@ report_mount( @@ -389,7 +393,11 @@ report_mount(
name = p->pr_name; name = p->pr_name;
} }
} }
- fprintf(fp, "%-10s", name); - fprintf(fp, "%-10s", name);
+ /* If no name is found, print the id #num instead of (null) */ + /* If no name is found, print the id #num instead of (null) */
+ if (name != NULL) + if (name != NULL)
+ fprintf(fp, "%-10s", name); + fprintf(fp, "%-10s", name);
+ else + else
+ fprintf(fp, "#%-9u", d.d_id); + fprintf(fp, "#%-9u", d.d_id);
} }

if (form & XFS_BLOCK_QUOTA) { if (form & XFS_BLOCK_QUOTA) {
@@ -571,6 +579,16 @@ report_project_mount( @@ -571,6 +579,16 @@ report_project_mount(
id = oid + 1; id = oid + 1;
} }
} else { } else {
+ if (!getprprid(0)) { + if (!getprprid(0)) {
+ /* + /*
+ * Print default project quota, even if projid 0 + * Print default project quota, even if projid 0
@ -241,17 +241,17 @@ Index: xfsprogs-4.5.0/quota/report.c
+ flags |= NO_HEADER_FLAG; + flags |= NO_HEADER_FLAG;
+ } + }
+ +
setprent(); setprent();
while ((p = getprent()) != NULL) { while ((p = getprent()) != NULL) {
if (report_mount(fp, p->pr_prid, p->pr_name, NULL, if (report_mount(fp, p->pr_prid, p->pr_name, NULL,
Index: xfsprogs-4.5.0/quota/util.c Index: xfsprogs-4.5.0/quota/util.c
=================================================================== ===================================================================
--- xfsprogs-4.5.0.orig/quota/util.c --- xfsprogs-4.5.0.orig/quota/util.c
+++ xfsprogs-4.5.0/quota/util.c +++ xfsprogs-4.5.0/quota/util.c
@@ -43,6 +43,18 @@ time_to_string( @@ -43,6 +43,18 @@ time_to_string(
timer = MAX(origin - now, 0); timer = MAX(origin - now, 0);
} }

+ /* + /*
+ * If we are in verbose mode, or if less than a day remains, we + * If we are in verbose mode, or if less than a day remains, we
+ * will show "X days hh:mm:ss" so the user knows the exact timer status. + * will show "X days hh:mm:ss" so the user knows the exact timer status.
@ -264,9 +264,9 @@ Index: xfsprogs-4.5.0/quota/util.c
+ if ((timer > SECONDS_IN_A_DAY) && !(flags & VERBOSE_FLAG)) + if ((timer > SECONDS_IN_A_DAY) && !(flags & VERBOSE_FLAG))
+ timer += 30; /* seconds */ + timer += 30; /* seconds */
+ +
days = timer / SECONDS_IN_A_DAY; days = timer / SECONDS_IN_A_DAY;
if (days) if (days)
timer %= SECONDS_IN_A_DAY; timer %= SECONDS_IN_A_DAY;
Index: xfsprogs-4.5.0/man/man8/xfs_quota.8 Index: xfsprogs-4.5.0/man/man8/xfs_quota.8
=================================================================== ===================================================================
--- xfsprogs-4.5.0.orig/man/man8/xfs_quota.8 --- xfsprogs-4.5.0.orig/man/man8/xfs_quota.8
@ -287,23 +287,23 @@ Index: xfsprogs-4.5.0/libxcmd/input.c
--- xfsprogs-4.5.0.orig/libxcmd/input.c --- xfsprogs-4.5.0.orig/libxcmd/input.c
+++ xfsprogs-4.5.0/libxcmd/input.c +++ xfsprogs-4.5.0/libxcmd/input.c
@@ -366,7 +366,7 @@ uid_from_string( @@ -366,7 +366,7 @@ uid_from_string(
char *sp; char *sp;

uid_long = strtoul(user, &sp, 10); uid_long = strtoul(user, &sp, 10);
- if (sp != user) { - if (sp != user) {
+ if (sp != user && *sp == '\0') { + if (sp != user && *sp == '\0') {
if ((uid_long == ULONG_MAX && errno == ERANGE) if ((uid_long == ULONG_MAX && errno == ERANGE)
|| (uid_long > (uid_t)-1)) || (uid_long > (uid_t)-1))
return -1; return -1;
@@ -387,7 +387,7 @@ gid_from_string( @@ -387,7 +387,7 @@ gid_from_string(
char *sp; char *sp;

gid_long = strtoul(group, &sp, 10); gid_long = strtoul(group, &sp, 10);
- if (sp != group) { - if (sp != group) {
+ if (sp != group && *sp == '\0') { + if (sp != group && *sp == '\0') {
if ((gid_long == ULONG_MAX && errno == ERANGE) if ((gid_long == ULONG_MAX && errno == ERANGE)
|| (gid_long > (gid_t)-1)) || (gid_long > (gid_t)-1))
return -1; return -1;
Index: xfsprogs-4.5.0/libxfs/xfs_quota_defs.h Index: xfsprogs-4.5.0/libxfs/xfs_quota_defs.h
=================================================================== ===================================================================
--- xfsprogs-4.5.0.orig/libxfs/xfs_quota_defs.h --- xfsprogs-4.5.0.orig/libxfs/xfs_quota_defs.h
@ -314,14 +314,14 @@ Index: xfsprogs-4.5.0/libxfs/xfs_quota_defs.h
#define XFS_DQ_DIRTY 0x0008 /* dquot is dirty */ #define XFS_DQ_DIRTY 0x0008 /* dquot is dirty */
-#define XFS_DQ_FREEING 0x0010 /* dquot is beeing torn down */ -#define XFS_DQ_FREEING 0x0010 /* dquot is beeing torn down */
+#define XFS_DQ_FREEING 0x0010 /* dquot is being torn down */ +#define XFS_DQ_FREEING 0x0010 /* dquot is being torn down */

#define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP)

@@ -116,6 +116,7 @@ typedef __uint16_t xfs_qwarncnt_t; @@ -116,6 +116,7 @@ typedef __uint16_t xfs_qwarncnt_t;
#define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */
#define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */
#define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */ #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */
+#define XFS_QMOPT_DQNEXT 0x0008000 /* return next dquot >= this ID */ +#define XFS_QMOPT_DQNEXT 0x0008000 /* return next dquot >= this ID */

/* /*
* flags to xfs_trans_mod_dquot to indicate which field needs to be * flags to xfs_trans_mod_dquot to indicate which field needs to be

4
SOURCES/xfsprogs-4.8.0-mkfs.xfs-clarify-ftype-defaults-in-manpage.patch

@ -21,14 +21,14 @@ Index: xfsprogs-rhel7.5/man/man8/mkfs.xfs.8
--- xfsprogs-rhel7.5.orig/man/man8/mkfs.xfs.8 --- xfsprogs-rhel7.5.orig/man/man8/mkfs.xfs.8
+++ xfsprogs-rhel7.5/man/man8/mkfs.xfs.8 +++ xfsprogs-rhel7.5/man/man8/mkfs.xfs.8
@@ -587,13 +587,11 @@ do not need to look up the inode to dete @@ -587,13 +587,11 @@ do not need to look up the inode to dete

The The
.I value .I value
-is either 0 or 1, with 1 signifiying that filetype information -is either 0 or 1, with 1 signifiying that filetype information
-will be stored in the directory structure. The default value is 0. -will be stored in the directory structure. The default value is 0.
+is either 0 or 1, with 1 signifying that filetype information +is either 0 or 1, with 1 signifying that filetype information
+will be stored in the directory structure. The default value is 1. +will be stored in the directory structure. The default value is 1.

-When CRCs are enabled via -When CRCs are enabled via
-.B \-m crc=1, -.B \-m crc=1,
-the ftype functionality is always enabled. This feature can not be turned -the ftype functionality is always enabled. This feature can not be turned

32
SOURCES/xfsprogs-4.8.0-replace-ustat.patch

@ -3,13 +3,13 @@ Author: Felix Janda <felix.janda@posteo.de>
Date: Thu Sep 8 10:22:28 2016 +1000 Date: Thu Sep 8 10:22:28 2016 +1000


libxfs/linux.c: Replace use of ustat by stat libxfs/linux.c: Replace use of ustat by stat

ustat has been used to check whether a device file is mounted. ustat has been used to check whether a device file is mounted.
The function is deprecated and not supported by uclibc and musl. The function is deprecated and not supported by uclibc and musl.
Now do the check using the *mntent functions. Now do the check using the *mntent functions.

Based on patch by Natanael Copa <ncopa@alpinelinux.org>. Based on patch by Natanael Copa <ncopa@alpinelinux.org>.

Signed-off-by: Felix Janda <felix.janda@posteo.de> Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -21,7 +21,7 @@ index c9f2baf..44bc1f9 100644
@@ -16,11 +16,8 @@ @@ -16,11 +16,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */

-#define ustat __kernel_ustat -#define ustat __kernel_ustat
#include <mntent.h> #include <mntent.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -41,13 +41,13 @@ index c9f2baf..44bc1f9 100644
+ struct stat64 st, mst; + struct stat64 st, mst;
+ struct mntent *mnt; + struct mntent *mnt;
+ char mounts[MAXPATHLEN]; + char mounts[MAXPATHLEN];

if (!s) { if (!s) {
if (stat64(block, &st) < 0) if (stat64(block, &st) < 0)
@@ -63,14 +61,27 @@ platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose) @@ -63,14 +61,27 @@ platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
s = &st; s = &st;
} }

- if (ustat(s->st_rdev, ust) >= 0) { - if (ustat(s->st_rdev, ust) >= 0) {
+ strcpy(mounts, (!access(PROC_MOUNTED, R_OK)) ? PROC_MOUNTED : MOUNTED); + strcpy(mounts, (!access(PROC_MOUNTED, R_OK)) ? PROC_MOUNTED : MOUNTED);
+ if ((f = setmntent(mounts, "r")) == NULL) { + if ((f = setmntent(mounts, "r")) == NULL) {
@ -62,16 +62,16 @@ index c9f2baf..44bc1f9 100644
+ if (mst.st_dev != s->st_rdev) + if (mst.st_dev != s->st_rdev)
+ continue; + continue;
+ +
if (verbose) if (verbose)
fprintf(stderr, fprintf(stderr,
_("%s: %s contains a mounted filesystem\n"), _("%s: %s contains a mounted filesystem\n"),
progname, name); progname, name);
- return 1; - return 1;
+ break; + break;
} }
- return 0; - return 0;
+ endmntent(f); + endmntent(f);
+ return mnt != NULL; + return mnt != NULL;
} }

int int

42
SOURCES/xfsprogs-4.8.0-xfs_copy-UUID.patch

@ -3,32 +3,32 @@ Author: Eric Sandeen <sandeen@redhat.com>
Date: Fri Sep 23 09:16:52 2016 +1000 Date: Fri Sep 23 09:16:52 2016 +1000


xfs_copy: Fix meta UUID handling on multiple copies xfs_copy: Fix meta UUID handling on multiple copies

Zorro reported that when making multiple copies of a V5 Zorro reported that when making multiple copies of a V5
filesystem with xfs_copy while generating new UUIDs, all filesystem with xfs_copy while generating new UUIDs, all
but the first copy were corrupt. but the first copy were corrupt.

Upon inspection, the corruption was related to incorrect UUIDs; Upon inspection, the corruption was related to incorrect UUIDs;
the original UUID, as stamped into every metadata structure, the original UUID, as stamped into every metadata structure,
was not preserved in the sb_meta_uuid field of the superblock was not preserved in the sb_meta_uuid field of the superblock
on any but the first copy. on any but the first copy.

This happened because sb_update_uuid was using the UUID present in This happened because sb_update_uuid was using the UUID present in
the ag_hdr structure as the unchanging meta-uuid which is to match the ag_hdr structure as the unchanging meta-uuid which is to match
existing structures, but it also /updates/ that UUID with the existing structures, but it also /updates/ that UUID with the
new identifying UUID present in tcarg. So the newly-generated new identifying UUID present in tcarg. So the newly-generated
UUIDs moved transitively from tcarg->uuid to ag_hdr->xfs_sb->sb_uuid UUIDs moved transitively from tcarg->uuid to ag_hdr->xfs_sb->sb_uuid
to ag_hdr->xfs_sb->sb_meta_uuid each time the function got called. to ag_hdr->xfs_sb->sb_meta_uuid each time the function got called.

Fix this by looking instead to the unchanging, original UUID Fix this by looking instead to the unchanging, original UUID
present in the xfs_sb_t we are given, which reflects the original present in the xfs_sb_t we are given, which reflects the original
filesystem's metadata UUID, and copy /that/ UUID into each target filesystem's metadata UUID, and copy /that/ UUID into each target
filesystem's meta_uuid field. filesystem's meta_uuid field.

Most of this patch is changing comments and re-ordering tests Most of this patch is changing comments and re-ordering tests
to match; the functional change is to simply use the *sb rather to match; the functional change is to simply use the *sb rather
than the *ag_hdr to identify the proper metadata UUID. than the *ag_hdr to identify the proper metadata UUID.

Reported-and-tested-by: Zorro Lang <zlang@redhat.com> Reported-and-tested-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
@ -39,7 +39,7 @@ index 3c8998c..22ded6b 100644
--- a/copy/xfs_copy.c --- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c +++ b/copy/xfs_copy.c
@@ -494,27 +494,29 @@ write_wbuf(void) @@ -494,27 +494,29 @@ write_wbuf(void)

void void
sb_update_uuid( sb_update_uuid(
- xfs_sb_t *sb, - xfs_sb_t *sb,
@ -49,8 +49,8 @@ index 3c8998c..22ded6b 100644
+ ag_header_t *ag_hdr, /* AG hdr to update for this copy */ + ag_header_t *ag_hdr, /* AG hdr to update for this copy */
+ thread_args *tcarg) /* Args for this thread, with UUID */ + thread_args *tcarg) /* Args for this thread, with UUID */
{ {
/* /*
* If this filesystem has CRCs, the original UUID is stamped into * If this filesystem has CRCs, the original UUID is stamped into
- * all metadata. If we are changing the UUID in the copy, we need - * all metadata. If we are changing the UUID in the copy, we need
- * to copy the original UUID into the meta_uuid slot and set the - * to copy the original UUID into the meta_uuid slot and set the
- * set the incompat flag if that hasn't already been done. - * set the incompat flag if that hasn't already been done.
@ -58,22 +58,22 @@ index 3c8998c..22ded6b 100644
+ * the original filesystem and we are changing the UUID in this copy, + * the original filesystem and we are changing the UUID in this copy,
+ * we must copy the original sb_uuid to the sb_meta_uuid slot and set + * we must copy the original sb_uuid to the sb_meta_uuid slot and set
+ * the incompat flag for the feature on this copy. + * the incompat flag for the feature on this copy.
*/ */
- if (!uuid_equal(&tcarg->uuid, &ag_hdr->xfs_sb->sb_uuid) && - if (!uuid_equal(&tcarg->uuid, &ag_hdr->xfs_sb->sb_uuid) &&
- xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb)) { - xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb)) {
+ if (xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb) && + if (xfs_sb_version_hascrc(sb) && !xfs_sb_version_hasmetauuid(sb) &&
+ !uuid_equal(&tcarg->uuid, &sb->sb_uuid)) { + !uuid_equal(&tcarg->uuid, &sb->sb_uuid)) {
__be32 feat; __be32 feat;

feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat); feat = be32_to_cpu(ag_hdr->xfs_sb->sb_features_incompat);
feat |= XFS_SB_FEAT_INCOMPAT_META_UUID; feat |= XFS_SB_FEAT_INCOMPAT_META_UUID;
ag_hdr->xfs_sb->sb_features_incompat = cpu_to_be32(feat); ag_hdr->xfs_sb->sb_features_incompat = cpu_to_be32(feat);
platform_uuid_copy(&ag_hdr->xfs_sb->sb_meta_uuid, platform_uuid_copy(&ag_hdr->xfs_sb->sb_meta_uuid,
- &ag_hdr->xfs_sb->sb_uuid); - &ag_hdr->xfs_sb->sb_uuid);
+ &sb->sb_uuid); + &sb->sb_uuid);
} }

+ /* Copy the (possibly new) fs-identifier UUID into sb_uuid */ + /* Copy the (possibly new) fs-identifier UUID into sb_uuid */
platform_uuid_copy(&ag_hdr->xfs_sb->sb_uuid, &tcarg->uuid); platform_uuid_copy(&ag_hdr->xfs_sb->sb_uuid, &tcarg->uuid);

/* We may have changed the UUID, so update the superblock CRC */ /* We may have changed the UUID, so update the superblock CRC */

12
SOURCES/xfsprogs-4.8.0-xfs_repair-exit-with-status-2-if-log-dirtiness-is-un.patch

@ -21,15 +21,15 @@ Index: xfsprogs-4.5.0/repair/phase2.c
--- xfsprogs-4.5.0.orig/repair/phase2.c --- xfsprogs-4.5.0.orig/repair/phase2.c
+++ xfsprogs-4.5.0/repair/phase2.c +++ xfsprogs-4.5.0/repair/phase2.c
@@ -79,10 +79,11 @@ zero_log( @@ -79,10 +79,11 @@ zero_log(
_("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"), _("zero_log: cannot find log head/tail (xlog_find_tail=%d)\n"),
error); error);
if (!no_modify && !zap_log) if (!no_modify && !zap_log)
- do_error(_( - do_error(_(
+ do_warn(_( + do_warn(_(
"ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n" "ERROR: The log head and/or tail cannot be discovered. Attempt to mount the\n"
"filesystem to replay the log or use the -L option to destroy the log and\n" "filesystem to replay the log or use the -L option to destroy the log and\n"
"attempt a repair.\n")); "attempt a repair.\n"));
+ exit(2); + exit(2);
} else { } else {
if (verbose) { if (verbose) {
do_log( do_log(

35
SOURCES/xfsprogs-4.9-xfs_io-fix-m-option.patch

@ -3,11 +3,11 @@ Author: Andreas Gruenbacher <agruenba@redhat.com>
Date: Tue Nov 1 10:38:40 2016 +1100 Date: Tue Nov 1 10:38:40 2016 +1100


xfs_io: Fix initial -m option xfs_io: Fix initial -m option

Like "open -m mode", the initial -m option requires a mode argument. Like "open -m mode", the initial -m option requires a mode argument.

Document these options correctly as well. Document these options correctly as well.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -19,30 +19,31 @@ Index: xfsprogs-4.5.0/io/init.c
@@ -32,7 +32,7 @@ void @@ -32,7 +32,7 @@ void
usage(void) usage(void)
{ {
fprintf(stderr, fprintf(stderr,
- _("Usage: %s [-adfmnrRstVx] [-p prog] [-c cmd]... file\n"), - _("Usage: %s [-adfmnrRstVx] [-p prog] [-c cmd]... file\n"),
+ _("Usage: %s [-adfnrRstVx] [-m mode] [-p prog] [-c cmd]... file\n"), + _("Usage: %s [-adfnrRstVx] [-m mode] [-p prog] [-c cmd]... file\n"),
progname); progname);
exit(1); exit(1);
} }
@@ -139,7 +139,7 @@ init( @@ -139,7 +139,7 @@ init(
pagesize = getpagesize(); pagesize = getpagesize();
gettimeofday(&stopwatch, NULL); gettimeofday(&stopwatch, NULL);

- while ((c = getopt(argc, argv, "ac:dFfmp:nrRstTVx")) != EOF) { - while ((c = getopt(argc, argv, "ac:dFfmp:nrRstTVx")) != EOF) {
+ while ((c = getopt(argc, argv, "ac:dFfm:p:nrRstTVx")) != EOF) { + while ((c = getopt(argc, argv, "ac:dFfm:p:nrRstTVx")) != EOF) {
switch (c) { switch (c) {
case 'a': case 'a':
flags |= IO_APPEND; flags |= IO_APPEND;
Index: xfsprogs-4.5.0/io/open.c Index: xfsprogs-4.5.0/io/open.c
=================================================================== ===================================================================
--- xfsprogs-4.5.0.orig/io/open.c --- xfsprogs-4.5.0.orig/io/open.c
+++ xfsprogs-4.5.0/io/open.c +++ xfsprogs-4.5.0/io/open.c
@@ -759,7 +759,7 @@ open_init(void) @@ -759,7 +759,7 @@ open_init(void)
open_cmd.argmin = 0; open_cmd.argmin = 0;
open_cmd.argmax = -1; open_cmd.argmax = -1;
open_cmd.flags = CMD_NOMAP_OK | CMD_NOFILE_OK | CMD_FOREIGN_OK; open_cmd.flags = CMD_NOMAP_OK | CMD_NOFILE_OK | CMD_FOREIGN_OK;
- open_cmd.args = _("[-acdrstxT] [path]"); - open_cmd.args = _("[-acdrstxT] [path]");
+ open_cmd.args = _("[-acdrstxT] [-m mode] [path]"); + open_cmd.args = _("[-acdrstxT] [-m mode] [path]");
open_cmd.oneline = _("open the file specified by path"); open_cmd.oneline = _("open the file specified by path");
open_cmd.help = open_help; open_cmd.help = open_help;

14
SOURCES/xfsprogs-4.9.0-junk-attr-leaf-count-zero.patch

@ -33,16 +33,18 @@ index 40cb5f7..b855a10 100644
--- a/repair/attr_repair.c --- a/repair/attr_repair.c
+++ b/repair/attr_repair.c +++ b/repair/attr_repair.c
@@ -593,7 +593,8 @@ process_leaf_attr_block( @@ -593,7 +593,8 @@ process_leaf_attr_block(
stop = xfs_attr3_leaf_hdr_size(leaf); stop = xfs_attr3_leaf_hdr_size(leaf);

/* does the count look sorta valid? */ /* does the count look sorta valid? */
- if (leafhdr.count * sizeof(xfs_attr_leaf_entry_t) + stop > - if (leafhdr.count * sizeof(xfs_attr_leaf_entry_t) + stop >
+ if (!leafhdr.count || + if (!leafhdr.count ||
+ leafhdr.count * sizeof(xfs_attr_leaf_entry_t) + stop > + leafhdr.count * sizeof(xfs_attr_leaf_entry_t) + stop >
mp->m_sb.sb_blocksize) { mp->m_sb.sb_blocksize) {
do_warn( do_warn(
_("bad attribute count %d in attr block %u, inode %" PRIu64 "\n"), _("bad attribute count %d in attr block %u, inode %" PRIu64 "\n"),
-- --
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html More majordomo info at http://vger.kernel.org/majordomo-info.html



8
SOURCES/xfsprogs-revert-off64_t.patch

@ -8,12 +8,12 @@ Author: Felix Janda <felix.janda@posteo.de>
Date: Fri Feb 5 08:34:06 2016 +1100 Date: Fri Feb 5 08:34:06 2016 +1100


linux.h: Use off64_t instead of loff_t linux.h: Use off64_t instead of loff_t

These are equivalent on glibc, while musl does not know loff_t. These are equivalent on glibc, while musl does not know loff_t.

In the long run, it would be preferable to enable transparent LFS so In the long run, it would be preferable to enable transparent LFS so
that off64_t could be replaced by off_t. that off64_t could be replaced by off_t.

Signed-off-by: Felix Janda <felix.janda@posteo.de> Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
@ -25,7 +25,7 @@ index 674717c..a7d2f85 100644
@@ -141,7 +141,7 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len) @@ -141,7 +141,7 @@ platform_discard_blocks(int fd, uint64_t start, uint64_t len)
#define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ #define EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */
#define EFSBADCRC EBADMSG /* Bad CRC detected */ #define EFSBADCRC EBADMSG /* Bad CRC detected */

-typedef off64_t xfs_off_t; -typedef off64_t xfs_off_t;
+typedef loff_t xfs_off_t; +typedef loff_t xfs_off_t;
typedef __uint64_t xfs_ino_t; typedef __uint64_t xfs_ino_t;

24
SOURCES/xfsprogs-wrapper.h

@ -0,0 +1,24 @@
/* This file is here to prevent a file conflict on multiarch systems. A
* conflict will occur because platform_defs.h has arch-specific definitions.
*
* DO NOT INCLUDE THE NEW FILE DIRECTLY -- ALWAYS INCLUDE THIS ONE INSTEAD. */

#if defined(__i386__)
#include "platform_defs-i386.h"
#elif defined(__x86_64__)
#include "platform_defs-x86_64.h"
#elif defined(__powerpc64__)
#include "platform_defs-ppc64.h"
#elif defined(__powerpc__)
#include "platform_defs-ppc.h"
#elif defined(__s390x__)
#include "platform_defs-s390x.h"
#elif defined(__s390__)
#include "platform_defs-s390.h"
#elif defined(__sparc__) && defined(__arch64__)
#include "platform_defs-sparc64.h"
#elif defined(__sparc__)
#include "platform_defs-sparc.h"
#else
#error "This xfsprogs-devel package does not work your architecture?"
#endif

49
SPECS/xfsprogs.spec

@ -1,15 +1,15 @@
Summary: Utilities for managing the XFS filesystem Summary: Utilities for managing the XFS filesystem
Name: xfsprogs Name: xfsprogs
Version: 4.5.0 Version: 4.5.0
Release: 15%{?dist} Release: 19%{?dist}
# Licensing based on generic "GNU GENERAL PUBLIC LICENSE" # Licensing based on generic "GNU GENERAL PUBLIC LICENSE"
# in source, with no mention of version. # in source, with no mention of version.
# doc/COPYING file specifies what is GPL and what is LGPL # doc/COPYING file specifies what is GPL and what is LGPL
# but no mention of versions in the source. # but no mention of versions in the source.
License: GPL+ and LGPLv2+ License: GPL+ and LGPLv2+
Group: System Environment/Base Group: System Environment/Base
URL: http://oss.sgi.com/projects/xfs/ URL: https://xfs.wiki.kernel.org
Source0: ftp://oss.sgi.com/projects/xfs/cmd_tars/%{name}-%{version}.tar.gz Source0: http://kernel.org/pub/linux/utils/fs/xfs/xfsprogs/%{name}-%{version}.tar.gz
Source1: xfsprogs-wrapper.h Source1: xfsprogs-wrapper.h
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libtool, gettext, libattr-devel, libuuid-devel BuildRequires: libtool, gettext, libattr-devel, libuuid-devel
@ -47,6 +47,15 @@ Patch22: xfsprogs-4.13.0-xfs_repair-don-t-use-do_warn-for-normal-log-message.pat
Patch23: xfsprogs-4.11.0-xfs_repair-warn-about-dirty-log-with-n-option.patch Patch23: xfsprogs-4.11.0-xfs_repair-warn-about-dirty-log-with-n-option.patch
Patch24: xfsprogs-4.8.0-xfs_repair-exit-with-status-2-if-log-dirtiness-is-un.patch Patch24: xfsprogs-4.8.0-xfs_repair-exit-with-status-2-if-log-dirtiness-is-un.patch
Patch25: xfsprogs-4.16-xfs_repair-handle-corrupt-log.patch Patch25: xfsprogs-4.16-xfs_repair-handle-corrupt-log.patch
# RHEL-7.6
Patch26: xfsprogs-4.10.0-xfs_db-fix-the-source-command-when-passed-as-a-c-opt.patch
Patch27: xfsprogs-4.14.0-db-increase-metadump-s-default-overly-long-extent-di.patch
Patch28: xfsprogs-4.15.0-xfs_db-fix-crash-when-field-list-selector-string-has.patch
Patch29: xfsprogs-4.15.0-xfsprogs-update-dead-urls.patch
Patch30: xfsprogs-4.17.0-xfsprogs-be-careful-about-what-we-stat-in-platform_c.patch
Patch31: xfsprogs-4.17.0-xfs_io-add-label-command.patch
Patch32: xfsprogs-4.18-repair-root-parent.patch
Patch33: xfsprogs-4.15.0-xfs_copy-accept-CRC-version-of-ABTB_MAGIC-in-ASSERT.patch


%description %description
A set of commands to use the XFS filesystem, including mkfs.xfs. A set of commands to use the XFS filesystem, including mkfs.xfs.
@ -58,10 +67,6 @@ variable block sizes, is extent based, and makes extensive use of
Btrees (directories, extents, free space) to aid both performance Btrees (directories, extents, free space) to aid both performance
and scalability. and scalability.


Refer to the documentation at http://oss.sgi.com/projects/xfs/
for complete details. This implementation is on-disk compatible
with the IRIX version of XFS.

%package devel %package devel
Summary: XFS filesystem-specific headers Summary: XFS filesystem-specific headers
Group: Development/Libraries Group: Development/Libraries
@ -103,6 +108,14 @@ also want to install xfsprogs.
%patch23 -p1 %patch23 -p1
%patch24 -p1 %patch24 -p1
%patch25 -p1 %patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1


%build %build
export tagname=CC export tagname=CC
@ -168,6 +181,22 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*.so %{_libdir}/*.so


%changelog %changelog
* Mon Feb 11 2019 Eric Sandeen <sandeen@redhat.com> 4.5.0-19
- xfs_copy: accept CRC version of ABTB_MAGIC in ASSERT (#1641023)

* Wed Jun 20 2018 Eric Sandeen <sandeen@redhat.com> 4.5.0-18
- xfs_repar: Fix root inode's parent for sf directory (#1590334)

* Wed Jun 13 2018 Eric Sandeen <sandeen@redhat.com> 4.5.0-17
- xfs_io: add online label command (#1584912)

* Thu May 31 2018 Eric Sandeen <sandeen@redhat.com> 4.5.0-16
- xfs_db: fix the source command when passed as -c option (#1510279)
- xfs_metadump: allow much larger extent counts (#1502927)
- xfs_db: fix crash when field list selector has garbage (#1532271)
- mkfs.xfs, others: don't stat non-block devices on startup (#1573974)
- Update project URLs throughout the pkg, code and docs (#1550798)

* Tue Feb 27 2018 Eric Sandeen <sandeen@redhat.com> 4.5.0-15 * Tue Feb 27 2018 Eric Sandeen <sandeen@redhat.com> 4.5.0-15
- xfs_repair: allow repair of corrupt log (#1549525) - xfs_repair: allow repair of corrupt log (#1549525)


@ -378,11 +407,11 @@ rm -rf $RPM_BUILD_ROOT


* Mon Feb 01 2010 Eric Sandeen <sandeen@redhat.com> 3.1.1-2 * Mon Feb 01 2010 Eric Sandeen <sandeen@redhat.com> 3.1.1-2
- Fix mkfs of target with nothing blkid can recognize (#561870) - Fix mkfs of target with nothing blkid can recognize (#561870)

* Mon Feb 01 2010 Eric Sandeen <sandeen@redhat.com> 3.1.1-1 * Mon Feb 01 2010 Eric Sandeen <sandeen@redhat.com> 3.1.1-1
- New upstream release - New upstream release
- Fix fd validity test for device-less mkfs invocation - Fix fd validity test for device-less mkfs invocation

* Sun Jan 17 2010 Eric Sandeen <sandeen@redhat.com> 3.1.0-2 * Sun Jan 17 2010 Eric Sandeen <sandeen@redhat.com> 3.1.0-2
- Post-release mkfs fixes (#555847) - Post-release mkfs fixes (#555847)


@ -472,7 +501,7 @@ rm -rf $RPM_BUILD_ROOT
- xfs_repair fixes - xfs_repair fixes


* Wed Jun 04 2008 Dennis Gilmore <dennis@ausil.us> 2.9.8-3 * Wed Jun 04 2008 Dennis Gilmore <dennis@ausil.us> 2.9.8-3
- sparc32 is built using the sparcv9 variant - sparc32 is built using the sparcv9 variant


* Wed Jun 04 2008 Eric Sandeen <sandeen@redhat.com> 2.9.8-2 * Wed Jun 04 2008 Eric Sandeen <sandeen@redhat.com> 2.9.8-2
- Tidy up multilib hack for non-multilib arches & add sparc (#448452) - Tidy up multilib hack for non-multilib arches & add sparc (#448452)

Loading…
Cancel
Save