]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/log
thirdparty/xfsprogs-dev.git
6 years agoxfs: remove if_rdev
Christoph Hellwig [Fri, 17 Nov 2017 04:11:33 +0000 (22:11 -0600)] 
xfs: remove if_rdev

Source kernel commit: 66f364649d870c7541c30a2f02a32fd4c88684f0

We can simply use the i_rdev field in the Linux inode and just convert
to and from the XFS dev_t when reading or logging/writing the inode.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: add i_rdev to our mocked up inode in userspace]
[djwong: use IRIX_DEV macros, assign in i_rdev in libxfs_ialloc]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove the never fully implemented UUID fork format
Christoph Hellwig [Fri, 17 Nov 2017 04:11:33 +0000 (22:11 -0600)] 
xfs: remove the never fully implemented UUID fork format

Source kernel commit: 42b67dc6ffbf2701cfc578b3e706d560a80b6674

Remove the dead code dealing with the UUID fork format that was never
implemented in Linux (and neither in IRIX as far as I know).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: use __u8 not u8 for now, adapt xfs_logprint]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove XFS_BMAP_TRACE_EXLIST
Christoph Hellwig [Fri, 17 Nov 2017 04:11:33 +0000 (22:11 -0600)] 
xfs: remove XFS_BMAP_TRACE_EXLIST

Source kernel commit: e8e0e170e2e17b601b86edb86f58dbf7c599e4b3

Instead of looping over all extents in some debug-only helper just
insert trace points into the loops that already exist in the calling
functions.

Also split the xfs_extlist trace point into one each for reading and
writing extents from disk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: userspace-specific tracepoint macro updates]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: move pre/post-bmap tracing into xfs_iext_update_extent
Christoph Hellwig [Fri, 17 Nov 2017 04:11:33 +0000 (22:11 -0600)] 
xfs: move pre/post-bmap tracing into xfs_iext_update_extent

Source kernel commit: ca5d8e5b7b9030005e38e7c43e08c0cd4eb2a78f

xfs_iext_update_extent already has basically all the information needed
to centralize the bmap pre/post tracing.  We just need to pass inode +
bmap state instead of the inode fork pointer to get all trace annotations.

