commit 4d9d2e48ceb9d3577ba09379993b30abc4957e38
Author: Dave Chinner <david@fromorbit.com> Date: Wed Jun 10 10:12:00 2015 +1000 xfsprogs: v3.2.3 release Update changelog and version files for upcoming release. Signed-off-by: Dave Chinner <david@fromorbit.com> commit aa131c930ba1ad80ed4d18228b5c3510207884e0 Author: Nathan Scott <nathans@debian.org> Date: Wed Jun 10 10:09:36 2015 +1000 xfsprogs: update deb packaging for upcoming release Update debian changelog file for upcoming release. Signed-off-by: Nathan Scott <nathans@debian.org> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 29358c93d5b31add99e5519f513b9ff8182515f5 Author: Dave Chinner <david@fromorbit.com> Date: Mon Jun 1 11:17:41 2015 +1000 xfsprogs: update for 3.2.3-rc2 release Update changelog and version files for upcoming release. Signed-off-by: Dave Chinner <david@fromorbit.com> commit 01914f06a1827e5dcc8093d1e6228d3e4ff5dc60 Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Mon Jun 1 11:17:39 2015 +1000 xfs_repair: ensure .. is set sanely when rebuilding dir When we're rebuilding a directory, ensure that we reinitialize the directory with a sane parent ('..') inode value. If we don't, the error return from xfs_dir_init() is ignored, and the rebuild process becomes confused and leaves the directory corrupt. If repair later discovers that the rebuilt directory is an orphan, it'll try to attach it to lost+found and abort on the corrupted directory. Also fix ignoring the return value of xfs_dir_init(). Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 0519f662c86a7a3396fc2eba079f180ac46cbf5e Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Mon Jun 1 11:17:09 2015 +1000 xfs_repair: better checking of v5 metadata fields Check the UUID, owner, and block number fields during repair, looking for blocks that fail either the checksum or the data structure verifiers. For directories we can simply rebuild corrupt/broken index data, though for anything else we have to toss out the broken object. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit a98b22b6a4135041e2a82b966cd7d8e606c2b958 Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Mon Jun 1 11:17:08 2015 +1000 xfs_repair: validate superblock against known v5 feature flags Apparently xfs_repair running on a v5 filesystem doesn't check the compat, rocompat, or incompat feature flags for bits that it doesn't know about, which means that old xfs_repairs can wreak havoc. So, strengthen the checks to prevent repair from "repairing" anything it doesn't understand. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Fanael Linithien <fanael4@gmail.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit d6cfd5aee844e7e11f4e313da370bbc4a4cec450 Author: Eric Sandeen <sandeen@redhat.com> Date: Wed May 27 08:43:02 2015 +1000 xfs_repair: properly detect reserved attribute names This function in xfs_repair tries to make sure that if an attr name reserved for acls exists in the root namespace, then its value is a valid acl. However, because it only compares up to the length of the reserved name, superstrings may match and cause false positive xfs_repair errors. Ensure that both the length and the content match before flagging it as an error. Spotted-by: Zach Brown <zab@zabbo.net> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit c8c08373e9e97de2d463fc6ba65ff89a5a2bb208 Author: Dave Chinner <david@fromorbit.com> Date: Mon May 11 10:46:06 2015 +1000 xfsprogs: update for 3.2.3-rc1 release Update changelog and version files for upcoming release. Signed-off-by: Dave Chinner <david@fromorbit.com> commit e24ee60b7466effcfac2edfc6395dabfabb4a559 Author: Dave Chinner <dchinner@redhat.com> Date: Mon May 11 10:09:22 2015 +1000 mkfs: inode/block size error messages confusing As reported by Brain: # ./mkfs/mkfs.xfs -f /dev/test/scratch -b size=512 illegal inode size 512 allowable inode size with 512 byte blocks is 256 # ./mkfs/mkfs.xfs -f /dev/test/scratch -b size=512 -i size=256 Minimum inode size for CRCs is 512 bytes Usage: mkfs.xfs ... Fix mkfs to catch the block size as being too small, rather than leaving it for inode size detection to enforce. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 566ebd5ae5fa4267c1789e72bc309207627220eb Author: Dave Chinner <dchinner@redhat.com> Date: Mon May 11 10:09:19 2015 +1000 mkfs: default to CRC enabled filesystems It's time to change the mkfs defaults to enable CRCs for all new filesystems. While there, also enable the free inode btree by default, too, as that functionality has also had long enough to make it into distro kernels, too. Also update the man page to reflect the change in defaults. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b7fc3b36048d8cbddc87047e036477e10de3765f Author: Eric Sandeen <sandeen@redhat.com> Date: Mon May 11 10:09:18 2015 +1000 xfs_db: report FINOBT in version output Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 52b83345ef60b3c7d4fd91fb671cbe3c69346c4b Author: Jan Ťulák <jtulak@redhat.com> Date: Mon May 11 10:09:16 2015 +1000 xfsprogs: Removing deprecated _BSD_SOURCE definition. In glibc 2.20, _BSD_SOURCE was deprecated in favor of _DEFAULT_SOURCE. _DEFAULT_SOURCE is included with _GNU_SOURCE, as well as _XOPEN_SOURCE >= 500, so the obsolete and unnecessary definitions are removed. For more details, see man 7 feature_test_macros for glibc >= 2.20. Signed-off-by: Jan Ťulák <jtulak@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 502544b47894ed564c3e2df69ceb02ea8fbc2d78 Author: Sage Weil <sage@redhat.com> Date: Mon Apr 13 09:33:50 2015 +1000 libhandle: add fd_to_handle to handle.h It's on the man page but strangely missing from the header. Signed-off-by: Sage Weil <sage@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 89b8d422b3d6a6dfe176aed67e5b3e164af20275 Author: Eric Sandeen <sandeen@redhat.com> Date: Mon Apr 13 09:33:49 2015 +1000 xfsprogs: remove unreachable code in libxfs_inode_alloc This code does: if (!ialloc_context && !ip) return; // if !ip here, ialloc_context must be true if (ialloc_context) { ... if (!ip) error = ENOSPC; if (error) return error; // if !ip in this block we've returned } // so (!ip) cannot be true here if (!ip) error = ENOSPC; (cherry picked this one out of Coverity reports) Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 609f6bb20b7972c1a68370faea1dcbcf39912e07 Author: Eric Sandeen <sandeen@redhat.com> Date: Mon Apr 13 09:33:47 2015 +1000 xfs_db: disallow sb UUID write on v5 filesystems Do not allow xfs_db (or the xfs_admin frontend) to change the UUID of a V5 filesystem; this will cause UUID mismatches across the filesystem, and we currently have no mechanism to update them all. Changing only the superblock UUID makes all other metadata look invalid, and xfs_repair reacts by junking everything. Addresses-Debian-Bug: 782012 Reported-by: F. Stoyan <fstoyan@swapon.de> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit fa8fb25abab9f2579e21ae86fdbc685b329f848d Author: Brian Foster <bfoster@redhat.com> Date: Mon Apr 13 09:33:46 2015 +1000 repair: only check secondary sb->sb_pquotino for v5 superblocks xfs_repair scans for garbage data beyond the last valid superblock field for the particular sb version in secondary_sb_wack(). If any non-zero data is detected, the entire range is reset to zero. Subsequently, various valid superblock fields are checked for valid/expected data. The sb_pquotino field is checked unconditionally as part of this sequence even though it is a v5 only field. As a result, repair complains about a non-null project quota field if any garbage data exists for a v4 secondary sb. This is reproduced by xfs/070 against a v4 superblock and is also easily reproduced manually as follows: $ mkfs.xfs -f -m crc=0 <dev> $ xfs_db -x -c "sb 3" -c "write lsn 1" <dev> $ xfs_repair <dev> ... zeroing unused portion of secondary superblock (AG #3) non-null project quota inode field in superblock 3 ... This occurs because the garbage data detection mechanism has reset sb->sb_pquotino to 0 while the validity check expects a value of NULLFSINO. Update secondary_sb_wack() to only check sb->sb_pquotino for validity on supers where it is a valid field. If it is anything other than 0 on pre-v5 superblocks, it is explicitly reset to 0 by the garbage data checks earlier in the function. Reported-by: Xing Gu <gux.fnst@cn.fujitsu.com> Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 9da36109f114bfee4ec98187fba32d9a0b9bc442 Author: Brian Foster <bfoster@redhat.com> Date: Tue Apr 7 10:04:11 2015 +1000 db/check: handle zero inoalignmt correctly for large block sizes The check command prints a spurious error when sb_inoalignmt is zero but the sb align feature bit is set: $ mkfs.xfs -f -bsize=16k <dev> $ xfs_db -c "check" <dev> sb versionnum extra align bit 80 This occurs because check determines whether to expect the alignment feature bit based on a non-zero inoalignmt (in init()). sb_inoalignmt of 0 is expected for block sizes that are large enough for at least one full inode record (64 inodes), however. For example, when bsize >= 16k on v4 filesystems or >=32k on v5 filesystems. Update the init() logic in the check command to detect this particular scenario. Set the in-memory feature bit if inoalignmt is zero and the block size is large enough for full inode records such that blockget_f() does not complain. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 31daa90b6eee2e3544a8e4ae92687d4cf01675d1 Author: Brian Foster <bfoster@redhat.com> Date: Tue Apr 7 10:04:11 2015 +1000 mkfs: don't zero old superblocks if file was truncated If the force overwrite option is passed to mkfs, we attempt to zero old superblock metadata on the mkfs target. We attempt to read the primary superblock to identify the secondary superblocks. If the mkfs target is a regular file, it is truncated on open and the secondary superblock zeroing operation returns a spurious and incorrect error message due to a 0-byte read: $ mkfs.xfs -f -d file=1,name=xfs.fs,size=32m ... existing superblock read failed: Inappropriate ioctl for device Fix the error reporting in zero_old_xfs_structures() to only print an error string if the pread() call returns an error. Warn the user if the read doesn't match the sector size. Finally, detect the case where we know we've already truncated a regular file and skip the sb zeroing. Reported-by: Alexander Tsvetkov <alexander.tsvetkov@oracle.com> Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bf43fd2819db4d0863c508335839678b03119962 Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Tue Apr 7 10:04:11 2015 +1000 libxfs: don't write uninitialized heap contents into new directory blocks Clear the contents of the xfs buffer when we're initializing it to avoid writing random heap contents (and CRC thereof) to disk. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit ba1c677644747b41cdc91691e282efe1090449da Author: Darrick J. Wong <darrick.wong@oracle.com> Date: Tue Apr 7 10:04:11 2015 +1000 xfs_repair: don't abort on bad directory leaf crc during leaf check longform_dir2_check_leaf() checks a directory leaf block to help decide if we need to rebuild the directory. If the verifier fails with a CRC or corrupt structure error, rebuild the directory instead of aborting. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 7d7c5553e3fdf8d65537037603372869ca19d5eb Author: Eric Sandeen <sandeen@sandeen.net> Date: Tue Apr 7 10:04:11 2015 +1000 xfs_repair: validate & fix inode CRCs xfs_repair doesn't ever check an inode's CRC, so it never repairs them. If the root inode or realtime inodes have bad crcs, the fs won't even mount and can't be fixed (without using xfs_db). It's fairly straightforward to just test the inode CRC before we do any other checking or modification of the inode, and just mark it dirty if it's wrong and needs to be re-written. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b8ec08a1346d3a52a4ac4d4a414fc36aae272ee7 Author: Eric Sandeen <sandeen@sandeen.net> Date: Tue Apr 7 10:04:11 2015 +1000 xfs_repair: don't clear . or .. in process_dir2_data process_dir2_data() has special . and .. processing; it is able to correct these inodes, so there is no reason to clear them. Do this before we adjust a length 0 filename to length 1, so that we don't take this action on an accidentally created "." name from a hidden dotfile. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit aedcecb505e99674f2168676e5f2942284085641 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 10:04:11 2015 +1000 xfs_repair: set *parent if process_dir2_data() fixes root inode process_dir2_data() may fix the root dir's parent inode: "bad .. entry in root directory inode 6912, was 7159: correcting" But we don't update the *parent passed in in that case; this then leads to an assert later in process_dir2: xfs_repair: dir2.c:2039: process_dir2: Assertion `(ino != mp->m_sb.sb_rootino && ino != *parent) || (ino == mp->m_sb.sb_rootino && (ino == *parent || need_root_dotdot == 1))' failed. Updating the value of *parent when we fix the parent value resolves this problem. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1f60de2849e6b383739ffd098f8a5d1def315ce6 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 10:04:11 2015 +1000 xfs_repair: clear need_root_dotdot if we rebuild the root dir It's possible to enter longform_dir2_rebuild with need_root_dotdot set; rebuilding it will add "..", and if need_root_dotdot stays set, we'll add another ".." entry, causing a second repair to find and fix that problem. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 0402beabb94d4f25ee29f28f2b76898505a02eb6 Author: Eric Sandeen <sandeen@sandeen.net> Date: Tue Apr 7 10:04:08 2015 +1000 libxfs: remove ASSERT on ftype read from disk This one is already fixed in the kernel, with fb04013 xfs: don't ASSERT on corrupt ftype but that kernel<->userspace merge is still pending. In the meantime, just fix it as a one-off here, because ASSERTing on bad on-disk values when running xfs_repair is a very unfriendly thing to do. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 38c66abcbc80dbc89470c071eba0c0e87516aa8d Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 09:20:15 2015 +1000 xfs_repair: remove last-entry hack in process_sf_dir2 process_sf_dir2() tries to special-case the last entry in a short form dir, and salvage it if the name length is wrong by using the dir size as a clue to what the length should be. However, this doesn't actually work; there is either a 32-bit or 64-bit inode after the name, and with dirv3 there's a file type in there as well. Extending the name length to the dir size means it overlaps these fields, which often have a 0 in the top bits, and then namecheck() fails the result and junks it anyway: > entry #1 is zero length in shortform dir 67, resetting to 29 > entry contains illegal character in shortform dir 67 > junking entry "bbbbbbbbbbbbbbbbbbbbbbbb" in directory inode 67 And depending on the corruption, the current code will set a new negative namelen if it turns out that the name itself starts beyond dir size; it can't be shortened enough. So, we could fix this up, and choose a new namelen such that the xfs_dir2_ino8_t and/or xfs_dir2_ino8_t and/or file type still fits at the end, but we really seem to be reaching the point of diminishing returns. The chances that nothing but the name length is wrong, and that the remaining few bytes at the end of the dir size are actually correct, seems awfully small. Therefore just remove this special case, which I think is of questionable value. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1c934a2590c587707209583d962957bc8645afcb Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 09:20:07 2015 +1000 xfs_repair: collapse 2 cases in process_sf_dir2 process_sf_dir2() has 2 cases for a bad namelen: on-disk namelen is 0, or on-disk namelen extends beyond the directory i_size. After the prior 2 patches, the code for each case is now essentially the same, so collapse the two cases. Note, this does slightly change some of the error messages. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1633febd85a77a88512f216da5d804f24cd64d86 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 09:19:59 2015 +1000 xfs_repair: remove impossible tests in process_sf_dir2 We're testing for an impossible case in here: if (i == num_entries - 1) { ... } else { ... if (i == num_entries - 1) /* can't happen! */ ... } So, remove the impossible case. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit cbd361be7e2b9b01906a1630880a0ee854c22d43 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 09:19:51 2015 +1000 xfs_repair: dirty inode in process_sf_dir2 if we change namelen There are two "fix sfep->namelen" cases, but we only mark *dino_dirty = 1 in one of them. Add the other to ensure that the change gets written out. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 6367f2a3cbad8ac54b19da55ba44106871e44268 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Apr 7 09:19:41 2015 +1000 xfs_db: nlink fields are valid for di_version == 3, too Printing inodes with di_version == 3 skips the nlink fields, because they are only printed if di_version == 2. This was intended to separate them from di_version == 1, but it mistakenly excluded di_version == 3, which also contains these fields. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b335ecb53b5bd31af939798d5e93daadeae44014 Author: Eric Sandeen <sandeen@sandeen.net> Date: Tue Apr 7 09:19:28 2015 +1000 xfs_db: fix inode CRC validity state, and warn on read if invalid Currently, the "ino_crc_ok" field on the io cursor reflects overall inode validity, not CRC correctness. Because it is only used when printing CRC validity, change it to reflect only that state - and update it whenever we re-write the inode (thus updating the CRC). In addition, when reading an inode, warn if the CRC is bad. Note, when specifying an inode which doesn't actually exist, this will claim corruption; I'm not sure if that's good or bad. Today, it already issues corruption errors on the way; this adds a new message as well: xfs_db> inode 129 Metadata corruption detected at block 0x80/0x2000 Metadata corruption detected at block 0x80/0x2000 ... Metadata CRC error detected for ino 129 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit c9f5e3db2209878abdf52d89e5532fe378dfaf15 Author: Eric Sandeen <sandeen@sandeen.net> Date: Tue Apr 7 09:19:04 2015 +1000 xfs_db: Allow writes of corrupted data Being able to write corrupt data is handy if we wish to test repair against specific types of corruptions. Add a "-c" option to the write command which allows this by removing the write verifier. Note that this also skips CRC updates; it's not currently possible to write invalid data with a valid CRC; CRC recalculation is intertwined with validation. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 8bc43a39facea94cc276df86956f4e6bf1ad05f6 Author: Dave Chinner <dchinner@redhat.com> Date: Wed Mar 18 15:10:09 2015 +1100 repair: superblock buffers need to be sector sized In secondary_sb_wack() we zero the unused portion of both the on-disk superblock and the in-memory copy that we have. When the device sector size is 4k, this causes xfs_repair to crash like so: # xfs_repair /dev/ram1 Phase 1 - find and verify superblock... Phase 2 - using internal log - zero log... - scan filesystem freespace and inode maps... bad magic number bad on-disk superblock 3 - bad magic number primary/secondary superblock 3 conflict - AG superblock geometry info conflicts with filesystem geometry zeroing unused portion of secondary superblock (AG #3) # The stack trace is indicative: #0 memset () #1 0x000000000040404b in secondary_sb_wack #2 verify_set_agheader #3 0x0000000000427b4b in scan_ag #4 0x000000000042a2ca in worker_thread #5 0x00007ffff77ba0a4 in start_thread #6 0x00007ffff74efc2d in clone Which points at memset overrunning the in memory buffer, as it is only 512 bytes in length. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bd76b93e4315982575f78f3e68238396ff636dee Author: Dave Chinner <dchinner@redhat.com> Date: Tue Feb 24 15:05:25 2015 +1100 mkfs: log stripe unit fails to influence default log size This fails on a 4GB, 4k physical sector size device: # mkfs.xfs -f -l version=2,su=256k /dev/ram1 log size 2560 blocks too small, minimum size is 3264 blocks .... The combination of 4k sectors and a log stripe unit increase the minimum size of the log. We should be automatically calculating an appropriate, valid log size when the user does not specify it. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 0ab7cbc83f59c8aea8cdc98454a978848af6a41a Author: Brian Foster <bfoster@redhat.com> Date: Tue Feb 24 11:20:31 2015 +1100 metadump: check for non-zero inode alignment The copy_inode_chunk() function performs some basic sanity checks on the inode record, block number, etc. One of these checks includes whether the inode chunk is aligned according to sb_inoalignmt. sb_inoalignment can equal 0 with larger block sizes. This results in a mod-by-zero, "badly aligned inode ..." warnings and skipped inodes in metadump images. This can be reproduced with a '-m crc=1,finobt=1 -b size=64k' fs on ppc64. Update copy_inode_chunk() to only enforce the inode alignment check when sb_inoalignmt is non-zero. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 39fe84affd9c3773235fc66f7050c43babc125b8 Author: Brian Foster <bfoster@redhat.com> Date: Tue Feb 24 11:19:31 2015 +1100 metadump: include NULLFSINO check in inode copy code The copy_ino() function includes a check for effectively NULL inode numbers. It checks for 0 but does not include NULLFSINO. This leads to spurious warnings in some instances. For example, copy_ino() is called unconditionally for sb quota inodes from copy_sb_inodes(), values of which can be NULLFSINO. Check for NULLFSINO and return quietly from copy_ino(). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 5c6afe94262439357b79c2aacccbe09cecef9fd1 Author: Namjae Jeon <namjae.jeon@samsung.com> Date: Tue Feb 24 11:19:13 2015 +1100 xfsprog: xfsio: update xfs_io manpage for FALLOC_FL_INSERT_RANGE Update xfs_io manpage for FALLOC_FL_INSERT_RANGE. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bf988de3b606c646003224e77a091735c24e61b1 Author: Eric Sandeen <sandeen@redhat.com> Date: Fri Feb 6 10:35:50 2015 +1100 xfs_quota: manpage - project command requires arguments The xfs_quota man page states that the "project" command without arguments will list all project names and identifiers, but it has never done this; the project_f command has always been defined as requiring at least one argument. Fix the man page to reflect reality. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit ece49daeff1a3cad765e106d678c608925c9d768 Author: Romain Naour <romain.naour@openwide.fr> Date: Fri Feb 6 10:35:13 2015 +1100 xfsprogs: do not do any dynamic linking of libtool libraries if --disable-static and --enable-shared are given on the command line, the link with xfsprogs's internal libraries fail because they have been dynamically compiled. Hence the following error: ld: attempted static link of dynamic object `../libxcmd/.libs/libxcmd.so' xfsprogs rely on the original behaviour of -static which was modified in Buildroot by [1]. But since commit [2] the build of xfsprogs tools is broken because they try to link statically with the static libuuid library (util-linux), which is not build for shared only build. The use of -static-libtool-libs allows to fallback to the dynamic linking for libuuid only: LD_TRACE_LOADED_OBJECTS=1 xfs_copy linux-gate.so.1 => (0xf7793000) libuuid.so.1 => /lib/libuuid.so.1 (0x465e1000) libpthread.so.0 => /lib/libpthread.so.0 (0x46db1000) librt.so.1 => /lib/librt.so.1 (0x46f21000) libc.so.6 => /lib/libc.so.6 (0x46bf1000) /lib/ld-linux.so.2 (0x46bce000) [1] http://git.buildroot.net/buildroot/commit/?id=97703978ac870ce2b14ad144f8e082de82aa2c64 [2] http://git.buildroot.net/buildroot/commit/?id=f1d3e09895b245da9d54bbaef36e5de95269034e Signed-off-by: Romain Naour <romain.naour@openwide.fr> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 48e75fb61d54962b1838a018e682742d2c920911 Author: Eric Sandeen <sandeen@redhat.com> Date: Fri Feb 6 10:35:12 2015 +1100 xfs_quota: fix typo in manpage Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit ca0a799ea95aceca7eda2c89d7a06549a4333cab Author: Brian Foster <bfoster@redhat.com> Date: Fri Feb 6 10:32:32 2015 +1100 repair: check ino alignment value to avoid mod by zero xfs_repair checks inode records for valid alignment according to the alignment specified in the superblock. It currently performs the alignment check whenever fs_aligned_inodes is set, which is determined based on whether the fs supports the field. Support for the field does not guarantee its value is non-zero, however. For example, a large block size fs on a large page size arch (e.g., ppc64): mkfs.xfs -f -m crc=1,finobt=1 -b size=64k <dev> ... can lead to incorrect badly aligned inode record messages from xfs_repair and other problems. Update the inobt and finobt checks to verify that alignment is a non-zero value before attempting to use it to divide (mod) by zero. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 16e16276896509e05330f7bff988bdfb1130c89b Author: Brian Foster <bfoster@redhat.com> Date: Fri Feb 6 10:31:44 2015 +1100 repair: fix v5 sb ino alignment calculation for large blocksizes xfs_repair validates the superblock inode alignment field against several possible valid values. On v5 superblocks, the inode alignment can be scaled up based on the inode size in relation to the minimum inode size. If the block size is larger than the default cluster size (consider large page size arches such as ppc64), the initial alignment value calculates to zero. If the inode size is large enough such that sb_inoalignmt is not zero, sb_validate_ino_align() scales the align value by the factor of inode size increase. If align is zero, however, we multiply by zero, the subsequent check incorrectly fails and the overall superblock verification fails as well. To reproduce, format an fs as follows on ppc64 and run xfs_repair: mkfs.xfs -f -m crc=1 -b size=64k -i size=2k <dev> Fix the scaled alignment calculation by scaling the default cluster size appropriately to avoid a multiplication by zero. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 89c4bb8eb3de54aaeb523b8862c9cf6de73d1984 Author: Eric Sandeen <sandeen@sandeen.net> Date: Fri Feb 6 10:30:57 2015 +1100 libxfs: report VERSION in libxfs_fs_repair_cmn_err() Because this is usually the first question asked... Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 555bc8ccc92fdf2eae425fbdcbde7d6c1d4f97a4 Author: Namjae Jeon <namjae.jeon@samsung.com> Date: Fri Feb 6 10:29:18 2015 +1100 xfs_io: add finsert command for insert range Add finsert command for fallocate FALLOC_FL_INSERT_RANGE flag. Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 8216a58f8e709b0eade780c989b05f426b729ea0 Author: Brian Foster <bfoster@redhat.com> Date: Fri Feb 6 10:28:52 2015 +1100 repair: remove unused strided secondary sb scan logic verify_set_primary_sb() scans and verifies secondary superblocks based on the primary sb. It currently defines a maximum number of 8 superblocks to scan per iteration. It also implements a strided algorithm that appears intended to ultimately scan every secondary, albeit in a strided order. Given that the algorithm is written to hit every sb and the stride value is initialized as follows: num_sbs = MIN(NUM_SBS, rsb->sb_agcount); skip = howmany(num_sbs, rsb->sb_agcount); ... which is guaranteed to be 1 since the howmany() parameters are backwards, the strided algorithm doesn't appear to accomplish anything that can't be done with a simple for loop. In other words, despite the max value and strided algorithm, repair always scans all of the secondary superblocks in incremental order. Therefore, remove the strided algorithm bits and replace with a simple for loop. As a result of this cleanup, also remove the 'checked' buffer used to track repeated ag visits and the now unused NUM_SBS definition. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 6d23d9a5dad9003d3b4e8e970c393f90a137d10d Author: Brian Foster <bfoster@redhat.com> Date: Fri Feb 6 10:28:00 2015 +1100 repair: fix unnecessary secondary scan if only last sb is corrupt verify_set_primary_sb() scans the secondary superbocks based on the geometry specified in the primary and determines the most likely correct geometry by tracking how many superblocks are consistent across the set. The most frequent geometry is copied into the primary superblock. The return value is checked by the caller (phase1()) to determine whether a brute force secondary scan is necessary. This generally occurs when not enough secondary sb's are consistent to declare the geometry correct. If enough secondaries are consistent, verify_set_primary_sb() returns the status of the last secondary sb that was scanned. Corruptions to secondary supers other than the last are thus resolved fine. If the last secondary is corrupt, however, an error is returned to phase1(). This causes a brute force scan even if enough supers were found to repair the last secondary. Move the initialization of retval to after the sb scan to return an error only if not enough secondary supers were found to declare a correct geometry. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 7511a9cf1f6e5e49d5c86c6d0f8e1bccfff912a2 Author: Eric Sandeen <sandeen@sandeen.net> Date: Fri Feb 6 10:25:13 2015 +1100 xfs_repair: fix max block offset test Eryu pointed out that in fstest xfs/071, we find corruption reported at the end. This test attempts to do IO at the maximum possible offsets, and repair yields: inode 1027 - extent offset too large - start 70, count 1, offset 2251799813685247 correcting nextents for inode 1027 bad data fork in inode 1027 would have cleared inode 1027 Repair is complaining that an extent *starts* at the maximum block, but AFAICT, starting there is just fine, as long as we also end there. i.e. a one-block extent at the limit is just fine. So change the xfs_repair test to allow this situation. Also, the warning text is a bit unclear, mixing in the physical block w/ the logical block... rearrange that a little to make it obvious. Reported-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 2116b6a6714586e6775fd20337efa54968d08250 Author: Eric Sandeen <sandeen@sandeen.net> Date: Fri Feb 6 10:24:36 2015 +1100 xfs_repair: do not check symlink component lengths As reported by Andy Grimm, # ln -s $( python -c 'print "a" * 260' ) /mnt/foo will succeed on xfs, but then xfs_repair will complain: component of symlink in inode 131 too long problem with symbolic link in inode 131 would have cleared inode 131 The kernel checks the total length of the symlink on both read and write, but does not look at component paths. Looking around the kernel, no other filesystem checks component lengths, nor does the vfs. And as Andy points out, the target could even be on a different filesystem, with different limitations. And having a "too-long" component doesn't even seem like something likely to stem from disk corruption anyway, so I'm not sure why repair should care. Therefore I propose removing the component length checks from xfs_repair. Andy Grimm <agrimm@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 247d903c1444e502f17747e6a7d323f1671690b5 Author: Dave Chinner <david@fromorbit.com> Date: Thu Dec 4 07:56:44 2014 +1100 xfsprogs: v3.2.2 release Update all the version and changelog files for release. Signed-off-by: Dave Chinner <david@fromorbit.com> commit 5292eb5188a27fdb9cbfd9a82a8f997e44cde8b0 Author: Brian Foster <bfoster@redhat.com> Date: Tue Dec 2 10:31:11 2014 +1100 repair: fix crash on zero record finobt reconstruction The inode btrees are reconstructed in phase 5. init_ino_cursor() helps determine the block requirements of the tree based on the number of records. If the finobt is empty, we can crash in the btree blocks calculation code due to a divide-by-zero error in the following line: lptr->modulo = num_recs % lptr->num_blocks; This occurs if num_recs and in-turn lptr->num_blocks evaluate to zero. We already have an execution path for the zero record btree scenario. However, it is only invoked when no records are found in the in-core tree. The finobt zero-record scenario can occur with a populated in-core tree provided that none of the existing records contain free inodes. Move the zero-record handling code after the loop and use the record count to trigger it. This is safe because the loop iterator checks for ino_rec != NULL. This allows reuse of the same code regardless of whether the in-core tree is empty or non-empty but contains no records that meet the requirements for the particular on-disk tree under reconstruction (e.g., finobt). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 263b53767a3df33f392262f539bfb35ec578f5e5 Author: Eric Sandeen <sandeen@redhat.com> Date: Thu Nov 13 10:02:22 2014 +1100 xfs_copy: simplify first_agbno calculation After ffe9a9a xfsprogs: xfs_copy: fix data corruption of target, xfs_copy started hitting an ASSERT for a 4k sector / 4k blocksize filesystem: # dd if=/dev/zero of=test.img bs=1M count=1024 # mkfs.xfs -s size=4096 test.img # xfs_copy test.img xfs.img xfs_copy: xfs_copy.c:720: main: Assertion `((((((xfs_daddr_t)(3 << (mp)->m_sectbb_log)) + 1) * (1<<9)) + first_residue) % source_blocksize) == 0' failed. Aborted I started digging through all the calculations below, and realized that in the end, all it wants is the first filesystem block after the AG header. XFS_AGFL_BLOCK(mp) + 1 suffices for this purpose; rip out the rest which seems overly complex and apparently bug-prone. I tested this by creating a 4g filesystem with combinations of sector & block size between 512 and 4k, copying in /lib/modules, running an xfs_copy of that, and running repair against the copy; it all looks good. It took a long time, but I will create a simpler/shorter xfstest based on this. Reported-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b83be57a16453bf7dda083ceab3619230c4399e5 Author: Nathan Scott <nathans@debian.org> Date: Thu Nov 13 10:02:05 2014 +1100 packaging: update deb changelog for upcoming release Add list of resolved issues from merged patches into the debian/changelog for processing with the next release. Signed-off-by: Nathan Scott <nathans@debian.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> commit 12a995c834d37a45e1ee023d17cbaa364fc3bf01 Author: Nathan Scott <nathans@debian.org> Date: Thu Nov 13 10:01:56 2014 +1100 packaging: clarify xfs header licensing within deb builds Tackles bug #751511 - ensuring the licensing information in the debian/copyright file matches reality. Use explanation that Christoph Hellwig came up with, pretty much verbatim. Signed-off-by: Nathan Scott <nathans@debian.org> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 37754344f0fb84a201c906c771c1b64ea16a89fc Author: Nathan Scott <nathans@debian.org> Date: Thu Nov 13 10:01:35 2014 +1100 packaging: rework dh_autoreconf invocation for deb builds Reviewed, tested and merged the final iteration of proposed solutions to #757455 - resolving configure-script-generation for clean ppc64le builds, originally. Many thanks to Andreas Barth and Matthias Klose for coming up with this solution. Signed-off-by: Nathan Scott <nathans@debian.org> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 9851fd79bfb16032480c09644b8d0d9649c798e4 Author: Dave Chinner <dchinner@redhat.com> Date: Fri Nov 7 10:01:00 2014 +1100 repair: AGFL rebuild fails if btree split required In phase 5 we rebuild the freelist btrees, the AGF and the AGFL from all the free space information we have gathered and resolved during pahses 3 and 4. If the freespace information is laid out just right, we end up having to allocate free space for the AGFL blocks. If the size of the free space we allocate from is larger than the space we need, then we have to insert the remainder back into the freespace btree. For the by-size tree, this means we are likely to be removing a record from one leaf, and then inserting the remainder - a smaller size - into another leaf. The issue is that the leaf blocks to the left of the original leaf block we removed the extent record from are full and hence require a split to insert the new record. That, of course, requires a free block in the AGFL to allocate from, and now we have a chicken and egg situation: there are no free blocks in the AGFL because we are setting it up. As a result, setting up the free list silently fails, leaving the freespace btrees in an inconsistent state and the AGFL in question empty. When the filesystem is next mounted, the first allocation from that AGF results in attempting to fix the AGFL, and it then does exactly the same thing as the repair code, fails to allocate a block during the split and fails. This results in an immediate shutdown because the transaction doing the allocation is dirty by this stage. The fix for the problem is to make repair handle rebulding the btree differently. If we leave ispace for a couple of records in each btree leaf and node, there is never a need for a split to occur when initially setting up the AGFL. This results in repair doing the right thing, and hence the runtime problems after mount don't occur. Further, add error checking the the AGFL setup code and abort repair if we have a failure to correctly set up the AGFL so we catch this problem at repair time, not mount time... Reported-by: Barkley Vowk <bvowk@box.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 7c7c113cfa288cbc6770377182261467a6457a5e Author: Dave Chinner <dchinner@redhat.com> Date: Wed Oct 29 16:35:22 2014 +1100 repair: fix XR_BLD_FREE_TRACE compilation errors Obviously hasn't been used for quite some time, so fix the build problems and make it useful again. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 392e896e41fdaffd6fcc51e270a61b91bf9ff2fe Author: Eric Sandeen <sandeen@sandeen.net> Date: Wed Oct 29 16:35:02 2014 +1100 mkfs: don't warn about log sunit size if it was auto-discovered Today, users doing a bare mkfs on storage with a large default stripe size may be surprised to get this warning: log stripe unit (%d bytes) is too large (maximum is 256KiB log stripe unit adjusted to 32KiB through no fault of their own. The fallback is appropriate and harmless, and there's no need to warn about this in the defaults case. However, we keep the warning if a large log stripe unit was specified by the user on the commandline. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit e21c11e3bac9d37fa404ae28b36bac6989b1623b Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Oct 29 16:34:38 2014 +1100 mkfs: ignore stripe geom if sunit or swidth == physical sector size Today, this geometry: # modprobe scsi_debug opt_blks=2048 dev_size_mb=2048 # blockdev --getpbsz --getss --getiomin --getioopt /dev/sdd 512 512 512 1048576 will result in a warning at mkfs time, like this: # mkfs.xfs -f -d su=64k,sw=12 -l su=64k /dev/sdd mkfs.xfs: Specified data stripe width 1536 is not the same as the volume stripe width 2048 because our geometry discovery thinks it looks like a valid striping setup which the commandline is overriding. However, a stripe unit of 512 really isn't indicative of a proper stripe geometry. Prior to this patch, we reset only sunit *or* swidth, if either was equal to physical block size, but not necessarily both. Change the heuristic so that if either the discovered sunit or the discovered swidth is physical block size, we reset *both* to zero and ignore the geom completely. While we're at it, don't pass &dummy in for multiple arguments to blkid_get_topology(); that'll mean that inside the function, the last assignment wins, and could lead to unexpected results. Reported-by: Stan Hoeppner <stan@hardwarefreak.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit c7dd81c7cd77b3a2432899063f333d2b8322fcdc Author: Eric Sandeen <sandeen@sandeen.net> Date: Wed Oct 29 16:33:49 2014 +1100 xfs_io: add sync and syncfs commands There's no easy way to invoke syncfs from the commandline, as far as I know, so add it to xfs_io to be handy. Add sync while we're at it, just for completeness. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> create mode 100644 io/sync.c commit 24e0479118fbef8d28e19011a2896c81e7a95d25 Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Oct 29 16:33:34 2014 +1100 xfsprogs: two more completely harmless sparse nits Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 167d49cb17004fe1ce6382c8bb4722353917233e Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Oct 29 16:33:15 2014 +1100 libxfs: fix harmless sparse endian nit h_crc is __le32 but cpu_to_be32() is... __be32. So sparse complains, even though it's harmless. Although sparse is smart about bare 0s, and we could drop the swap, other places explicitly swap to keep things clear (I guess?) so "swap" the 0 with the proper routine. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 3e1e6f8409798805627712dbb1659d37e3ea7d3d Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Oct 29 16:32:54 2014 +1100 libxfs: fix endian mishap in xfs_dialloc_ag() Fixes a regression introduced by: 88fc730 xfs: use and update the finobt on inode allocation which passed the non-swapped version of agi->agi_newino to xfs_inobt_lookup() Caught by make C=2, ftw! Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 5b547f3b3e461194e2db303e5527d363b703b2dd Author: Mark Tinguely <tinguely@sgi.com> Date: Wed Oct 29 16:31:30 2014 +1100 xfsctl.3: fix XFS_IOC_FSSETXATTR fields The xfsctl manual page fails to mention that fsx_projid is a setable field. Signed-off-by: Mark Tinguely <tinguely@sgi.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bd9cc49a7a29070b9fbead903ee4925b61e1baee Author: Eric Sandeen <sandeen@sandeen.net> Date: Wed Oct 29 16:29:53 2014 +1100 libxfs: use structure initializers for cache_operations This makes it a lot easier for cscope etc. Surely all modern compilers can cope? Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 794b62f68063d3af74ab7e79a9d7049887ec3ece Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:23:45 2014 +1000 xfsprogs: add supported file attributes to xfs.5 manpage The chattr(1) manpage suffers from the same problems mount(1) had: many options listed, not kept up to date for various filesystems. I've submitted a manpage update for chattr(1) which says to refer to filesystem-specific manpages for supported attributes; this patch updates xfs(5) to list the attributes supported by xfs. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 4f20f6a3a96a6f363190c14e6dd8c1de8d3702f9 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:23:41 2014 +1000 xfs_io: add mremap command This adds a simple mremap command to xfs_io. It does not take a start address; it uses the existing start address, so the sized passed will be the new total size of the mapping. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 50aeb09de6b7263912f68e061e8fdbe417592e3d Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:23:40 2014 +1000 xfs_repair: preserve error state in process_shortform_attr process_shortform_attr uses the "junkit" error to track whether an error was found, but by assigning it directly to the result of valuecheck, previous errors are ignored, leading to unrepairable errors of the form i.e. "entry has INCOMPLETE flag on in shortform attribute" or "entry contains illegal character in shortform attribute name" Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 5cd0710a8378a384c49d8c1d9a64f58b391a5dd5 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:23:39 2014 +1000 xfs_repair: clear bad flags in process_dinode_int process_dinode_int() reports bad flags if dino->di_flags & ~XFS_DIFLAG_ANY - i.e. if any flags are set outside the known set. But then instead of clearing them, it does flags &= ~XFS_DIFLAG_ANY which keeps *only* the bad flags. This leads to persistent, unrepairable errors of the form: "Bad flags set in inode XXX" Fix this. While we are at it, fix a couple lines which look like they used to be continuation lines, but are no longer. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 9c1c2e3257199a115b72154c856d8c62e76fca46 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:19:37 2014 +1000 xfs_db: free flist on error in write_struct() One error path in write_struct() wasn't freeing the flist_t *fl which was allocated, so it leaks. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 70ac12f8025e28c99b0884ace402e0802aa4d0b5 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:19:24 2014 +1000 xfs_io: fix leaks in parent_list() parent_list() has instances where a handle is leaked, both by going out of scope, and on error paths. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 8f1c8e13fc8db6e7879a8372e33b8720d4de7b9e Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:19:08 2014 +1000 libhandle: Fix handle leak in path_to_fshandle error paths path_to_fshandle calls obj_to_handle, which potentially allocates a handle, but the handle isn't freed on a subsequent error path. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit e3e2793db20651c1a0f34f0986f58f85c38afb68 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:18:56 2014 +1000 xfs_fsr: free handlep in fsrfs We leaked the fshandlep in both error returns and normal function exit. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 4f10a2fb156fe658ecaf1ae558fd7fc9e821527c Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:18:41 2014 +1000 xfs_fsr: fix leaks & catch error in fsrfile() The allocated fshandlep leaks on most error paths; restructure with an out: target that does all necessary freeing, and initialize filehandles to -1 so that we know whether they need to be closed on the error path. While we're at it, if gettmpname() fails, we still return 0 for an error, because error is initialized to 0 and only set otherwise by fsrfile_common. So if gettmpname() fails, we return success from the function even though we did no work. Fix that as well by initializing error to -1. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 713ba3f2c7f6d28a78df4e774cb8c3bd9ff12154 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue Sep 16 09:18:21 2014 +1000 xfs_io: free fshandlep in parent_check() The allocated fshandle wasn't freed in either normal exit or error paths. Do this, and consolidate cleanup into an out: target. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 4263df558fbe4ceac769f0db530d6e277e005e9e Author: Mark Tinguely <tinguely@sgi.com> Date: Tue Sep 16 09:17:46 2014 +1000 mkfs: fix typo in output Fix typo in xfs.mkfs output. Signed-off-by: Mark Tinguely <tinguely@sgi.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 937ef315ac6c7301de505f00fa956bc7357a6858 Author: Jan Kara <jack@suse.cz> Date: Tue Sep 16 09:16:44 2014 +1000 repair: Set ftype for entries in lost+found So far all entries in lost+found had file type XFS_DIR3_FT_UNKNOWN which is somewhat annoying as the next xfs_repair pass will find these and report as an error. Set proper file type when creating these entries. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 02ef5434f3f0db4653f6c9e235cd52fa5a29de60 Author: Jan Tulak <jan@tulak.me> Date: Mon Aug 18 11:11:06 2014 +1000 libhandle: fix installation for symlinked /usr Canonicalize the pathnames for PKG_LIB_DIR and PKG_ROOT_LIB_DIR before checking if they are the same. This is required for Fedora which doesn't have a separate /usr/lib directory anymore. [Christoph Hellwig: reformat and change to canonical names] Reported-by: Jan Tulak <jan@tulak.me> Signed-off-by: Jan Tulak <jan@tulak.me> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit ba24eb7c8288b1b21cbf00146a6740b2d3fd3128 Author: Jan Kara <jack@suse.cz> Date: Fri Jul 18 10:47:11 2014 +1000 logprint: Fix printing of AGF and AGI buffers Currently xfs_logprint doesn't show detailed data about AGF and AGI buffers and instead always shows "Out of space". This is because xfs_agf_t has additional fields and padding which we never read from disk and thus buffer length is always smaller than the size of xfs_agf_t or xfs_agi_t respectively. Fix the problem by only making sure we have enough data in the buffer to contain all the information we want to print. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit a14d40939de7d38029f99c10bc237bb68e83d119 Author: Jie Liu <jeff.liu@oracle.com> Date: Wed Jul 16 13:54:47 2014 +1000 quota: fix NULL pointer dereference in report_f Run xfs_quota report against an invalid XFS path without desired quota limitation is enabled will hit SEGSEGV as fs_path is uninitialized, e.g. # xfs_quota -xc 'report -up' /invalid_path xfs_quota: cannot setup path for mount /invalid_path: No such file or directory Segmentation fault (core dumped) (gdb) r -xc 'report -up' /invalid_path xfs_quota: cannot setup path for mount /invalid_path: No such file or directory Program received signal SIGSEGV, Segmentation fault. 0x0000000000408b4d in report_f (argc=2, argv=0x105ea70) at report.c:627 627 else if (fs_path->fs_flags & FS_MOUNT_POINT) This patch fixes report_f() to only do report if the fs_path is initialized. Signed-off-by: Jie Liu <jeff.liu@oracle.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit ed350fc6c49155ec398866ebef1d59be02636bce Author: Eric Sandeen <sandeen@sandeen.net> Date: Wed Jul 16 13:53:47 2014 +1000 libxcmd: make all comparisons using realpath'd paths Both mountpoints and devices can be symlinks, so given a path to look for, and mountpoints/devices from the system, use realpath() on *everything* before making the comparison to see if our path is a match. So, with symlinks for mount points as well as for devices: # ls -l /dev/mapper/testvg-lvol0 lrwxrwxrwx. 1 root root 7 Jul 11 19:24 /dev/mapper/testvg-lvol0 -> ../dm-3 # ls -l /mnt/scratch2 lrwxrwxrwx. 1 root root 12 Jul 11 19:57 /mnt/scratch2 -> /mnt/scratch this should all work, and does now: # xfs_quota -xc "report -h" /mnt/scratch2 User quota on /mnt/scratch (/dev/mapper/testvg-lvol0) Blocks User ID Used Soft Hard Warn/Grace ---------- --------------------------------- root 0 0 0 00 [------] # xfs_quota -xc "report -h" /mnt/scratch User quota on /mnt/scratch (/dev/mapper/testvg-lvol0) Blocks User ID Used Soft Hard Warn/Grace ---------- --------------------------------- root 0 0 0 00 [------] # xfs_quota -xc "report -h" /dev/dm-3 User quota on /mnt/scratch (/dev/mapper/testvg-lvol0) Blocks User ID Used Soft Hard Warn/Grace ---------- --------------------------------- root 0 0 0 00 [------] # xfs_quota -xc "report -h" /dev/mapper/testvg-lvol0 User quota on /mnt/scratch (/dev/mapper/testvg-lvol0) Blocks User ID Used Soft Hard Warn/Grace ---------- --------------------------------- root 0 0 0 00 [------] The commit: 050a7f1 xfsprogs: handle symlinks etc in fs_table_initialise_mounts() tried to fix this earlier, but only worked one way; it compared the argument path in both given and realpath form to the paths in getmntent, but did not compare to the realpaths of the getmntent devices. If we reduce everything, everywhere, to a realpath(), we've got our best shot at finding the match. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 6bf4721d47d9755029a7ec944af2832bd115a851 Author: Eric Sandeen <sandeen@redhat.com> Date: Wed Jul 16 13:52:47 2014 +1000 repair: copy, don't clear, stripe geometry in backup SB Today, if we have a filesystem with stripe geometry and a damaged primary superblock, we will zero out stripe geometry if we have copied the backup. I'm guessing this might be because changing geometry with mount options only updates the primary, so backups aren't guaranteed to be current or correct. Unfortunately, that leaves us with sb 0 w/ no geom, and backups *with* geom, so the next repair finds the mismatch, and complains. (In other words, the 2nd repair does not come up clean.)_ And ... the second repair copies the backup stripe geometry back into the primary! Rather than clearing stripe geometry in this case, just leave it at what was found in the backup super, and inform the user that this was done. This leaves a consistent filesystem, and gives the user a heads-up to double-check the result. This can all be demonstrated and tested by running xfs/030 with geometry set in MKFS_OPTIONS. (To really make the test pass, we need to filter the warning out of repair output.) Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b6ad8545923aaa0bcc6ec7f7d3edea00382ef3a1 Author: Nathan Scott <nathans@redhat.com> Date: Wed Jul 16 13:50:47 2014 +1000 xfsprogs: update debian packaging for next release Make a note of each of the Debian bugs resolved in this release, so that they'll be automatically closed during next upload. Signed-off-by: Nathan Scott <nathans@debian.org> commit 1a05f9188b1a151fa6dcdec61880699d2acf53cd Author: Nathan Scott <nathans@redhat.com> Date: Wed Jul 16 13:49:16 2014 +1000 xfsprogs: add a watch file into the debian packaging Apparently it can improve some Debian tools that check it (e.g. UDD). Resolves Debian bug #748483. Signed-off-by: Nathan Scott <nathans@debian.org> create mode 100644 debian/watch commit 642d23de2de415457e1c7a4261dc9bf83a44e084 Author: Dave Chinner <david@fromorbit.com> Date: Tue Jul 15 14:22:37 2014 +1000 xfsprogs: v3.2.1 release Update all the versiona nd changelog files for release. Signed-off-by: Dave Chinner <david@fromorbit.com> commit fb3b519b60f1095a11333b31f7e14188e373d2f5 Author: Jakub Bogusz <qboosh@pld-linux.org> Date: Tue Jul 15 14:20:10 2014 +1000 xfsprogs: update polish translation Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1fe7b0b07b2ab9c9dca09b107117acca047a781a Author: Dave Chinner <dchinner@redhat.com> Date: Fri Jul 11 12:00:51 2014 +1000 repair: handle uncorrected corruptions in phase 2 Some of the AG header corruptions detected by the IO verifiers cannot be corrected in phase 2 when we do the initial scan of the AGs. Correcting some errors cannot be done until a full rebuild of the trees is done in phase 5. Hence we can end up with a "clean" AGF/AGI buffer but have a EFSCORRUPTED error on the buffer. This results in an assert failing: ASSERT(agf_dirty || agfbuf->b_error != EFSCORRUPTED); and repair not beign able to fix the problems it has tripped over. Hence the assert that we corrected all corruptions in the buffers is not valid and should be removed. Reported-by: Hans Kraus <hans.w.kraus@gmx.at> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit cee99cfa7ccb720f60b6cf77997792efbd90a413 Author: Dave Chinner <dchinner@redhat.com> Date: Fri Jul 11 12:00:28 2014 +1000 libxfs: clear the buffer error while the buffer is locked When releasing a buffer, the error shoul dbe cleared while the lock is still held on the buffer to avoid racing with a new user of the buffer. This was pointed out in review of commit 6af7c1e ("libxfs: reused invalidated buffers leak state and data") but the version committed didn't have the fix. Thanks to Christoph Hellwig for checking and pointing out the oversight. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 871fbfd5ce2bfdc8030371aa3b1517efc03d9455 Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:36:39 2014 +1000 repair: get rid of BADFSINO When we find a bad dirent, we "clear" the inode the inode number by writing BADFSINO to the inode number in the entry: #define BADFSINO ((xfs_ino_t)0xfeffffffffffffffULL) We then capture this bad inode number later in the same function either in the same pass or in a later phase and junk the entry. When we junk the entry, we write a "/" over the first character of the dirent name, which is then detected up later by the directory rebuild and ignored. The issue with this is that the directory buffer can be written to disk between the dirent being marked with BADFSINO and the directory rebuild processing in phase 6, resulting in the directory block verifier firing this error: Invalid inode number 0xfeffffffffffffff xfs_dir_ino_validate: XFS_ERROR_REPORT Metadata corruption detected at block 0x11fbb698/0x1000 libxfs_writebufr: write verifer failed on bno 0x11fbb698/0x1000 And so will not write the *corrupt block* to disk. The result is that we don't repair a corruption in the directory block correctly and subsequent repair runs continue to find problems with the directory. We really don't need both BADFSINO *and* overwriting the dirent name with "/" to mark an entry as junked. They both mean exactly the same thing, so get rid of BADFSINO and only use the name junking to mark dirents as bad. This prevents the directory data block verifier from triggering on bad inode numbers, and so the later reread of the block will find the junked entries correctly. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit d085fb486f8b33304f2fdf704411313ffc8bcc0c Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:36:39 2014 +1000 repair: fix quota inode handling in secondary superblocks Changes to support separate project quota inodes changed the way quota inodes got written to the superblock. The current code is tailored for the needs to the kernel, where the inodes should only be written if certain falgs are set saying a quota type is enabled. Unfortunately, when recovering a corrupt secondary superblock, we need to unconditionally write the quota inode fields after we unconditionally zero the quota flags field. The result of this bug is that the bad quota inode fields cannot be cleared and hence always are reported by bad by repair in subsequent runs. Fix this by directly clearing the quota inodes in the superblock buffers so that we do need to set special flags to get xfs_sb_to_disk() to do the right thing as setting flags leave bad flag values in the superblock instead of bad inode numbers.... Also, when clearing the inode numbers, write them as NULLFSINO rather than 0 as this is what the kernel will write them as if quota is turned off. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 6af7c1eacfc3bf4fb4b782f9ab926cc8263886d7 Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:36:39 2014 +1000 libxfs: reused invalidated buffers leak state and data When rebuilding a bad directory, repair first truncates away all the blocks in the directory, good or bad. This removes blocks from the bmap btree, and when those blocks are freed the bmap btree code invalidates them. This marks the buffers LIBXFS_B_STALE so that we don't try to write stale data from that buffer at a later time. However, when rebuilding the directory, blocks may get reallocated and we reuse the underlying buffers. This has two problems. The first is that if the buffer was previously detected as having a verifier error (i.e. an error that is leading to the block being freed and the buffer being invalidated) then the error might still be held in b_error. Hence the libxfs code needs to ensure that b_error does not leak from one buffer usage context to another after invalidation. The second problem is that when new data is written into a buffer, it no longer has stale contents. Hence when we write the buffer, we need to clear the LIBXFS_B_STALE flag to ensure that the new data gets written. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 15e3986b8cd68d8d40eb88cdc5795baccc314de1 Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:36:34 2014 +1000 repair: handle directory block corruption in phase 6 This should only occur in no-modify mode, but when we fail to find the last extent in a directory btree due to corruption we need to trash the directory if it's the first data block we find the error on. That is because there is nothing to recover from the directory, and if we try to scan it xfs_reapir segv's because nothing has been read from disk. Also catch a memory allocation failure in this code, too. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 97ada36338a25ca38e22c430e6ffe91e3d76edb6 Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:31:36 2014 +1000 xfs_db: write command broken on 64 bit values convert_args() has problesm with 64 bit fields because it tries to shift them by 64 bits. The result of doing so is undefined by the C standard, and so results in the unexpected behaviour of the result being being the original value unchanged rather than 0. Hence you can't write 64 bit fields because the code thinks that all values other than 0 are out of range. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit b5f5c2d13f390d109c808118f571f7623983a621 Author: Dave Chinner <dchinner@redhat.com> Date: Tue Jul 8 10:30:52 2014 +1000 repair: support more than 25 ACLs v5 superblock supports many more than 25 ACLs on an inode, but xfs_repair still thinks that the maximum is 25. This slipped through becase the reapir code does not share any of the kernel side ACL code in libxfs, and instead has all it's own internal ACL definitions. Fix the repair code to support more than 25 ACLs and update the ACL definitions to match the kernel definitions. In doing so, this tickles a off-by-one bug on remote attribute maximum sizes that is already fixed in the kernel code. So in addition to fixing the repair code, this patch pulls in parts of the following kernel commits: bba719b5 xfs: fix off-by-one error in xfs_attr3_rmt_verify 0a8aa193 xfs: increase number of ACL entries for V5 superblocks Reported-by: Michael L. Semon <mlsemon35@gmail.com> Tested-by: Michael L. Semon <mlsemon35@gmail.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 575010d5caf03b561ad13f43c7b6b7447e63203e Author: Jan Kara <jack@suse.cz> Date: Tue Jul 8 10:30:28 2014 +1000 repair: Repair directory block CRC mismatches It can happen that just CRC doesn't match for directory blocks. In that case xfs_repair will just report the error but won't fix anything (as further checking of the block doesn't reveal any problems). Make sure we recompute and write out new CRC when we failed verification during reading. Signed-off-by: Jan Kara <jack@suse.cz> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit cf0cc348f3a7bb53490f084f9835a3a779c777dd Author: Dave Chinner <dchinner@redhat.com> Date: Fri Jun 20 07:48:44 2014 +1000 mkfs: add "-m" options to the man page Because they are missing. Reported-by: Matthias Schniedermeyer <ms@citd.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 75c270a668252b56e8bd194c894b437358e2a6bd Author: Eric Sandeen <sandeen@redhat.com> Date: Thu Jun 19 12:15:33 2014 +1000 libxfs: fix crc field handling in xfs_sb_to/from_disk If we xfs_mdrestore an image from a non-crc filesystem, lo and behold the restored image has gained a CRC: # db/xfs_metadump.sh -o /dev/sdc1 - | xfs_mdrestore - test.img # xfs_db -c "sb 0" -c "p crc" /dev/sdc1 crc = 0 (correct) # xfs_db -c "sb 0" -c "p crc" test.img crc = 0xb6f8d6a0 (correct) This is because xfs_sb_from_disk doesn't fill in sb_crc, but xfs_sb_to_disk(XFS_SB_ALL_BITS) does write the in-memory CRC to disk - so we get uninitialized memory on disk. Fix this by always initializing sb_crc to 0 when we read the superblock, and masking out the CRC bit from ALL_BITS when we write it. This same fix has already been sent for kernelspace. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 35f2764a85e182de9eafe183c80660ed5f9d932b Author: Eric Sandeen <sandeen@redhat.com> Date: Thu Jun 19 12:15:06 2014 +1000 libxfs: don't send null bp to xfs_trans_brelse() In this case, if bp is null, error is set, and we send bp to xfs_trans_brelse, which will try to dereference it. Test whether we actualy have a buffer before we try to free it. Same fix as was sent for kernelspace. Coverity spotted this. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit e024ab59ba2a546a56f5bfb368e3620cdca49d72 Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:14:41 2014 +1000 xfsprogs: indicate default mount options in xfs.5 manpage Not every pair of mount options indicated which was the default, so add those. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 53ab4c490be46b0df0eb4f3626c083d6c5e715be Author: Eric Sandeen <sandeen@redhat.com> Date: Thu Jun 19 12:14:01 2014 +1000 xfsprogs: add mount options to xfs.5 manpage This is a straight cut and paste from the util-linux mount manpage to xfs.5. It's pretty much impossible for util-linux to keep up with every filesystem out there, and Karel has more than once expressed a wish that mount options move into fs-specific manpages. So, here we go. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 3d303baa2b68be45706b8284d75c89b67dcd4c05 Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:13:23 2014 +1000 xfs_fsr: test for more potential failures in packfile() Test for lseek, ftruncate, and fsync failures in packfile() Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 671632c69f6e3eb3bc0def98772da12b847def04 Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:13:03 2014 +1000 xfs_fsr: create a cleanup/return target in packfile() Error handling is a mishmash of closes, frees, etc at every error point. Create an "out" target that does this all in one place. Minor comment/doc update while we're at it. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit eef20df010f3a89b2ce7021968beeeb5f3afe4f2 Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:12:36 2014 +1000 xfs_fsr: ensure the line we read from leftofffile is null terminated Ensure that the string we read from leftofffile is NULL terminated; the buffer gets passed to strchr(), so it's important that we ensure it ends with NULL. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit c667d79c2149a5a678cbde7090766b1be155b033 Author: Junxiao Bi <junxiao.bi@oracle.com> Date: Thu Jun 19 12:11:48 2014 +1000 xfs_copy: fix data corruption of target The unit of XFS_AGFL_DADDR(mp) is "basic block" whose size is "BBSIZE" (512 bytes), so when "source_sectorsize" is not 512, it will cause the target a corrupted filesystem. Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 3800a2a23d1a9af666421eac5fd4a4e3f5e042ec Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:11:20 2014 +1000 mkfs.xfs: don't call blkid_get_topology on existing regular files If we encounter a target that's really a regular file, even without "-d file..." on the cmdline, call platform_findsizes() instead of blkid_get_topology to try to discover the "sector size" via the fsgeom() call. Otherwise mkfs.xfs will try to do direct IO with a default 512 sector size, and if the underlying file has different DIO requirements, mkfs will fail. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 5a7d5937f375a14c00496544eec1e0b4a79822c8 Author: Eric Sandeen <sandeen@sandeen.net> Date: Thu Jun 19 12:10:23 2014 +1000 xfsprogs: try to handle mkfs of a file on 4k sector device Try the xfs geometry ioctl if the mkfs target resides in a file; this gives us the equivalent of a device sector size. If this fails, and there's a sector size mismatch between the host FS and the filesystem, then mkfs might fail - but that's no worse than it's been before. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 7a92e85486a1b1e98374ea63076d941032fea72c Author: Jakub Bogusz <qboosh@pld-linux.org> Date: Thu Jun 19 12:07:46 2014 +1000 xfsprogs: update polish translation Jakub provided the polish translation here: http://qboosh.pl/pl.po/xfsprogs-3.2.0.pl.po Signed-off-by: Dave Chinner <dchinner@redhat.com> commit 03e956b25243bf4aac034275f89a0f3f2712b79a Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:07:36 2014 +1000 db: add finobt support to metadump Include the free inode btree in metadump images. If the source fs is finobt-enabled, run an additional scan_btree() of the finobt. Since the private 'agi' scanfunc_ino() parameter is unused, change the private parameter to a flag that indicates whether the current scan is for the inobt or finobt. If the latter, we skip copying the actual inode chunks as this work is already performed by the inobt scan. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 050643888a844c0532dbda080ed963ec6b1317ad Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:07:16 2014 +1000 growfs: report finobt status in fs geometry (xfs_info) Check and report on the free inode btree status bit in the fs geometry. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bbdb21b6e080f54994b4cd3152026274767f75ca Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:07:11 2014 +1000 repair: reconstruct the finobt in phase 5 Support reconstruction of the finobt in phase 5 of xfs_repair. We create a new cursor for the finobt and write the in-core records that contain free inodes to the tree. Finally, pass the cursor along to build_agi() to include the finobt root and level count in the agi header. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 01159bd2fab0e9e6bc3c35a04ff20000a07fe43e Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:07:06 2014 +1000 repair: helpers for finding in-core inode records w/ free inodes Add the findfirst_free_inode_rec() and next_free_ino_rec() helpers to assist scanning the in-core inode records for records with at least one free inode. These will be used to determine what records are included in the free inode btree. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit d6412d173d835eb5751ac3f4ad90d3d0412fb5bf Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:07:00 2014 +1000 repair: pull the build_agi() call up out of the inode tree build Pull the build_agi() call out of build_ino_tree() in phase 5. This is to prepare for finobt support, in which build_agi() will require context from multiple inode tree reconstructions (both the inode allocation tree and free inode tree, when it exists). Create the new 'agi_stat' structure to carry the requisite state from the build_ino_tree() operation to build_agi(). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bb266066401c13b22d12d2e0827f8b346003f78e Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:06:54 2014 +1000 repair: pass btree block magic as param to build_ino_tree() A minor cleanup to build_ino_tree() to provide the appropriate magic value for btree block initialization from the caller. This facilitates use of separate magic values for finobt blocks when building the free inode btree. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1578050f74563fd58f927c5c5dc66c5a0c826a67 Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:06:47 2014 +1000 repair: phase 2 finobt scan If one exists, scan the free inode btree in phase 2 of xfs_repair. We use the same general infrastructure as for the inobt scan, but trigger finobt chunk scan logic in in scan_inobt() via the magic value. The new scan_single_finobt_chunk() function is similar to the inobt equivalent with some finobt specific logic. We can expect that underlying inode chunk blocks are already marked used due to the previous inobt scan. We can also expect to find every record tracked by the finobt already accounted for in the in-core tree with equivalent (and internally consistent) inobt record data. Spit out a warning on any divergences from the above and add the inodes referenced by the current finobt record to the appropriate in-core tree. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 7b3709059f29b44f9003ed17a44d9d9c3288ec80 Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:06:41 2014 +1000 repair: account for finobt in ag 0 geometry pre-calculation Account for the finobt in calc_mkfs(). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 2a0cd7adf3240b7c7edac85263f936bb95aa953c Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:06:35 2014 +1000 db: finobt support Add the AGI finobt fields and fibt layouts. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit f49c4e8dc4b34a303c9c5779dfd5854417c04628 Author: Brian Foster <bfoster@redhat.com> Date: Tue May 27 09:06:17 2014 +1000 mkfs: finobt mkfs support Add the 'finobt' metadata option to mkfs to format an fs with free inode btree support. If enabled, initialize the associated AGI header fields and btree root block. Also, do the initialization of the superblock version and feature bits (including the new finobt flag) a bit earlier. These fields must now be initialized prior to the use of XFS_PREALLOC_BLOCKS(), as the latter returns a value that depends on whether a finobt root btree block is reserved. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit a9f4ba98cc925e9fc0b013a4806614919a63fa64 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:57:45 2014 +1000 xfs: enable the finobt feature on v5 superblocks Add the finobt feature bit to the list of known features. As of this point, the kernel code knows how to mount and manage both finobt and non-finobt formatted filesystems. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 608dff09b9974feec3a6c3182625e99e130fbac1 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:57:34 2014 +1000 xfs: report finobt status in fs geometry Define the XFS_FSOP_GEOM_FLAGS_FINOBT fs geometry flag and set the associated bit if the filesystem supports the free inode btree. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 1bb93fd1dc077b983e6a88435ef1b1c6b8616b2a Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:57:24 2014 +1000 xfs: update the finobt on inode free An inode free operation can have several effects on the finobt. If all inodes have been freed and the chunk deallocated, we remove the finobt record. If the inode chunk was previously full, we must insert a new record based on the existing inobt record. Otherwise, we modify the record in place. Create the xfs_ifree_finobt() function to identify the potential scenarios and update the finobt appropriately. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit eb9a297a8a18b4b6f54641469ff8050e4a05c563 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:57:15 2014 +1000 xfs: refactor xfs_difree() inobt bits into xfs_difree_inobt() helper Refactor xfs_difree() in preparation for the finobt. xfs_difree() performs the validity checks against the ag and reads the agi header. The work of physically updating the inode allocation btree is pushed down into the new xfs_difree_inobt() helper. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 88fc73063c110659063d4998a028072c90dd4087 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:54:04 2014 +1000 xfs: use and update the finobt on inode allocation Replace xfs_dialloc_ag() with an implementation that looks for a record in the finobt. The finobt only tracks records with at least one free inode. This eliminates the need for the intra-ag scan in the original algorithm. Once the inode is allocated, update the finobt appropriately (possibly removing the record) as well as the inobt. Move the original xfs_dialloc_ag() algorithm to xfs_dialloc_ag_slow() and fall back as such if finobt support is not enabled. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 3c699279577193dcbbe123b45db08dacd717853f Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:53:36 2014 +1000 xfs: insert newly allocated inode chunks into the finobt A newly allocated inode chunk, by definition, has at least one free inode, so a record is always inserted into the finobt. Create the xfs_inobt_insert() helper from existing code to insert a record in an inobt based on the provided BTNUM. Update xfs_ialloc_ag_alloc() to invoke the helper for the existing XFS_BTNUM_INO tree and XFS_BTNUM_FINO tree, if enabled. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 0f88d64ae107b91d77be8d0a795b4900d4dfc82d Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:53:18 2014 +1000 xfs: update inode allocation/free transaction reservations for finobt Create the xfs_calc_finobt_res() helper to calculate the finobt log reservation for inode allocation and free. Update XFS_IALLOC_SPACE_RES() to reserve blocks for the additional finobt insertion on inode allocation. Create XFS_IFREE_SPACE_RES() to reserve blocks for the potential finobt record insertion on inode free (i.e., if an inode chunk was previously fully allocated). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit c0a4c227cd016f07f88833885c2016c87b58171f Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:53:07 2014 +1000 xfs: support the XFS_BTNUM_FINOBT free inode btree type Define the AGI fields for the finobt root/level and add magic numbers. Update the btree code to add support for the new XFS_BTNUM_FINOBT inode btree. The finobt root block is reserved immediately following the inobt root block in the AG. Update XFS_PREALLOC_BLOCKS() to determine the starting AG data block based on whether finobt support is enabled. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit dad13219a6df796351bf8ffcb795c6b3af06d114 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:52:47 2014 +1000 xfs: reserve v5 superblock read-only compat. feature bit for finobt Reserve a v5 read-only compatibility feature bit for the finobt and create the xfs_sb_version_hasfinobt() helper to determine whether an fs has the feature enabled. The finobt does not change existing on-disk structures, but must remain consistent with the ialloc btree. Modifications from older kernels would violate that constrant. Therefore, we restrict older kernels to read-only mounts of finobt-enabled filesystems. Note that this does not yet enable the ability to rw mount a finobt fs (by setting the feature bit in the XFS_SB_FEAT_RO_COMPAT_ALL mask). Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 70eb7337fc3af37e628de81c52b94fbc3a8324a7 Author: Brian Foster <bfoster@redhat.com> Date: Wed May 21 07:52:26 2014 +1000 xfs: refactor xfs_ialloc_btree.c to support multiple inobt numbers The introduction of the free inode btree (finobt) requires that xfs_ialloc_btree.c handle multiple trees. Refactor xfs_ialloc_btree.c so the caller specifies the btree type on cursor initialization to prepare for addition of the finobt. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 2c350101393f7effcdce815f20d97f239bf2a78c Author: Eric Sandeen <sandeen@redhat.com> Date: Tue May 20 18:30:44 2014 +1000 xfs_repair: don't let bplist index go negative in prefetch After: bbd3275 repair: don't unlock prefetch tree to read discontig buffers Coverity spotted that it's possible for us to arrive at the loop below with num == 1, and then we decrement it to 0, and try to index bplist[num-1]. I think this was possible before the change, i.e. it's probably not a regression. Fix this by not trying to shrink the window unless we have more than one buffer in the array. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit 66260204ebbb1dce12f910b71de3abad73a2a805 Author: Roger Willcocks <roger@filmlight.ltd.uk> Date: Tue May 20 18:30:44 2014 +1000 libxfs: fix compile error when libxfs header used in C++ code xfs_ialloc.h:102: error: expected ',' or '...' before 'delete' Simple parameter rename, no changes to behaviour. Signed-off-by: Roger Willcocks <roger@filmlight.ltd.uk> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com> commit bfc541e77b9af46a2e3764df595620ec9824a456 Author: Eric Sandeen <sandeen@redhat.com> Date: Tue May 20 18:30:23 2014 +100 ... |