In addition to covering all the existing trace points this gives us
tracing coverage for the extent shifting operations for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove post-bmap tracing in xfs_bmap_local_to_extents
Christoph Hellwig [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: remove post-bmap tracing in xfs_bmap_local_to_extents

Source kernel commit: d138604fb1a6500064b50e75f220e6cbce785493

Now that we use xfs_iext_insert this is already covered by the tracing
in that function.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: make better use of the 'state' variable in xfs_bmap_del_extent_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: make better use of the 'state' variable in xfs_bmap_del_extent_real

Source kernel commit: 35e62da55f4b2450cbb51c9734d745a799e2a793

We already have all the information about the fork a=D1=95 well as additional
tracing information, so pass that to xfs_iext_remove().

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: add a xfs_bmap_fork_to_state helper
Christoph Hellwig [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: add a xfs_bmap_fork_to_state helper

Source kernel commit: 060ea65b39409f3b9952dfa6db5fbe4355e6888a

This creates the right initial bmap state from the passed in inode
fork enum.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub quota information
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub quota information

Source kernel commit: c2fc338c87a31f557b57f5143602444ba3cf2c3e

Perform some quick sanity testing of the disk quota information.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub realtime bitmap/summary
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub realtime bitmap/summary

Source kernel commit: 29b0767b8beb4c5e3fd94656d51413a4fe8d2d74

Perform simple tests of the realtime bitmap and summary.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub directory parent pointers
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub directory parent pointers

Source kernel commit: 0f28b25731f76feda1ec71671754a2b7179ee1ef

Scrub parent pointers, sort of.  For directories, we can ride the
'..' entry up to the parent to confirm that there's at most one
dentry that points back to this directory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub symbolic links
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub symbolic links

Source kernel commit: 2a721dbbc8bf4d76581fb073aa0d9554df56da1a

Create the infrastructure to scrub symbolic link data.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub extended attributes
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub extended attributes

Source kernel commit: eec0482e0829eab1da1be693e524c889dc4b168c

Scrub the hash tree, keys, and values in an extended attribute structure.
Refactor the attribute code to use the transaction if the caller supplied
one to avoid buffer deadocks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub directory metadata
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub directory metadata

Source kernel commit: a5c46e5e8912d232b959faf511cd9a17cc829f0a

Scrub the hash tree and all the entries in a directory.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub inode block mappings
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub inode block mappings

Source kernel commit: 99d9d8d05da26f47aa8412397407f962bcb4713a

Scrub an individual inode's block mappings to make sure they make sense.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub inodes
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub inodes

Source kernel commit: 80e4e12688029e42fc6ab4cf7f229b090c61e6a7

Scrub the fields within an inode.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub refcount btrees
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub refcount btrees

Source kernel commit: edc09b528628afb50904106f36de182a00e7eb40

Plumb in the pieces necessary to check the refcount btree.  If rmap is
available, check the reference count by performing an interval query
against the rmapbt.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub rmap btrees
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub rmap btrees

Source kernel commit: c7e693d9836c003150fef80be40a06e1f2e65d0c

Check the reverse mapping records to make sure that the contents
make sense.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub inode btrees
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub inode btrees

Source kernel commit: 3daa664191375db6a4a0cced75183aa3ca96cbda

Check the records of the inode btrees to make sure that the values
make sense given the inode records themselves.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub free space btrees
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub free space btrees

Source kernel commit: efa7a99ce1f8615aca7b0ff3122a1ae14e4d1cdc

Check the extent records free space btrees to ensure that the values
look sane.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub the AGI
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub the AGI

Source kernel commit: a12890aebb895951720ff884eab1c99a30645b29

Add a forgotten check to the AGI verifier, then wire up the scrub
infrastructure to check the AGI contents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub AGF and AGFL
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub AGF and AGFL

Source kernel commit: ab9d5dc59fe6157b8035c4b605166b868f678ee4

Check the block references in the AGF and AGFL headers to make sure
they make sense.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub the secondary superblocks
Darrick J. Wong [Fri, 17 Nov 2017 04:11:32 +0000 (22:11 -0600)] 
xfs: scrub the secondary superblocks

Source kernel commit: 21fb4cb1981ef7e02f35a42b2a5ae619517dfe1b

Ensure that the geometry presented in the backup superblocks matches
the primary superblock so that repair can recover the filesystem if
that primary gets corrupted.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: scrub the shape of a metadata btree
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: scrub the shape of a metadata btree

Source kernel commit: cc3e0948d2686f30f49166660cf85b7e0194f365

Create a function that can check the shape of a btree -- each block
passes basic inspection and all the pointers look ok.  In the next patch
we'll add the ability to check the actual keys and records stored within
the btree.  Add some helper functions so that we report detailed scrub
errors in a uniform manner in dmesg.  These are helper functions for
subsequent patches.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: probe the scrub ioctl
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: probe the scrub ioctl

Source kernel commit: dcb660f9222fd9f607e7e05f4755b39b809ca19f

Create a probe scrubber with id 0.  This will be used by xfs_scrub to
probe the kernel's abilities to scrub (and repair) the metadata.  We do
this by validating the ioctl inputs from userspace, preparing the
filesystem for a scrub (or a repair) operation, and immediately
returning to userspace.  Userspace can use the returned errno and
structure state to decide (in broad terms) if scrub/repair are
supported by the running kernel.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: create an ioctl to scrub AG metadata
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: create an ioctl to scrub AG metadata

Source kernel commit: 36fd6e863cb7329ab2e5687fdae4e4626b840adc

Create an ioctl that can be used to scrub internal filesystem metadata.
The new ioctl takes the metadata type, an (optional) AG number, an
(optional) inode number and generation, and a flags argument.  This will
be used by the upcoming XFS online scrub tool.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: create inode pointer verifiers
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: create inode pointer verifiers

Source kernel commit: 91fb9afc0847926ef6ea7695b8125c8fbe7974d6

Create some helper functions to check that inode pointers point to
somewhere within the filesystem and not at the static AG metadata.
Move xfs_internal_inum and create a directory inode check function.
We will use these functions in scrub and elsewhere.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor btree block header checking functions
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor btree block header checking functions

Source kernel commit: 52c732eee78b47ac2eb828b1c7fa611cd37b0090

Refactor the btree block header checks to have an internal function that
returns the address of the failing check without logging errors.  The
scrubber will call the internal function, while the external version
will maintain the current logging behavior.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor btree pointer checks
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor btree pointer checks

Source kernel commit: f135761a73b18877bdfb44018fe993172c7be203

Refactor the btree pointer checks so that we can call them from the
scrub code without logging errors to dmesg.  Preserve the existing error
reporting for regular operations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: create block pointer check functions
Darrick J. Wong [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: create block pointer check functions

Source kernel commit: 21ec54168b368f1a98097dee00625ec8ec2d47f3

Create some helper functions to check that a block pointer points
within the filesystem (or AG) and doesn't point at static metadata.
We will use this for scrub.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove xfs_bmbt_get_state
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: remove xfs_bmbt_get_state

Source kernel commit: f0387501652ed39f3bebc72e8a6b5abb405eb2b7

Unused after the big bmap refactor.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove all xfs_bmbt_set_* helpers except for xfs_bmbt_set_all
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: remove all xfs_bmbt_set_* helpers except for xfs_bmbt_set_all

Source kernel commit: 9b150709b3190719e5edf5f0ea35245cb8ae0a1a

Unused after the big bmap refactor.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: replace xfs_bmbt_lookup_ge with xfs_bmbt_lookup_first
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: replace xfs_bmbt_lookup_ge with xfs_bmbt_lookup_first

Source kernel commit: b5cfbc2282bcd0dba460d4d4ec07fcfac9981de6

We only use xfs_bmbt_lookup_ge to look up the first bmap record in an
inode, so replace xfs_bmbt_lookup_ge with a special purpose helper that
is a bit more descriptive.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: pass a struct xfs_bmbt_irec to xfs_bmbt_lookup_eq
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: pass a struct xfs_bmbt_irec to xfs_bmbt_lookup_eq

Source kernel commit: e16cf9b03cee4d2797695d4ca691e854c7a24864

Now that we've massaged the callers into the right form we can always
pass the actual extent record instead of the individual fields.

As an additional benefit the btree cursor will now be prepoulated with
the correct extent state instead of having to fix it up later.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: pass a struct xfs_bmbt_irec to xfs_bmbt_update
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: pass a struct xfs_bmbt_irec to xfs_bmbt_update

Source kernel commit: a67d00a55507dc324037f182563e10339945721a

Now that we've massaged the callers into the right form we can always
pass the actual extent record instead of the individual fields.

With that xfs_bmbt_disk_set_allf can go away, and xfs_bmbt_disk_set_all
can be merged into the former implementation of xfs_bmbt_disk_set_allf.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_bmap_add_extent_unwritten_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor xfs_bmap_add_extent_unwritten_real

Source kernel commit: 79fa6143a939a6b50d1d9dc736336e57d06b849d

Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update
entries in the in-core extent list.  This isolates the function from
the detailed layout of the extent list, and generally makes the code
a lot more readable.

Also get rid of the oldext and newext variables as using the extent
records is a lot more descriptive.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor delalloc accounting in xfs_bmap_add_extent_delay_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor delalloc accounting in xfs_bmap_add_extent_delay_real

Source kernel commit: ca1862b0838604aa048120d87ebbf53cf7c8c8bd

Account for all changes to the delalloc reservation in da_new, and use a
single call xfs_mod_fdblocks to reserve/free blocks, including always
checking for an error.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_bmap_add_extent_delay_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor xfs_bmap_add_extent_delay_real

Source kernel commit: 4dcb8869871cc102b9431ae78b40bfc39087b90c

Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update
entries in the in-core extent list.  This isolates the function from
the detailed layout of the extent list, and generally makes the code
a lot more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_bmap_add_extent_hole_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor xfs_bmap_add_extent_hole_real

Source kernel commit: 1abb9e55326c19bb41a9a2fd1179ed635e8af38c

Use xfs_iext_update_extent to update entries in the in-core extent list.
This isolates the function from the detailed layout of the extent list,
and generally makes the code a lot more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_bmap_add_extent_hole_delay
Christoph Hellwig [Fri, 17 Nov 2017 04:11:31 +0000 (22:11 -0600)] 
xfs: refactor xfs_bmap_add_extent_hole_delay

Source kernel commit: 3ffc18ecd30ed21dc503fcbfb343c471a9112fb6

Use xfs_iext_get_extent to find, and xfs_iext_update_extent to update
entries in the in-core extent list.  This isolates the function from
the detailed layout of the extent list, and generally makes the code
a lot more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_del_extent_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)] 
xfs: refactor xfs_del_extent_real

Source kernel commit: 48fd52b16d74b937f44f87f942ddaff5e3e3db64

Use xfs_iext_update_extent to update entries in the in-core extent list.
This isolates the function from the detailed layout of the extent list,
and generally makes the code a lot more readable.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use the state defines in xfs_bmap_del_extent_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)] 
xfs: use the state defines in xfs_bmap_del_extent_real

Source kernel commit: 491f6f8abfa7a91d23b969be67ed476817bcefd7

Use the same defines as the other extent add and delete helpers, which
both improves code readability and trace point output.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use correct state defines in xfs_bmap_del_extent_{cow,delay}
Christoph Hellwig [Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)] 
xfs: use correct state defines in xfs_bmap_del_extent_{cow,delay}

Source kernel commit: 0173c689ff4c0855e24ceb898274af1339b5db48

Use the _FILLING values to match the usage in the xfs_bmap_add_extent_*
helpers.  No change in behavior, just better naming in the code and
tracepoint output.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: move some more code into xfs_bmap_del_extent_real
Christoph Hellwig [Fri, 17 Nov 2017 04:11:30 +0000 (22:11 -0600)] 
xfs: move some more code into xfs_bmap_del_extent_real

Source kernel commit: 1b24b633aafe4729c468f4144246709cdbda0f35

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use xfs_bmap_del_extent_delay for the data fork as well
Christoph Hellwig [Fri, 17 Nov 2017 04:10:59 +0000 (22:10 -0600)] 
xfs: use xfs_bmap_del_extent_delay for the data fork as well

Source kernel commit: e1d7553faf3979df83a168ea4732f6f5255972a2

And remove the delalloc code from xfs_bmap_del_extent, which gets renamed
to xfs_bmap_del_extent_real to fit the naming scheme used by the other
xfs_bmap_{add,del}_extent_* routines.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: rename bno to end in __xfs_bunmapi
Christoph Hellwig [Fri, 17 Nov 2017 04:09:59 +0000 (22:09 -0600)] 
xfs: rename bno to end in __xfs_bunmapi

Source kernel commit: 8280f6ed4645549154103da9f037ceb4f7c733b4

Rename the bno variable that's used as the end of the range in
__xfs_bunmapi to end, which better describes it.  Additionally change
the start variable which takes the initial value of bno to be the
function parameter itself.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: don't set XFS_BTCUR_BPRV_WASDEL in xfs_bunmapi
Christoph Hellwig [Fri, 17 Nov 2017 04:08:59 +0000 (22:08 -0600)] 
xfs: don't set XFS_BTCUR_BPRV_WASDEL in xfs_bunmapi

Source kernel commit: b213d69293cf003e6f0c63adfee6fcc70e3afee6

The XFS_BTCUR_BPRV_WASDEL flag is supposed to indicate that we are
converting a delayed allocation to a real one, which isn't the case
in xfs_bunmapi.  Setting it could theoretically lead to misaccounting
here, but it's unlikely that we ever hit it in practice.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use xfs_iext_get_extent instead of open coding it
Christoph Hellwig [Fri, 17 Nov 2017 04:08:59 +0000 (22:08 -0600)] 
xfs: use xfs_iext_get_extent instead of open coding it

Source kernel commit: e3f0f7563e8a2589e3acc26a41f7a7867a33536d

This avoids exposure to details of the extent list implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real
Christoph Hellwig [Fri, 17 Nov 2017 04:08:59 +0000 (22:08 -0600)] 
xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real

Source kernel commit: 5e422f5e4fd71d18bc6b851eeb3864477b3d842e

There was one spot in xfs_bmap_add_extent_unwritten_real that didn't use the
passed in new extent state but always converted to normal, leading to wrong
behavior when converting from normal to unwritten.

Only found by code inspection, it seems like this code path to move partial
extent from written to unwritten while merging it with the next extent is
rarely exercised.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_io: Allow partial writes
Goldwyn Rodrigues [Thu, 9 Nov 2017 20:56:29 +0000 (14:56 -0600)] 
xfs_io: Allow partial writes

Partial writes are performed when there is an error midway
while performing the I/O. Perform the write exactly once and
return the number of bytes written so far, until the error.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
[sandeen@sandeen.net: add O to short help]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_io: Add RWF_NOWAIT to pwritev2()
Goldwyn Rodrigues [Thu, 9 Nov 2017 20:56:28 +0000 (14:56 -0600)] 
xfs_io: Add RWF_NOWAIT to pwritev2()

This allows to make pwritev2() calls with RWF_NOWAIT,
which would fail in case the call blocks.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
[sandeen@sandeen.net: combine all optional args in short help]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_io: Add support for pwritev2()
Goldwyn Rodrigues [Thu, 9 Nov 2017 20:56:25 +0000 (14:56 -0600)] 
xfs_io: Add support for pwritev2()

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_io: Disable -V if pwritev is not available
Goldwyn Rodrigues [Thu, 9 Nov 2017 20:54:59 +0000 (14:54 -0600)] 
xfs_io: Disable -V if pwritev is not available

This results in default case which will display the error message
that command is not found. This is required for xfs_io builds which
did not support pwritev and an attempt is made to use -V.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen@sandeen.net: restrict default: printf to ifdef'd options]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_repair: always release btree buffers when refcountbt checks fail
Darrick J. Wong [Thu, 9 Nov 2017 17:35:30 +0000 (11:35 -0600)] 
xfs_repair: always release btree buffers when refcountbt checks fail

During phase 4 of repair, we compare the refcount records we've computed
against what's in the refcount btree.  If the btree is corrupt the
libxfs refcount calls will fail, but on our way out of the function we
don't make sure to clear all the btree cursor's buffer pointers.  This
leads to a repair deadlock in xfs/372 when fuzzing ptrs[1] to -1U
because we forgot to release a buffer.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agomisc: fix ubsan warnings
Darrick J. Wong [Thu, 9 Nov 2017 17:35:29 +0000 (11:35 -0600)] 
misc: fix ubsan warnings

Fix all the things ubsan warned about.

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>
6 years agomisc: enable thread sanitizer if the builder wants it
Darrick J. Wong [Thu, 9 Nov 2017 17:35:28 +0000 (11:35 -0600)] 
misc: enable thread sanitizer if the builder wants it

Enable the gcc/clang thread data corruption sanitizer if the builder
requests it and it's available.

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>
6 years agomisc: enable gcc/clang address sanitizer if the builder wants it
Darrick J. Wong [Thu, 9 Nov 2017 17:35:27 +0000 (11:35 -0600)] 
misc: enable gcc/clang address sanitizer if the builder wants it

Enable AddressSanitizer to look for memory usage errors if the builder
asks for it and it's available.

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>
6 years agomisc: enable ubsan if the builder wants it
Darrick J. Wong [Thu, 9 Nov 2017 17:35:26 +0000 (11:35 -0600)] 
misc: enable ubsan if the builder wants it

Enable the undefined behavior sanitizer (ubsan) if the builder requests
it and it's available.

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>
6 years agoxfs_repair: fix cowextsize field checking and repairing
Darrick J. Wong [Thu, 9 Nov 2017 17:35:26 +0000 (11:35 -0600)] 
xfs_repair: fix cowextsize field checking and repairing

Make sure that we never leave the filesystem with a zero cowextsize hint
while the cowextsize inode flag is set.

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>
6 years agoxfs_repair: clear DAX flag from non-file inodes
Darrick J. Wong [Thu, 9 Nov 2017 17:35:25 +0000 (11:35 -0600)] 
xfs_repair: clear DAX flag from non-file inodes

The DAX flag should only be set for files and directories.

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>
6 years agoxfs_repair: fix bag memory overwrite problems
Darrick J. Wong [Thu, 9 Nov 2017 17:35:24 +0000 (11:35 -0600)] 
xfs_repair: fix bag memory overwrite problems

There's an off by one error in the bag_remove code such that we end up
copying memory from beyond the end of the array into the array.  Not a
serious problem since we have counters to prevent us from reading that
garbage, but AddressSanitizer complained so let's fix it.

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>
6 years agoxfs_io: add new error injection knobs to inject command
Darrick J. Wong [Thu, 9 Nov 2017 17:35:23 +0000 (11:35 -0600)] 
xfs_io: add new error injection knobs to inject command

Bring xfs_io's inject command up to date with the newest knobs.

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>
6 years agoxfsprogs: explicitly cast troublesome types to match printf format specifiers
Darrick J. Wong [Thu, 9 Nov 2017 17:35:23 +0000 (11:35 -0600)] 
xfsprogs: explicitly cast troublesome types to match printf  format specifiers

Certain system-defined types (__u64, __s64, __nlink_t, __ino64_t,
__off64_t, __blkcnt64_t) don't have a consistent definition across
different architectures, so wherever we use a printf format specifier on
such a variable, we have to typecast the variable or else the compiler
will complain.

IOWs this fixes build warnings on ppc64le.

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>
6 years agodb: increase metadump's default overly long extent discard threshold
Darrick J. Wong [Thu, 9 Nov 2017 17:35:22 +0000 (11:35 -0600)] 
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>
6 years agobuild: define _DEFAULT_SOURCE with _BSD_SOURCE for preadv
Luis R. Rodriguez [Thu, 9 Nov 2017 17:35:21 +0000 (11:35 -0600)] 
build: define _DEFAULT_SOURCE with _BSD_SOURCE for preadv

_BSD_SOURCE has been deprecated and replaced with _DEFAULT_SOURCE
for feature test macros.  We use this for preadv in the configure
script, but the latest preadv(2) manpage says:

preadv(), pwritev():
since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE

and the latest feature_test_macros(7) manpage says:

 Since glibc 2.20, this macro is deprecated.  It now has the same
 effect as defining _DEFAULT_SOURCE, but generates a compile-time
 warning (unless _DEFAULT_SOURCE is also defined).  Use
 _DEFAULT_SOURCE instead.  To allow code that requires
 _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in
 glibc 2.20 and later to compile without warnings, define both
 _BSD_SOURCE and _DEFAULT_SOURCE.

So add both to our configure test.  They were completely missing
from the actual preadv usage in xfs_io, so add them there too.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen@redhat.com: clarify changelog, add defines to code use too]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfsprogs: add xfs_spaceman to .gitignore
Zirong Lang [Thu, 9 Nov 2017 17:35:20 +0000 (11:35 -0600)] 
xfsprogs: add xfs_spaceman to .gitignore

The new binary xfs_spaceman isn't in .gitignore, so ignore it in
this patch.

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_io: report io error for pwrite -W and -w
Liu Bo [Thu, 9 Nov 2017 17:35:20 +0000 (11:35 -0600)] 
xfs_io: report io error for pwrite -W and -w

When IO error occurs, xfs_io -c "pwrite -W/w" doesn't report errors
while xfs_io -c "pwrite" -c "fsync" does.

This changes "pwrite -W/w" to report errors when it should.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs_metadump: zap stale data in DIR2_LEAF1 dirs
Eric Sandeen [Thu, 9 Nov 2017 17:35:19 +0000 (11:35 -0600)] 
xfs_metadump: zap stale data in DIR2_LEAF1 dirs

xfs_metadump attempts to zero out unused regions of metadata
blocks to prevent data leaks when sharing metadata images.

However, Stefan Ring reported a significant number of leaked
strings when dumping his 1T filesystem.  Based on a reduced
metadata set, I was able to identify "leaf" directories
(with XFS_DIR2_LEAF1_MAGIC magic) as the primary culprit;
the region between the end of the entries array and the start
of the bests array was not getting zeroed out.  This patch
seems to remedy that problem.

Reported-by: Stefan Ring <stefanrin@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agometadump: update manpage for dirty log/obfuscation issue
Jan Tulak [Thu, 9 Nov 2017 17:35:18 +0000 (11:35 -0600)] 
metadump: update manpage for dirty log/obfuscation issue

This is something that should be documented, as it is not obvious to
everyone.

Signed-off-by: Jan Tulak <jtulak@redhat.com>
[sandeen@redhat.com: edit for clarity]
[darrick.wong@oracle.com: edit for more clarity]
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agokill off u_int*_t types
Felix Janda [Thu, 9 Nov 2017 17:34:53 +0000 (11:34 -0600)] 
kill off u_int*_t types

They were only used in two places and can be replaced by uint*_t.

Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: trim writepage mapping to within eof libxfs-4.14-sync
Brian Foster [Wed, 18 Oct 2017 21:25:45 +0000 (16:25 -0500)] 
xfs: trim writepage mapping to within eof

Source kernel commit: 40214d128e07dd21bb07a8ed6a7fe2f911281ab2

The writeback rework in commit fbcc02561359 ("xfs: Introduce
writeback context for writepages") introduced a subtle change in
behavior with regard to the block mapping used across the
->writepages() sequence. The previous xfs_cluster_write() code would
only flush pages up to EOF at the time of the writepage, thus
ensuring that any pages due to file-extending writes would be
handled on a separate cycle and with a new, updated block mapping.

The updated code establishes a block mapping in xfs_writepage_map()
that could extend beyond EOF if the file has post-eof preallocation.
Because we now use the generic writeback infrastructure and pass the
cached mapping to each writepage call, there is no implicit EOF
limit in place. If eofblocks trimming occurs during ->writepages(),
any post-eof portion of the cached mapping becomes invalid. The
eofblocks code has no means to serialize against writeback because
there are no pages associated with post-eof blocks. Therefore if an
eofblocks trim occurs and is followed by a file-extending buffered
write, not only has the mapping become invalid, but we could end up
writing a page to disk based on the invalid mapping.

Consider the following sequence of events:

- A buffered write creates a delalloc extent and post-eof
speculative preallocation.
- Writeback starts and on the first writepage cycle, the delalloc
extent is converted to real blocks (including the post-eof blocks)
and the mapping is cached.
- The file is closed and xfs_release() trims post-eof blocks. The
cached writeback mapping is now invalid.
- Another buffered write appends the file with a delalloc extent.
- The concurrent writeback cycle picks up the just written page
because the writeback range end is LLONG_MAX. xfs_writepage_map()
attributes it to the (now invalid) cached mapping and writes the
data to an incorrect location on disk (and where the file offset is
still backed by a delalloc extent).

This problem is reproduced by xfstests test generic/464, which
triggers racing writes, appends, open/closes and writeback requests.

To address this problem, trim the mapping used during writeback to
within EOF when the mapping is validated. This ensures the mapping
is revalidated for any pages encountered beyond EOF as of the time
the current mapping was cached or last validated.

Reported-by: Eryu Guan <eguan@redhat.com>
Diagnosed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: handle error if xfs_btree_get_bufs fails
Eric Sandeen [Wed, 18 Oct 2017 18:39:02 +0000 (13:39 -0500)] 
xfs: handle error if xfs_btree_get_bufs fails

Source kernel commit: 93e8befc17f6d6ea92b0aee3741ceac8bca4590f

Jason reported that a corrupted filesystem failed to replay
the log with a metadata block out of bounds warning:

XFS (dm-2): _xfs_buf_find: Block out of range: block 0x80270fff8, EOFS 0x9c40000

_xfs_buf_find() and xfs_btree_get_bufs() return NULL if
that happens, and then when xfs_alloc_fix_freelist() calls
xfs_trans_binval() on that NULL bp, we oops with:

BUG: unable to handle kernel NULL pointer dereference at 00000000000000f8

We don't handle _xfs_buf_find errors very well, every
caller higher up the stack gets to guess at why it failed.
But we should at least handle it somehow, so return
EFSCORRUPTED here.

Reported-by: Jason L Tibbitts III <tibbs@math.uh.edu>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: Fix bool initialization/comparison
Thomas Meyer [Wed, 18 Oct 2017 18:39:02 +0000 (13:39 -0500)] 
xfs: Fix bool initialization/comparison

Source kernel commit: 749f24f33e87c1706d716c283027595b72a034f3

Bool initializations should use true and false. Bool tests don't need
comparisons.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: Don't log uninitialised fields in inode structures
Dave Chinner [Wed, 18 Oct 2017 18:39:02 +0000 (13:39 -0500)] 
xfs: Don't log uninitialised fields in inode structures

Source kernel commit: 20413e37d71befd02b5846acdaf5e2564dd1c38e

Prevent kmemcheck from throwing warnings about reading uninitialised
memory when formatting inodes into the incore log buffer. There are
several issues here - we don't always log all the fields in the
inode log format item, and we never log the inode the
di_next_unlinked field.

In the case of the inode log format item, this is exacerbated
by the old xfs_inode_log_format structure padding issue. Hence make
the padded, 64 bit aligned version of the structure the one we always
use for formatting the log and get rid of the 64 bit variant. This
means we'll always log the 64-bit version and so recovery only needs
to convert from the unpadded 32 bit version from older 32 bit
kernels.

Signed-Off-By: Dave Chinner <dchinner@redhat.com>
Tested-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: revert "xfs: factor rmap btree size into the indlen calculations"
Darrick J. Wong [Wed, 18 Oct 2017 18:39:02 +0000 (13:39 -0500)] 
xfs: revert "xfs: factor rmap btree size into the indlen calculations"

Source kernel commit: 5e5c943c1f257c2b3424fc3f8a7b18570152dab3

In commit fd26a88093ba we added a worst case estimate for rmapbt blocks
needed to satisfy the block mapping request.  Since then, we added the
ability to reserve enough space in each AG such that we should never run
out of blocks to grow the rmapbt, which makes this calculation
unnecessary.  Revert the commit because it makes the extra delalloc
indlen accounting unnecessary and incorrect.

Reported-by: Eryu Guan <eguan@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: perag initialization should only touch m_ag_max_usable for AG 0
Darrick J. Wong [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: perag initialization should only touch m_ag_max_usable for AG 0

Source kernel commit: 9789dd9e1d939232e8ff4c50ef8e75aa6781b3fb

We call __xfs_ag_resv_init to make a per-AG reservation for each AG.
This makes the reservation per-AG, not per-filesystem.  Therefore, it
is incorrect to adjust m_ag_max_usable for each AG.  Adjust it only
when we're reserving AG 0's blocks so that we only do it once per fs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: fix compiler warnings
Darrick J. Wong [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: fix compiler warnings

Source kernel commit: 7bf7a193a90cadccaad21c5970435c665c40fe27

Fix up all the compiler warnings that have crept in.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: simplify the rmap code in xfs_bmse_merge
Darrick J. Wong [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: simplify the rmap code in xfs_bmse_merge

Source kernel commit: 4cc1ee5e654114aa7fac6993488ad2cd0b3411bb

In Christoph's patch to refactor xfs_bmse_merge, the updated rmap code
does more work than it needs to (because map-extent auto-merges
records).  Remove the unnecessary unmap and save ourselves a deferred
op.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at

Source kernel commit: 4c35445b591ee669097c5b98e4bb677808e9f582

This abstracts the function away from details of the low-level extent
list implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use xfs_iext_*_extent helpers in xfs_bmap_shift_extents
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: use xfs_iext_*_extent helpers in xfs_bmap_shift_extents

Source kernel commit: 4da6b514eaa168c246fc5c1245c4f82084bcf24e

This abstracts the function away from details of the low-level extent
list implementation.

Note that it seems like the previous implementation of rmap for
the merge case was completely broken, but it no seems appear to
trigger that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: move some code around inside xfs_bmap_shift_extents
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: move some code around inside xfs_bmap_shift_extents

Source kernel commit: 05b7c8ab2be71e6fef4615451e7af1bc79ffdf29

For the first right move we need to look up next_fsb.  That means
our last fsb that contains next_fsb must also be the current extent,
so take advantage of that by moving the code around a bit.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: use xfs_iext_get_extent in xfs_bmap_first_unused
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: use xfs_iext_get_extent in xfs_bmap_first_unused

Source kernel commit: f2285c148c4167337d12452bebccadd2ad821d5d

Use the bmap abstraction instead of open-coding bmbt details here.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: switch xfs_bmap_local_to_extents to use xfs_iext_insert
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: switch xfs_bmap_local_to_extents to use xfs_iext_insert

Source kernel commit: 50bb44c28614205def9e711190842b4c0242ae79

Use the helper instead of open coding it, to provide a better abstraction
for the scalable extent list work.  This also gets an additional assert
and trace point for free.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: add a xfs_iext_update_extent helper
Christoph Hellwig [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: add a xfs_iext_update_extent helper

Source kernel commit: 67e4e69cb2a7afbffdefd1a0a23a94d1d706c38f

This helper is used to update an extent record based on the extent index,
and can be used to provide a level of abstractions between callers that
want to modify in-core extent records and the details of the extent list
implementation.

Also switch all users of the xfs_bmbt_set_all(xfs_iext_get_ext(...))
pattern to this new helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: relog dirty buffers during swapext bmbt owner change
Brian Foster [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: relog dirty buffers during swapext bmbt owner change

Source kernel commit: 2dd3d709fc4338681a3aa61658122fa8faa5a437

The owner change bmbt scan that occurs during extent swap operations
does not handle ordered buffer failures. Buffers that cannot be
marked ordered must be physically logged so previously dirty ranges
of the buffer can be relogged in the transaction.

Since the bmbt scan may need to process and potentially log a large
number of blocks, we can't expect to complete this operation in a
single transaction. Update extent swap to use a permanent
transaction with enough log reservation to physically log a buffer.
Update the bmbt scan to physically log any buffers that cannot be
ordered and to terminate the scan with -EAGAIN. On -EAGAIN, the
caller rolls the transaction and restarts the scan. Finally, update
the bmbt scan helper function to skip bmbt blocks that already match
the expected owner so they are not reprocessed after scan restarts.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[darrick: fix the xfs_trans_roll call]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[dchinner: proper userspace libxfs_trans_ordered_buf]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: skip bmbt block ino validation during owner change
Brian Foster [Wed, 18 Oct 2017 18:39:01 +0000 (13:39 -0500)] 
xfs: skip bmbt block ino validation during owner change

Source kernel commit: 99c794c639a65cc7b74f30a674048fd100fe9ac8

Extent swap uses xfs_btree_visit_blocks() to fix up bmbt block
owners on v5 (!rmapbt) filesystems. The bmbt scan uses
xfs_btree_lookup_get_block() to read bmbt blocks which verifies the
current owner of the block against the parent inode of the bmbt.
This works during extent swap because the bmbt owners are updated to
the opposite inode number before the inode extent forks are swapped.

The modified bmbt blocks are marked as ordered buffers which allows
everything to commit in a single transaction. If the transaction
extent swap is required, log recovery restarts the bmbt scan to fix
up any bmbt blocks that may have not been written back before the
crash. The log recovery bmbt scan occurs after the inode forks have
been swapped, however. This causes the bmbt block owner verification
to fail, leads to log recovery failure and requires xfs_repair to
zap the log to recover.

Define a new invalid inode owner flag to inform the btree block
lookup mechanism that the current inode may be invalid with respect
to the current owner of the bmbt block. Set this flag on the cursor
used for change owner scans to allow this operation to work at
runtime and during log recovery.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Fixes: bb3be7e7c ("xfs: check for bogus values in btree block headers")
Cc: stable@vger.kernel.org
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: don't log dirty ranges for ordered buffers
Brian Foster [Wed, 18 Oct 2017 18:38:49 +0000 (13:38 -0500)] 
xfs: don't log dirty ranges for ordered buffers

Source kernel commit: 8dc518dfa7dbd079581269e51074b3c55a65a880

Ordered buffers are attached to transactions and pushed through the
logging infrastructure just like normal buffers with the exception
that they are not actually written to the log. Therefore, we don't
need to log dirty ranges of ordered buffers. xfs_trans_log_buf() is
called on ordered buffers to set up all of the dirty state on the
transaction, buffer and log item and prepare the buffer for I/O.

Now that xfs_trans_dirty_buf() is available, call it from
xfs_trans_ordered_buf() so the latter is now mutually exclusive with
xfs_trans_log_buf(). This reflects the implementation of ordered
buffers and helps eliminate confusion over the need to log ranges of
ordered buffers just to set up internal log state.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: remove the ip argument to xfs_defer_finish
Christoph Hellwig [Wed, 18 Oct 2017 18:38:49 +0000 (13:38 -0500)] 
xfs: remove the ip argument to xfs_defer_finish

Source kernel commit: 8ad7c629b18695ec1ee8654fb27599864049862b

And instead require callers to explicitly join the inode using
xfs_defer_ijoin.  Also consolidate the defer error handling in
a few places using a goto label.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: rename xfs_defer_join to xfs_defer_ijoin
Christoph Hellwig [Wed, 18 Oct 2017 18:38:49 +0000 (13:38 -0500)] 
xfs: rename xfs_defer_join to xfs_defer_ijoin

Source kernel commit: 882d8785fb87f691000a0b33c215364d74bd2ceb

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: refactor xfs_trans_roll
Christoph Hellwig [Wed, 18 Oct 2017 18:38:49 +0000 (13:38 -0500)] 
xfs: refactor xfs_trans_roll

Source kernel commit: 411350df14a3d6f1c769ea64a8b43a71f8d9760e

Split xfs_trans_roll into a low-level helper that just rolls the
actual transaction and a new higher level xfs_trans_roll_inode
that takes care of logging and rejoining the inode.  This gets
rid of the NULL inode case, and allows to simplify the special
cases in the deferred operation code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfs: stop searching for free slots in an inode chunk when there are none
Carlos Maiolino [Wed, 18 Oct 2017 18:38:49 +0000 (13:38 -0500)] 
xfs: stop searching for free slots in an inode chunk when there are none

Source kernel commit: 2d32311cf19bfb8c1d2b4601974ddd951f9cfd0b

In a filesystem without finobt, the Space manager selects an AG to alloc a new
inode, where xfs_dialloc_ag_inobt() will search the AG for the free slot chunk.

When the new inode is in the same AG as its parent, the btree will be searched
starting on the parent's record, and then retried from the top if no slot is
available beyond the parent's record.

To exit this loop though, xfs_dialloc_ag_inobt() relies on the fact that the
btree must have a free slot available, once its callers relied on the
agi->freecount when deciding how/where to allocate this new inode.

In the case when the agi->freecount is corrupted, showing available inodes in an
AG, when in fact there is none, this becomes an infinite loop.

Add a way to stop the loop when a free slot is not found in the btree, making
the function to fall into the whole AG scan which will then, be able to detect
the corruption and shut the filesystem down.

As pointed by Brian, this might impact performance, giving the fact we
don't reset the search distance anymore when we reach the end of the
tree, giving it fewer tries before falling back to the whole AG search, but
it will only affect searches that start within 10 records to the end of the tree.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agoxfsprogs: Release v4.13.1 v4.13.1
Eric Sandeen [Wed, 27 Sep 2017 01:45:05 +0000 (20:45 -0500)] 
xfsprogs: Release v4.13.1

Update all the necessary files for a 4.13.1 release.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
6 years agomkfs: don't overflow the subopts array
Darrick J. Wong [Wed, 27 Sep 2017 01:41:12 +0000 (20:41 -0500)] 
mkfs: don't overflow the subopts array

The new -d cowextsize option overran the subopts array; make it larger.

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>
6 years agoxfsprogs: Release v4.13.0
Eric Sandeen [Tue, 26 Sep 2017 16:42:43 +0000 (11:42 -0500)] 
xfsprogs: Release v4.13.0

Update all the necessary files for a 4.13.0 release.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agoxfsprogs: Release v4.13.0-rc2 v4.13.0-rc2
Eric Sandeen [Thu, 21 Sep 2017 22:04:22 +0000 (17:04 -0500)] 
xfsprogs: Release v4.13.0-rc2

Update all the necessary files for a 4.13.0-rc2 release.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agoxfs_repair: handle missing extent states
Darrick J. Wong [Thu, 21 Sep 2017 22:00:08 +0000 (17:00 -0500)] 
xfs_repair: handle missing extent states

Missed a couple of the new extent states in the bmbt processing, so add
them to avoid aborting xfs_repair.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen: move XR_E_REFC case above fallthrough to emit both do_warn]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agomkfs: pass a custom cowextsize into the created filesystem
Darrick J. Wong [Thu, 21 Sep 2017 22:00:01 +0000 (17:00 -0500)] 
mkfs: pass a custom cowextsize into the created filesystem

Create a -d option to mkfs.xfs that enables administrators to set
the CoW extent size hint on the created files.

[sandeen: Note, the switch to xfs_flags2diflags looks like
a bugfix, but it's not - the flags set by mkfs up to this
point just happened to line up without any translation.]

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>
7 years agoxfs_db: version command misses RMAPBT feature string
Zirong Lang [Thu, 21 Sep 2017 22:00:01 +0000 (17:00 -0500)] 
xfs_db: version command misses RMAPBT feature string

When I create a XFS with "rmapbt=1,reflink=1", "xfs_db -c version"
didn't show RMAPBT feature. But REFLINK can be found.

  # mkfs/mkfs.xfs -f -m rmapbt=1,reflink=1 /dev/sda3
  # db/xfs_db -c version /dev/sda3
  versionnum [0xb4a5+0x18a] = V5,NLINK,DIRV2,ALIGN,LOGV2,EXTFLG,MOREBITS,
                  ATTR2,LAZYSBCOUNT,PROJID32BIT,CRC,FTYPE,FINOBT,REFLINK

Signed-off-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agoxfsprogs: Release v4.13.0-rc1 v4.13.0-rc1
Eric Sandeen [Fri, 15 Sep 2017 19:03:32 +0000 (14:03 -0500)] 
xfsprogs: Release v4.13.0-rc1

Update all the necessary files for a 4.13.0-rc1 release.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agoxfs_repair: don't use do_warn for normal log message
Masatake YAMATO [Fri, 15 Sep 2017 18:42:18 +0000 (13:42 -0500)] 
xfs_repair: don't use do_warn for normal log message

In some case, exit status of xfs_repair -n is different even for
the same file system when -v is specified or not. This patch fixes
this behavior.

If -v is specified, do_warn() is used in zero_log() for printing
a normal message. That makes the exit status to 1 though there
is no dirtiness in the file system.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen: edit changelog for brevity]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
7 years agomkfs: add documentation for forgotten mkfs flags
Darrick J. Wong [Fri, 15 Sep 2017 13:34:10 +0000 (08:34 -0500)] 
mkfs: add documentation for forgotten mkfs flags

Add documentation for some undocumented mkfs -d and -l flags.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>