aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-12-15xfsdump: Release 3.1.12HEADv3.1.12masterCarlos Maiolino4-2/+11
Uptade all the necessary files for a 3.1.12 release. Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-10-24xfsrestore: untangle inventory unpacking logicDonald Douwsma1-8/+5
stobj_unpack_sessinfo returns bool_t, fix logic in pi_addfile so errors can be properly reported. Signed-off-by: Donald Douwsma <ddouwsma@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-10-24xfsdump: fix on-media inventory stream packingDonald Douwsma1-1/+1
With the on-media inventory now being restored for multiple streams we can see that the restored streams both claim to be for /dev/nst0. [root@rhel8 xfsdump-dev]# xfsdump -L "Test" -f /dev/nst0 -M tape1 -f /dev/nst1 -M tape2 /boot ... [root@rhel8 ~]# rm -rf /var/lib/xfsdump/inventory [root@rhel8 xfsdump-dev]# restore/xfsrestore -L Test -f /dev/nst0 -f /dev/nst1 /tmp/test restore/xfsrestore: using scsi tape (drive_scsitape) strategy restore/xfsrestore: using scsi tape (drive_scsitape) strategy restore/xfsrestore: version 3.1.10 (dump format 3.0) - type ^C for status and control ... restore/xfsrestore: Restore Summary: restore/xfsrestore: stream 0 /dev/nst0 OK (success) restore/xfsrestore: stream 1 /dev/nst1 ALREADY_DONE (another stream completed the operation) restore/xfsrestore: Restore Status: SUCCESS [root@rhel8 xfsdump-dev]# xfsdump -I file system 0: fs id: 26dd5aa0-b901-4cf5-9b68-0c5753cb3ab8 session 0: mount point: rhel8:/boot device: rhel8:/dev/sda1 time: Fri Oct 14 18:31:40 2022 session label: "Test" session id: 96538a3d-2af8-4a79-8865-afec6e3e55f4 level: 0 resumed: NO subtree: NO streams: 2 stream 0: pathname: /dev/nst0 start: ino 133 offset 0 end: ino 28839 offset 0 interrupted: YES media files: 1 media file 0: mfile index: 0 mfile type: data mfile size: 165675008 mfile start: ino 133 offset 0 mfile end: ino 28839 offset 0 media label: "tape1" media id: 8a9d0ced-61f6-4332-a0c1-f1e38641c4e6 stream 1: pathname: /dev/nst0 start: ino 133 offset 0 end: ino 28839 offset 0 interrupted: YES media files: 1 media file 0: mfile index: 0 mfile type: data mfile size: 166723584 mfile start: ino 28839 offset 0 mfile end: ino 1572997 offset 0 media label: "tape2" media id: 7d569377-6bfb-4c02-b299-4dbe753bb048 xfsdump: Dump Status: SUCCESS [root@rhel8 xfsdump-dev]# Fix this by indexing the stream being packed for the on-media inventory. Signed-off-by: Donald Douwsma <ddouwsma@redhat.com> Suggested-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-10-24xfsrestore: fix on-media inventory stream unpackingDonald Douwsma1-6/+7
xfsdump can create multiple streams, when restoring the online inventory with multiple streams we fail to process these and assert when the inventory buffer is not fully decoded. [root@rhel8 ~]# xfsdump -L "Test1" -f /dev/nst0 -M tape1 -f /dev/nst1 -M tape2 /boot xfsdump: using scsi tape (drive_scsitape) strategy xfsdump: using scsi tape (drive_scsitape) strategy xfsdump: version 3.1.8 (dump format 3.0) - type ^C for status and control xfsdump: level 0 dump of rhel8:/boot xfsdump: dump date: Thu Oct 6 13:50:45 2022 xfsdump: session id: aa25fa48-4493-45c7-9027-61e53e486445 xfsdump: session label: "Test1" xfsdump: ino map phase 1: constructing initial dump list xfsdump: ino map phase 2: skipping (no pruning necessary) xfsdump: ino map phase 3: identifying stream starting points xfsdump: stream 0: ino 133 offset 0 to ino 28839 offset 0 xfsdump: stream 1: ino 28839 offset 0 to end xfsdump: ino map construction complete xfsdump: estimated dump size: 328720704 bytes xfsdump: estimated dump size per stream: 164375728 bytes xfsdump: /var/lib/xfsdump/inventory created xfsdump: drive 0: preparing drive xfsdump: drive 1: preparing drive xfsdump: drive 1: creating dump session media file 0 (media 0, file 0) xfsdump: drive 1: dumping ino map xfsdump: drive 1: dumping non-directory files xfsdump: drive 0: creating dump session media file 0 (media 0, file 0) xfsdump: drive 0: dumping ino map xfsdump: drive 0: dumping directories xfsdump: drive 0: dumping non-directory files xfsdump: drive 1: ending media file xfsdump: drive 1: media file size 166723584 bytes xfsdump: drive 1: waiting for synchronized session inventory dump xfsdump: drive 0: ending media file xfsdump: drive 0: media file size 165675008 bytes xfsdump: drive 0: waiting for synchronized session inventory dump xfsdump: drive 0: dumping session inventory xfsdump: drive 0: beginning inventory media file xfsdump: drive 0: media file 1 (media 0, file 1) xfsdump: drive 0: ending inventory media file xfsdump: drive 0: inventory media file size 2097152 bytes xfsdump: drive 0: writing stream terminator xfsdump: drive 0: beginning media stream terminator xfsdump: drive 0: media file 2 (media 0, file 2) xfsdump: drive 0: ending media stream terminator xfsdump: drive 0: media stream terminator size 1048576 bytes xfsdump: drive 1: dumping session inventory xfsdump: drive 1: beginning inventory media file xfsdump: drive 1: media file 1 (media 0, file 1) xfsdump: drive 1: ending inventory media file xfsdump: drive 1: inventory media file size 2097152 bytes xfsdump: drive 1: writing stream terminator xfsdump: drive 1: beginning media stream terminator xfsdump: drive 1: media file 2 (media 0, file 2) xfsdump: drive 1: ending media stream terminator xfsdump: drive 1: media stream terminator size 1048576 bytes xfsdump: dump size (non-dir files) : 328189016 bytes xfsdump: dump complete: 4 seconds elapsed xfsdump: Dump Summary: xfsdump: stream 0 /dev/nst0 OK (success) xfsdump: stream 1 /dev/nst1 OK (success) xfsdump: Dump Status: SUCCESS [root@rhel8 ~]# xfsdump -I file system 0: fs id: 26dd5aa0-b901-4cf5-9b68-0c5753cb3ab8 session 0: mount point: rhel8:/boot device: rhel8:/dev/sda1 time: Thu Oct 6 13:50:45 2022 session label: "Test1" session id: aa25fa48-4493-45c7-9027-61e53e486445 level: 0 resumed: NO subtree: NO streams: 2 stream 0: pathname: /dev/nst0 start: ino 133 offset 0 end: ino 28839 offset 0 interrupted: NO media files: 2 media file 0: mfile index: 0 mfile type: data mfile size: 165675008 mfile start: ino 133 offset 0 mfile end: ino 28839 offset 0 media label: "tape1" media id: adb31f2a-f026-4597-a20a-326f28ecbaf1 media file 1: mfile index: 1 mfile type: inventory mfile size: 2097152 media label: "tape1" media id: adb31f2a-f026-4597-a20a-326f28ecbaf1 stream 1: pathname: /dev/nst1 start: ino 28839 offset 0 end: ino 1572997 offset 0 interrupted: NO media files: 2 media file 0: mfile index: 0 mfile type: data mfile size: 166723584 mfile start: ino 28839 offset 0 mfile end: ino 1572997 offset 0 media label: "tape2" media id: 22224f02-b6c7-47d5-ad61-a61ba071c8a8 media file 1: mfile index: 1 mfile type: inventory mfile size: 2097152 media label: "tape2" media id: 22224f02-b6c7-47d5-ad61-a61ba071c8a8 xfsdump: Dump Status: SUCCESS [root@rhel8 ~]# mv /var/lib/xfsdump/inventory /var/lib/xfsdump/inventory_two_sessions [root@rhel8 ~]# xfsdump -I xfsdump: Dump Status: SUCCESS [root@rhel8 ~]# xfsrestore -L Test1 -f /dev/nst0 /tmp/test1/ xfsrestore: using scsi tape (drive_scsitape) strategy xfsrestore: version 3.1.8 (dump format 3.0) - type ^C for status and control xfsrestore: searching media for dump xfsrestore: preparing drive xfsrestore: examining media file 2 xfsrestore: found dump matching specified label: xfsrestore: hostname: rhel8 xfsrestore: mount point: /boot xfsrestore: volume: /dev/sda1 xfsrestore: session time: Thu Oct 6 13:50:45 2022 xfsrestore: level: 0 xfsrestore: session label: "Test1" xfsrestore: media label: "tape1" xfsrestore: file system id: 26dd5aa0-b901-4cf5-9b68-0c5753cb3ab8 xfsrestore: session id: aa25fa48-4493-45c7-9027-61e53e486445 xfsrestore: media id: adb31f2a-f026-4597-a20a-326f28ecbaf1 xfsrestore: searching media for directory dump xfsrestore: rewinding xfsrestore: examining media file 0 xfsrestore: reading directories xfsrestore: 9 directories and 320 entries processed xfsrestore: directory post-processing xfsrestore: restoring non-directory files xfsrestore: examining media file 1 xfsrestore: inv_stobj.c:1119: stobj_unpack_sessinfo: Assertion `(size_t) ( p - (char *) bufp ) == bufsz' failed. Aborted (core dumped) Make sure we unpack multiple streams when restoring the online inventory from media. Signed-off-by: Donald Douwsma <ddouwsma@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-10-24xfsrestore: fix on-media inventory media unpackingDonald Douwsma1-20/+7
When xfsrestore reads the inventory from tape media it fails to convert media file records from bigendian. If the xfsdump inventory is not available xfsrestore will write this invalid record to the on-line inventory. [root@rhel8 ~]# xfsdump -L Test1 -M "" -f /dev/st0 /boot > /dev/null [root@rhel8 ~]# xfsdump -L Test2 -M "" -f /dev/st0 /boot > /dev/null [root@rhel8 ~]# rm -rf /var/lib/xfsdump/inventory/ [root@rhel8 ~]# mt -f /dev/nst0 asf 2 [root@rhel8 ~]# xfsrestore -f /dev/nst0 -L Test2 /tmp/test2 xfsrestore: using scsi tape (drive_scsitape) strategy xfsrestore: version 3.1.8 (dump format 3.0) - type ^C for status and control xfsrestore: searching media for dump xfsrestore: preparing drive xfsrestore: examining media file 3 xfsrestore: found dump matching specified label: xfsrestore: hostname: rhel8 xfsrestore: mount point: /boot xfsrestore: volume: /dev/sda1 xfsrestore: session time: Tue Sep 27 16:05:28 2022 xfsrestore: level: 0 xfsrestore: session label: "Test2" xfsrestore: media label: "" xfsrestore: file system id: 26dd5aa0-b901-4cf5-9b68-0c5753cb3ab8 xfsrestore: session id: 62402423-7ae0-49ed-8ecb-9e5bc7642b91 xfsrestore: media id: 47ba45ca-3417-4006-ab10-3dc6419b83e2 xfsrestore: incorporating on-media session inventory into online inventory xfsrestore: /var/lib/xfsdump/inventory created xfsrestore: using on-media session inventory xfsrestore: searching media for directory dump xfsrestore: rewinding xfsrestore: examining media file 0 xfsrestore: inventory session uuid (62402423-7ae0-49ed-8ecb-9e5bc7642b91) does not match the media header's session uuid (1771d9e8-a1ba-4e87-a61e-f6be97e41b45) xfsrestore: examining media file 1 xfsrestore: inventory session uuid (62402423-7ae0-49ed-8ecb-9e5bc7642b91) does not match the media header's session uuid (1771d9e8-a1ba-4e87-a61e-f6be97e41b45) xfsrestore: examining media file 2 xfsrestore: reading directories xfsrestore: 9 directories and 320 entries processed xfsrestore: directory post-processing xfsrestore: restore complete: 0 seconds elapsed xfsrestore: Restore Summary: xfsrestore: stream 0 /dev/nst0 OK (success) xfsrestore: Restore Status: SUCCESS [root@rhel8 ~]# xfsdump -I file system 0: fs id: 26dd5aa0-b901-4cf5-9b68-0c5753cb3ab8 session 0: mount point: rhel8:/boot device: rhel8:/dev/sda1 time: Tue Sep 27 16:05:28 2022 session label: "Test2" session id: 62402423-7ae0-49ed-8ecb-9e5bc7642b91 level: 0 resumed: NO subtree: NO streams: 1 stream 0: pathname: /dev/st0 start: ino 133 offset 0 end: ino 1572997 offset 0 interrupted: YES media files: 1 media file 0: mfile index: 33554432 mfile type: data mfile size: 211187836911616 mfile start: ino 9583660007044415488 offset 0 mfile end: ino 9583686395323482112 offset 0 media label: "" media id: 47ba45ca-3417-4006-ab10-3dc6419b83e2 xfsdump: Dump Status: SUCCESS [root@rhel8 ~]# [root@rhel8 ~]# ls /tmp/test2 efi grub2 loader The invalid start and end inode information cause xfsrestore to consider that non-directory files do not reside in the current media and will fail to restore them. The behaviour of an initial restore may succeed if the position of the tape is such that the data file is encountered before the inventory file, or if there is only one dump session on tape, xfsrestore is somewhat inconsistent in this regard. Subsequent restores will use the invalid on-line inventory and fail to restore files. Fix this by correctly unpacking the inventory data. Signed-off-by: Donald Douwsma <ddouwsma@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-26xfsdump: Release 3.1.11v3.1.11xfsdump-3_1_11Carlos Maiolino4-2/+17
Update all the necessary files for a 3.1.11 release Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-25Rename worker threads from xfsdump's documentationCarlos Maiolino3-23/+23
While we've already removed the word 'slave' from the code, the documentation should still be updated. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-25Remove trailing white spaces from xfsdump.htmlCarlos Maiolino1-204/+204
Cleanup xfsdump.html and remove all trailing white spaces from it. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-25xfsdump: Initialize getbmap structure in quantity2offsetCarlos Maiolino1-1/+1
Prevent uninitialized data in the stack by initializing getbmap structure to zero. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-25xfsdump: remove BMV_IF_NO_DMAPI_READ flagAnthony Iliopoulos2-5/+3
Use of the flag has had no effect since kernel commit 288699fecaff ("xfs: drop dmapi hooks") which removed all dmapi related code, so we can remove it. Given that there are no other flags that need to be specified for the bmap call, convert once instance of it from getbmapx to plain getbmap. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-08-25xfs_restore: remove DMAPI supportDarrick J. Wong6-138/+6
The last of the DMAPI stubs were removed from Linux 5.17, so drop this functionality altogether. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Tested-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
2022-02-11xfsdump: Release 3.1.10v3.1.10Eric Sandeen4-2/+14
Update all the necessary files for a 3.1.10 release. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-02-03xfsdump: intercept bind mount targetsGao Xiang1-0/+62
It's a bit strange pointing at some non-root bind mount target and then actually dumping from the actual root dir instead. Therefore, instead of searching for the root dir of the filesystem, just intercept all bind mount targets by checking whose ino # of ".." is itself with getdents. Fixes: 25195ebf107d ("xfsdump: handle bind mount targets") Cc: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Gao Xiang <hsiangkao@redhat.com> [sandeen: add explanatory comment to new function] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-02-03xfsdump: Revert "xfsdump: handle bind mount targets"Gao Xiang1-19/+2
Bind mount mntpnts will be forbided in the next commits instead since it's not the real rootdir. This cannot be reverted cleanly due to several cleanup patches, but the logic is reverted equivalently. This reverts commit 25195ebf107dc81b1b7cea1476764950e1d6cc9d. Fixes: 25195ebf107d ("xfsdump: handle bind mount targets") Cc: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Gao Xiang <hsiangkao@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-02-03xfsdump: remove obsolete code for handling xenix named pipesAnthony Iliopoulos5-16/+1
We can safely drop support for XENIX named pipes (S_IFNAM) at this point, since this was never implemented in Linux. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-02-03xfsdump: remove obsolete code for handling mountpoint inodesAnthony Iliopoulos2-6/+2
The S_IFMNT file type was never supported in Linux, remove the last vestiges. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-02-03xfsdump: don't try to generate .ltdep in inventory/Eric Sandeen1-2/+0
.ltdep gets generated from CFILES, and there are none in inventory/ so trying to generate it in that dir leads to a non-fatal error: Building inventory [LTDEP] gcc: fatal error: no input files compilation terminated. inventory/ - like common/ - has files that get linked into other dirs, and .ltdep is generated there. So, simply remove the .ltdep generation from the inventory/ dir. Reported-by: Thomas Deutschmann <whissi@gentoo.org> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Bill O'Donnell <billodo@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2020-12-16xfsdump: rename worker threadsEric Sandeen8-68/+68
xfsdump's use of "slave," while largely understood in technical circles, poses a barrier for inclusion to some potential members of the development and user community, due to the historical context of masters and slaves, particularly in the United States. As these entities are already controlled by "managers" in the code, simply rename them to "workers," which is a more natural fit in any case. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Pavel Reichl <preichl@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2020-01-31xfsdump: Release v3.1.9v3.1.9Eric Sandeen4-8/+19
Update all the necessary files for a 3.1.9 release. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2020-01-31common: remove old ioctl typedef usageDarrick J. Wong9-124/+124
Convert old xfs_foo_t typedef usage to struct xfs_foo to prepare for the removal of old ioctl typedefs. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> [sandeen: minor whitespace tweaks] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-20xfs_restore: support fallocate when reserving space for a fileDarrick J. Wong6-0/+34
Update the file creation helper to try fallocate when restoring a filesystem before it tries RESVSP. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-20xfs_restore: fix unsupported ioctl detectionDarrick J. Wong1-1/+1
Linux ioctls can return ENOTTY or EOPNOTSUPP, so filter both of them when logging reservation failure. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-20xfs_restore: check return valueDarrick J. Wong1-1/+3
Check the return value of the unlink call when creating a new file. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Allison Collins <allison.henderson@oracle.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-20xfs_restore: refactor open-coded file creation codeDarrick J. Wong3-127/+37
Create a helper to unlink, recreate, and reserve space in a file so that we don't have two open-coded versions. We lose the broken ALLOCSP code since it never worked anyway. 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>
2019-05-20xfsdump: add a space after commas and semicolons where was noneJan Tulak23-63/+63
A simple change: x,y -> x, y Manual changes were for re-alignment, because expressions length changed, and when a few lines got over 80 chars. Created by script: find . -name '*.[ch]' ! -type d -exec gawk -i inplace '{ $0 = gensub(/^([^"]*)([,;])([-.*_&a-zA-Z0-9])/, "\\1\\2 \\3", "g") $0 = gensub(/([,;])([-.*_&a-zA-Z0-9])([^"]*)$/, "\\1 \\2\\3", "g") }; {print }' {} \; As in the previous patches, do not touch strings. And this time the patch is smaller, just 68 lines changed. There are some macros whose definition was modified with a space, but there is no new warning in gcc, so I'm including them. Signed-off-by: Jan Tulak <jtulak@redhat.com> [sandeen: omit a couple changes where broken rules led to clarity] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-15xfsdump: (style) remove spaces for pointers and negationsJan Tulak45-934/+934
Another case of different xfsdump style, spaces around * and ! operators. This style was used a lot through xfsdump: (* foo_t)xxx ^ space While the rest of XFS omits the space. Same for negations: if (! foo) This patch changes all occurrences to comply with the rest of xfs/kernel coding style by removing the space. Unlike the previous patches, this one is not fully replicable by a script - I had to manually correct many cases of overzealous replacements in comments or strings. (Regular expressions are a too weak tool for these context-sensitive changes.) Still, the script that did most of the job is here: find . -name '*.[ch]' ! -type d -exec gawk -i inplace '{ $0 = gensub(/^([^"]*)\(\* /, "\\1(*", "g") # foo(* bar $0 = gensub(/\(\* ([^"]*)$/, "(*\\1", "g") # $0 = gensub(/^([^ *#]{2}[^"]*)! /, "\\1!", "g") # space after '!' }; {print }' {} \; Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-05-15xfsdump: (style) remove spaces in front of commas/semicolonsJan Tulak31-195/+195
Turn all the "x , y , z" into "x, y, z" and "for (moo ; foo ; bar)" to "for (moo; foo; bar)". The only exception is a double semicolon surrounded by some other commands, e.g. for(bar ; ; baz), for increased readability. Created by this script: ***** #!/usr/bin/env bash set -euo pipefail # remove the space before , and ; # regex explanation: # We are avoiding strings - replacing only those spaces that are not # surrounded by ". At the same time, we want to ignore also those cases, # where there are only whitespace in front of the commas/semicolons, # as those are likely aligned. At the end, return a space between two # semicolons in cases like for (foo ; ; bar), where the spaces are # important for readability. find . -name '*.[ch]' ! -type d -exec gawk -i inplace '{ $0 = gensub(/^([^"]*[^[:space:]"][^"]*) ,/, "\\1,", "g") $0 = gensub(/^([^"]*[^[:space:]"][^"]*) ;/, "\\1;", "g") $0 = gensub(/^(.*[^[:space:]"].*) ,([^"]*)$/, "\\1,\\2", "g") $0 = gensub(/^(.*[^[:space:]"].*) ;([^"]*)$/, "\\1;\\2", "g") $0 = gensub(/([^([:space:]]);;([^\n])/, "\\1 ; ;\\2", "g") }; {print }' {} \; ***** Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-02-20xfsdump: (style) remove spaces from parenthesesJan Tulak99-14417/+14417
Transform "( x, y )" to "(x, y)", and the same for []. Created by this script: ***** #!/usr/bin/env bash # transform 'foo( x, y )' -> 'foo(x, y)' set -euo pipefail # regexps in order: # - remove spaces after opening parentheses ( # - remove spaces after opening brackets [ # - remove spaces before closing parentheses ) # - remove spaces before closing brackets ] # # Run multiple iterations to get all overlapping matches. for i in {1..8}; do echo "iteration $i" find . -name '*.[ch]' ! -type d -exec gawk -i inplace '{ $0 = gensub(/^([^"]*)\(\s+/, "\\1(", "g") $0 = gensub(/^([^"]*)\[\s+/, "\\1[", "g") $0 = gensub(/(\S)\s+\)([^"]*)$/, "\\1)\\2", "g") $0 = gensub(/(\S)\s+\]([^"]*)$/, "\\1]\\2", "g") }; {print }' {} \; done # Revert changes in defines that would cause redefinition error sed -i \ -e 's/^#define sizeofmember.*$/#define sizeofmember( t, m )\tsizeof( ( ( t * )0 )->m )/' \ -e 's/^#define offsetofmember.*$/#define offsetofmember( t, m )\t( ( size_t )( char * )\&( ( ( t * )0 )->m ) )/' \ common/types.h ***** Signed-off-by: Jan Tulak <jtulak@redhat.com> [sandeen: combine 13 patches into 1 commit] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2019-01-11xfsdump: don't fail installation if /sbin is symlink of /usr/sbinJan Tulak2-2/+6
Some distributions, like Fedora, have /bin and /sbin as symlinks pointing to /usr/* and this patch adds compatibility for these cases. Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2018-12-06common/drive.c: include stdlib.hJan Tulak1-0/+1
We are using calloc() inside of this file, but it is not included in any way (resultin in "implicit declaration" warnings from the compiler). So, add the include. Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2018-12-06common/types.h: Wrap #define UUID_STR_LEN 36 in #ifndefJan Tulak1-1/+3
Current Fedora 28 has the constant it in uuid/uuid.h where it belongs (per comment next to the define), so we should treat the define as a backward-compatibility workaround, rather than enforcing it for all. Signed-off-by: Jan Tulak <jtulak@redhat.com> [sandeen: tweak comment to match] Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2018-12-06xfsdump: do not split function call with ifdefJan Tulak2-3/+8
In two files in xfsdump, a function call is split in half by an ifdef macro to conditionally pick an argument at compile time. This causes the code to be a bit less obvious and some analysis tools have trouble with understanding it. So, instead of splitting the function in half, move the whole function call into each of the ifdef macros. Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2018-12-06xsfsdump: (style) remove trailing whitespacesJan Tulak58-1069/+1069
There were many trailing whitespaces through the whole code. As the rate of changes in xfsdump is low, it should not cause trouble if we fix it in all files at once and avoid issues (unintended changes) with sensibly configured editors that automatically remove these on a file save. Created by this script: #!/usr/bin/env bash # remove trailing whitespaces find . -name '*.[ch]' ! -type d -exec bash -c ' sed -i \ -e "s/\s*$//" \ $0 ' {} \; Signed-off-by: Jan Tulak <jtulak@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-21xfsdump: Release v3.1.8v3.1.8Eric Sandeen4-2/+11
Update all the necessary files for a 3.1.8 release. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14common/main.c: Include <locale.h>Felix Janda1-0/+1
This fixes a compilation error with musl libc, and is required according to POSIX to expose LC_ALL and getlocale(). Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14common/types.h: explicitly define NBBY (bits per byte)Felix Janda1-0/+4
This avoids a compilation failure with musl libc, which requires an explicit <sys/param.h> include to expose NBBY. Inline the declaration since common/types.h is included in many places, and only one constant from <sys/param.h> is needed. Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Eric Sandeen <sandeen@redhat.com> [sandeen: guard with #ifndef to be sure] Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14cleanup: Kill __[u]int*_t typesFelix Janda6-11/+11
Replace them by the stdint [u]int*_t types. [sandeen: fixes build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14dump/var.c: Include <limits.h> for PATH_MAXFelix Janda1-0/+1
[sandeen: fixes build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14librmt/rmtopen: Prefer <signal.h> over <sys/signal.h>Felix Janda1-1/+1
[sandeen: fixes build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14common/main.c: Replace nonstandard SIGCLD by SIGCHLDFelix Janda1-1/+1
[sandeen: fixed build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14dump/content.c: Include <linux/limits.h> for XATTR_LIST_MAXFelix Janda1-0/+1
[sandeen: fixed build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-09-14invutil/invidx: include <fcntl.h> for O_CREATFelix Janda1-0/+1
[sandeen: fixed build with musl libc] Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-08-18xfsdump: Release v3.1.7v3.1.7Eric Sandeen4-2/+12
Update all the necessary files for a 3.1.7 release. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-07-13xfsdump: Release v3.1.7-rc1v3.1.7-rc1Eric Sandeen3-2/+7
Update all the necessary files for a 3.1.7-rc1 release. Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-07-13xfsdump: fix race condition between lseek() and read()/write()Eryu Guan6-56/+41
There's a race condition in the [get|put]_invtrecord() routines, because a lseek() followed by a read()/write() is not atmoic, the file offset might be changed before read()/write(). xfs/302 catches this failure as: xfsdump: drive 1: INV : Unknown version 0 - Expected version 1 xfsdump: inv_core.c:66: get_counters: Assertion `((invt_counter_t *)(*cntpp))->ic_vernum == (inv_version_t) 1' failed. And it can be reproduced by running multi-stream dump in a tight loop mount /dev/<dev> /mnt/xfs mkdir /mnt/xfs/dumpdir # populate dumpdir here while xfsdump -M l1 -M l2 -f d1 -f d2 -L ses /mnt/xfs -s dumpdir; do : done Fix it by replacing the "lseek(); read()/write()" sequence by pread()/pwrite(), which make the seek and I/O an atomic operation. Also convert all *_SEEKCUR routines to "SEEK_SET" variants and remove the *_SEEKCUR macros, because they depend on the maintenance of current file offset, but pread()/pwrite() don't change file offset. And in inventory/testmain.c, get|put_invtrecord() are called directly, not from the GET|PUT_REC_* macros, so maintain the offset explicitly there. Signed-off-by: Eryu Guan <eguan@redhat.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-07-13xfsdump: Fix memory leakPaulo Cezar A Junior1-7/+19
This patch fixes the following memory leak reported by valgrind: ==9198== ==9198== HEAP SUMMARY: ==9198== in use at exit: 272,248 bytes in 13 blocks ==9198== total heap usage: 629 allocs, 616 frees, 354,203 bytes allocated ==9198== ==9198== 4,096 bytes in 1 blocks are definitely lost in loss record 12 of 13 ==9198== at 0x4C2FA50: calloc (vg_replace_malloc.c:711) ==9198== by 0x415801: global_hdr_alloc (global.c:80) ==9198== by 0x403D12: main (main.c:494) ==9198== ==9198== LEAK SUMMARY: ==9198== definitely lost: 4,096 bytes in 1 blocks ==9198== indirectly lost: 0 bytes in 0 blocks ==9198== possibly lost: 0 bytes in 0 blocks ==9198== still reachable: 268,152 bytes in 12 blocks ==9198== suppressed: 0 bytes in 0 blocks ==9198== Reachable blocks (those to which a pointer was found) are not shown. ==9198== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==9198== ==9198== For counts of detected and suppressed errors, rerun with: -v ==9198== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) Command was: # xfsdump -f /dev/vdb Signed-off-by: Paulo Alcantara <pcacjr@gmail.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-07-13fix build on 32-bit platformsEric Sandeen1-0/+2
Now that xfsprogs requires anyone using the headers to properly define 64-bit file access, xfsdump has stopped building on 32-bit platforms. I think this is all it needs; works for me here. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2017-02-08xfsdump: handle bind mount targetsEric Sandeen1-2/+19
Today, xfsdump looks at the mount point it was handed, gets the inode of that directory, and assumes that it is the filesystem's root inode. This doesn't work if we have bind-mounted a subdirectory somewhere, and point xfsdump at that. The inode number retrieved is not the filesystem's root inode number, and because this goes into the dump header and gets checked on restore, things go badly when the root inode found in the dump does not match the root inode in the dump header: # mkfs.xfs -dfile,name=fsfile,size=16g # mkdir mnt # mount -o loop fsfile mnt # mkdir -p mnt/dir # mkdir -p mnt2/dir # mount -o bind mnt/dir mnt2/dir # xfsdump -v trace -J -F -l 0 - `pwd`/mnt2/dir | xfsdump/restore/xfsrestore -v trace -t - ... xfsrestore: tree.c:759: tree_begindir: Assertion `ino != persp->p_rootino || hardh == persp->p_rooth' failed. # Fix this by using bulkstat to get the first valid inode in the filesystem. Compare this to the inode number of the mounted directory, and if they differ, issue a notice that this may be a bind mount (which means that more than just the tree under the mount will be dumped; the whole filesystem is dumped by default). Reported-by: Jason L Tibbitts III <tibbs@math.uh.edu> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2015-11-10xfsdump: Release v3.1.6v3.1.6Dave Chinner4-2/+13
Update all the relevant files for a v3.1.6 release. Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-11-10cleanup: Kill unnecessary xfs includesDave Chinner37-109/+79
Remove all the unneccessary xfsprogs header includes by replacing them with explicit includes and platform specific definitions in config.h.in. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: move fold_t out of util.hDave Chinner5-56/+56
Many files just want the fold_t type, but pulling in util.h requires all the XFS and JDM headers to be pulled in, too. Move fold_t to mlog.[ch] as it tends to be common with log output. Similarly, move the PREEMPT_* definitions to common/types.h to remove that dependency on util.h as well. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: use system uuid.h headersDave Chinner19-0/+19
Another bunch of support pulled in from the xfs headers, but would never have worked correctly on any platform other than Linux as dump doe snot use the abstractions that xfsprogs wraps around the uuid interfaces. Hence just make it work on Linux for now, as it's already relying on native support. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: define a local xfs_ino_tDave Chinner1-0/+2
The xfs inode number size is never going to change - it's a uint64_t. We currently inherit this from xfsprogs headers, but it goes away in xfsprogs v4.2.0 as it's part of the platform definitions. Add our own local definition for this type. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: kill u_int*_t typesDave Chinner35-314/+319
They are the same as uint*_t type defined in <stdint.h>, so seek and destroy these to reduce the type proliferation issues that this code has. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: kill intgen_tDave Chinner58-872/+872
intgen_t is for jdm (libhandle) interfaces, not as a random substitute for "int". Do a global s/intgen_t/int across the codebase with sed to remove this stupidity so that we don't have to include xfs/jdm.h across almost the entire code base. After a manual pass back over the callers of the jdm API, there are no places where the return value needs to be an intgen_t. Indeed, jdm_open passes back a file descriptor, so intgen_t by definition cannot be anything other than an int. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16build: don't rely on xfs/xfs.h to include necessary headersDave Chinner61-18/+256
From xfsprogs 4.2.0, the xfs headers no long include lots of xfsprogs specific build information. xfsdump hasbeen implicitly relying on those header for a clean build, rather than having it's own definitions. Hence we need to add the missing bits to config.h.in and include it in all the files that require the specific help that the xfs headers used to provide. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-16cleanup: get rid of ASSERTDave Chinner45-1319/+1362
ASSERT comes from the xfs/xfs.h include, and we don't ever define DEBUG so we never get asserts built in. We want asserts built in for testing, but not for distro packages. The debian package already tries to do this by using "export DEBUG=-DNDEBUG" for the build context, but seeing as we pull in #define ASSERT(ex) (0) from the XFS headers it's a no-op. Convert all the ASSERT calls to assert to remove this conflict with the xfsprogs headers and so local developer builds are built with asserts enabled. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2015-10-14xfsdump: Release v3.1.5v3.1.5Dave Chinner4-3/+9
Update all the relevant files for a v3.1.5 release. Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-10-14xfsdump: remove use of __psint_t, it is no longer availableNathan Scott5-8/+14
Commit ee6cd73ed1e in xfsprogs switched __psint_t to the standards conforming intptr_t type - we need to make the same change here in xfsdump for builds using the latest xfsprogs headers. Signed-off-by: Nathan Scott <nathans@debian.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-10-14xfsrestore: fix 2GB directory dump limitation for multi-streamRich Johnston1-11/+13
The drive_simple restore path has a 2GB directory limit. Instead of ASSERTing if nreadneeded64 is greater than INTGENMAX (2GB), add a loop to handle it. Signed-off-by: Rich Johnston <rjohnston@sgi.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-10-14xfsrestore: fix fs uuid order check for incremental restoresRich Johnston6-99/+151
Restoring an incremental level 1 dump will fail with the following error if the fs uuid of the most recent level 0 dump in the inventory does not match level 1 dump we are restoring. xfsrestore: ERROR: selected dump not based on previously applied dump This can happen when you have multiple filesystems and you are restoring a level 1 or greater dump of filesystem FS1 but the most recent level 0 dump in the inventory was filesystem FS2 The fix is to ensure the fs uuid of the inventory entry and the dump to be restored match. Signed-off-by: Rich Johnston <rjohnston@sgi.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2015-10-14xfsdump: prevent segfault in cb_add_inogrprjohnston@sgi.com1-5/+3
The call to memset will segfault because the offset for the first parameter is done twice. We are using pointer math to do the calculation. The first time is when calculating oldsize, the size of i2gseg_t is accounted for. oldsize = (numsegs - SEGPERHNK) * sizeof(i2gseg_t); Then in the call to memset, oldsize is again multiplied by the size of i2gmap_t. memset(inomap.i2gmap + oldsize, ...) i2gmap holds the used inodes in each chunk. When there are 2^31 chunk entries, it could describe 2^31 (1 inode/chunk)- 2^40 (64 inodes/chunk). With 100s of millions of inodes there are enough entries to wrap the 32 bit variable oldsize. Adding a bounds check (numsegs < 0) and switching to use array index notation instead of calculating the pointer address twice would resolve this issue. The unneeded local variable oldsize can be removed as well. Signed-off-by: Rich Johnston <rjohnston@sgi.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-18xfsdump: v3.1.4 Releasev3.1.4Dave Chinner2-1/+11
Update all the files for a v3.1.4 release. Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-18dump: updated Polish translationJakub Bogusz1-926/+940
Updated Polish translation file. Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-18dump: fix translation build errorsDave Chinner2-18/+1
The translations fail to build because of duplicate message strings. Remove the duplicate. Also, fix the missing "language" tag from the german translation. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-18dump: don't redefine min() or max()Dave Chinner4-10/+0
They are included from other header files. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-16Fix trivial typo in xfsrestore warning messageIustin Pop3-3/+3
Also modify the po/ files. Signed-off-by: Iustin Pop <iusty@k1024.org> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-07-16xfsdump: update debian packaging for next releaseNathan Scott1-0/+8
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>
2014-07-16xfsdump: add a watch file into the debian packagingNathan Scott2-1/+4
Apparently it can improve some Debian tools that check it (e.g. UDD). Resolves Debian bug #748482. Signed-off-by: Nathan Scott <nathans@debian.org>
2014-07-16xfsdump: rebuild configure files during deb package buildsNathan Scott2-1/+4
Use the same technique applied to xfsprogs recently to tackle out-of-date config.{sub,guess} files in the build. Resolves Debian bug #746531. Signed-off-by: Nathan Scott <nathans@debian.org>
2014-04-08remove ancient sys_getdents code pathsKyle McMartin1-177/+69
Everything since 2.4.1 has supported getdents64... so let's remove all the legacy code paths to handle it and just rely on getdents64 existing everywhere. Also re-indent the function to not look entirely awful. Signed-off-by: Kyle McMartin <kmcmarti@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-08xfsdump: getdents.c: clean up ifdef-hell around sys_getdentsKyle McMartin1-70/+34
Remove the ifdef-hell imported from glibc around getdents64. Everything since 2.4.1 supports things properly and this seems like a sensible clean up, so lets just assume it exists and handle it by falling back if not. Additionally, if the old getdents syscall doesn't exist, just stub out the actual syscall and return ENOSYS. Signed-off-by: Kyle McMartin <kmcmarti@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-04-08xfsdump: Fix memory and fd leak in invutil/stobj.cBoris Ranto1-6/+7
The function open_stobj duplicates its argument, upon successful duplication, the fstat is called. If the fstat command fails then the memory for the duplicated string is leaked. Fix this by moving the string duplication after the fstat call. This is ok because the fstat call does not use the duplicated string. Brian Foster noticed that the function also leaks a file descriptor in case the file cannot be fstated. Fixing that, too. Signed-off-by: Boris Ranto <ranto.boris@gmail.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2014-02-06restore: don't trash file capabilitiesDave Chinner1-39/+77
xfsrestore fails to restore file capabilities correctly because it sets the owner on the file after it has restored the capability attributes. This results in the kernel stripping the capabilities when changing the owner of the file and hence the restored file is not complete. Fix this by changing the owner of the file when it is created rather than after it has been fully restored. This ensures we don't kill the caps as they are restored after the owner it appropriately set. This fixes the xfs/296 failure. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
2013-10-18xfsdump: handle large, wholly-sparse filesEric Sandeen1-0/+5
In restore_extent_group(), we loop over all extent headers for an inode in the stream, and add up the cumulatively restored size, accounting for both HOLE and DATA records and advancing restoredsz as we go. But for a wholly-sparse file, we have no HOLE header, only a LAST header, and restoredsz remains at 0. This makes it look like it's a partially-restored file, split across streams because the final restoredsz for this stream is less than the file size, and we go to partial_reg(), which allocates one slot in persp->a.parrest[] for this inode. But we've also called partial_reg() with offset/sz of 0/0, which is less than the file size so this inode never looks "done." Normally partial_check2() would clear the persp->a.parrest[] slot in the array when the file is fully restored, but in this case, that is never satisfied. So all stream slots get filled as we encounter more inodes like this, and we eventually get: "partial_reg: Out of records. Extend attrs applied early." Fix this by recognizing that if we hit a LAST header with no restoredsz set (i.e. the LAST header is the only header), set restoredsz to EOF (bstatp->bs_size) to indicate that restoration of this file is complete, skip the call to partial_reg(), and all is well. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
2013-10-18xfsdump: fix DEBUGPARTIALS buildEric Sandeen1-6/+12
The DEBUGPARTIALS debug code might have been helpful in this saga, so get it building again. The primary build failure is that STREAM_MAX isn't defined for the num_partials[STREAM_MAX] array; the loop which uses that array iterates "drivecnt" times, so just allocate an array of that size. Fix a few printf format warnings while we're at it. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
2013-10-18xfsdump: avoid segfault in partial_reg() in error caseEric Sandeen1-0/+1
If we go down the "/* Should never get here. */" path in partial_reg(), we issue a warning but then continue with the function. This calls pi_unlock() twice, but worse, uses a null isptr: if ( ! isptr ) { ... isptr is never set if we get to ... /* Should never get here. */ pi_unlock(); ... } ... /* Update this drive's entry */ bsptr = &isptr->is_bs[d_index]; if (bsptr->endoffset == 0) { >From all appearances, because we unlock on that "never get here" path, it should just be returning after printing the warning. So add that, and we avoid the segfault. The previous fix to partial_reg() should prevent us from hitting this in the first place. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
2013-05-083.1.3 releasev3.1.3Ben Myers1-1/+1
Signed-off-by: Ben Myers <bpm@sgi.com>
2013-05-08xfsdump: Update version numbers and changelog.Rich Johnston4-2/+19
2013-02-19xfsdump: update 'make deb' to use tarball archiveBen Myers3-22/+13
This patch changes the build process so that 'make deb' uses the same process of creating a source tree as the release script. * Add a list of files which go in the release tarball in .gitcensus This is needed so that you can create a tarball in a bare release tree, when .git is not available. * Modify the SRCTAR target to include files from .gitcensus and use tar instead of git archive. * Modify the SRCTARINC files to include .gitcensus, and include .gitcensus in the 'make realclean' target. * remove the 'make source-link' target. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Nathan Scott <nathans@debian.org> Reviewed-by: Dave Chinner <dchinner@redhat.com>
2013-02-01xfsdump: Refactor release scripts to conform to using git archiveAndrew Dahl2-3/+10
Refactored release scripts to conform to using git archive When generating a release, there is a risk of some files being stale, such as configure and the m4/autotools temp files. This is fixed with a clean at the beginning of the release generation. In addition, there is no uniformity in the current method of source tar generation between xfs utilities. Using git archive solves this issue accross all utilities. Signed-off-by: Andrew Dahl <adahl@sgi.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2013-01-31xfsdump: zero bs_forkoff, don't fill in the valueEric Sandeen1-1/+1
In xfsdump 3.1.2 I explicitly added the bs_forkoff member to this structure; I tried to be good and explicitly fill in a value. However, previously it was initialized to zero, (by virtue of being missing) and now we're giving it a value (which is ignored by restore, other than to checksum it). By putting in a non-zero value, I broke checksumming when an xfsdump with a non-zero forkoff was restored by an older xfsrestore that doesn't know about the field. Fill in 0 to fix backwards compatibility. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reported-by: Fugazzi99 <fugazzi99@gmail.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2013-01-04xfsdump: fix format string in restore_spec()Alex Elder1-1/+1
Nigel Tamplin reported getting a seg fault in xfsrestore when a path name was too long. He correctly diagnosed that the problem was due to an extra "%s" format specifier in the format value passed to a call to mlog(). This patch corrects that. Signed-off-by: Alex Elder <elder@inktank.com> Reported-by: Nigel Tamplin <ntamplin@codefaber.co.uk> Tested-by: Nigel Tamplin <ntamplin@codefaber.co.uk> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-12-13xfsdump: update version to 3.1.2v3.1.2Ben Myers4-4/+11
Update version to 3.1.2 and change the release script to create a source tarball by default and sign it. Signed-off-by: Ben Myers <bpm@sgi.com>
2012-11-02xfsdump: fill in bs_forkoffv3.1.1-rc2v3.1.1Eric Sandeen2-0/+2
Upstream, the structure containing bs_forkoff is actually zeroed prior to these functions, but when pulling the patch back to an older xfsdump, we got checksum errors due to an uninitialized bs_forkoff not matching in dump vs. restore. So even though forkoff won't be explicitly restored from a dump, do explicitly set it in these routines to keep checksums happy. This fixes 'bad header checksum' errors in xfsrestore, which were introduced by commit 1e309da7. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-31xfsdump: update version and changelogBen Myers4-2/+17
Update the version and changelogs for xfsdump. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Reviewed-by: Nathan Scott <nathans@debian.org>
2012-10-31xfsdump: enable gettextBen Myers1-0/+4
ENABLE_GETTEXT was not being defined when --enable-gettext was specified as a config option, neither the German or Polish translations were working. Add this define to builddefs.in See commit e84ec15d in xfsprogs. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Phil White <pwhite@sgi.com>
2012-10-31xfsdump: Update .gitignoreBen Myers1-110/+110
Root entries to where they only can occur. Reported-by: Jan Engelhardt <jengelh@inai.de> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-31xfsdump: build: use new autoconf constructsJan Engelhardt1-2/+4
Looks like AC_CONFIG_FILES existed since 2.14 already. Signed-off-by: Jan Engelhardt <jengelh@inai.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-31xfsdump: Polish translationJakub Bogusz2-1/+3937
An initial Polish translation for xfsdump (3.1.0), from Jakub Bogusz. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Phil White <pwhite@sgi.com>
2012-10-26xfsdump: Revert dump version bump for 32bit projid fixv3.1.1-rc1Eric Sandeen2-5/+2
commit 1e309da7a4f7e2a2f456bf6b7cea4c5f1181cd36 fixed xfsdump to properly save & restore the top 16 bits of a 32-bit projid, which otherwise was being dropped (and restored as 0) in older xfsdump. The original thought was to bump the dump version, so that we know whether the dump (may) have the top 16 bits filled in. In practice this would prevent older restores from restoring newer dumps, and losing the top 16 bits contained in these newer dumps. However, in hindsight this appears to be of limited value. I propose that the dump version change is unuseful/unwanted for a couple reasons: * There is no actual dump *format* change; the structure size is the same, and the top 16 bits were properly zeroed before; old restores will read these fixed dumps without problems and without restoring garbage. IOW, they will behave exactly as buggily as they did before. And worst case, if a dump containing the top 16 bits is mangled by an old restore, this can be easily remedied by simply re-restoring with updated userspace. * We have no reliable method to know whether 32 bit project IDs are in use; the feature flag was not added to the GEOM call at the time of implementation. Therefore we cannot reliably bump to V4 only for projid32bit filesystems, and we cannot restrict V4 restores only to projid32bit filesystems. So the dump version is not useful for feature cross-checking purposes. I spoke with wkendall via email, and although he may not have given it the most scrutiny (having moved on from xfsdump-land), he also felt that a version dump may not be warranted. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-25xfsdump: rename configure.in to configure.acBen Myers1-1/+1
configure.in has been renamed to configure.ac. Update the Makefile. Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com>
2012-10-24xfsdump: install shared libs with +x bitsMike Frysinger1-1/+1
These are shared libs w/executable code, so make sure they have +x bits set on them. Some kernels will proactively disallow executable mmaps if the files lack +x bits. It's also the right thing to do. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-24xfsdump: respect DESTDIR when installingMike Frysinger1-0/+2
This makes the `make install DESTDIR=...` form work. It keeps support for all previous forms too (like DIST_ROOT). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-10-24xfsdump: rename configure.in to configure.acMike Frysinger1-0/+0
Newer autotools warn and start to error with the older name. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Ben Myers <bpm@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-09-19xfsdump: followup to German translationStefan Ring1-23/+23
A few fixups to the German translation for xfsdump from Stefan Ring. Signed-off-by: Ben Myers <bpm@sgi.com>
2012-09-19xfsdump: German translationNathan Scott2-1/+3992
Thanks to Chris Leick <c.leick@vollbio.de>, reported via Debian BTS as bug #576257. Signed-off-by: Nathan Scott <nathans@debian.org> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-09-18xfsdump: save & restore 32-bit projidsEric Sandeen7-10/+29
Current xfsdump/xfsrestore only recognize the lower 16 bits of the projid. With this patch, the full 32 bits are dumped & restored. Reported-by: Boris Ranto <branto@redhat.com> Cc: Arkadiusz Mi?kiewicz <arekm@maven.pl> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Ben Myers <bpm@sgi.com>
2012-09-06xfsdump: Use installed libraries onlyRich Johnston1-4/+0
If a local library was found and not installed, libtool will create a wrapper script to call the binary from the .libs directory. This patch will remove searching for local libraries so that the installed libraries are always used. Signed-off-by: Rich Johnston <rjohnston@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Ben Myer <bpm@sgi.com>
2012-03-223.1.0 releasev3.1.0Ben Myers1-1/+1
Signed-off-by: Ben Myers <bpm@sgi.com>
2012-03-22xfsdump: update summaries in preparation for release 3.1.0Ben Myers3-2/+23
Signed-off-by: Ben Myers <bpm@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Nathan Scott <nathans@debian.org>
2012-03-02xfsdump: dirs being created in list-only restoreBill Kendall1-5/+9
When xfsrestore is run with the -t option, it lists the files contained in the dump but does not restore anything. This patch fixes code that creates an orphaned file's parent directories without checking to see if this is a list-only (table-of-contents) restore. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-03-02xfsdump: handle files with no extent headersBill Kendall2-10/+32
Normally the first file header for a given file in xfsdump is followed by one or more extent headers along with the file data. If there is a problem opening the file, the file header will not be dumped and the file will not be created during a restore. This is working as designed. However if the inode indicates the file has extended attributes, a file header will be dumped followed by an extended attribute header. Since this is the first file header xfsrestore sees for the file, it expects to see an extent header and bails out complaining about an extent header checksum error. This patch changes xfsrestore to look for the extended attribute flag on the file header even if it's the first file header seen for the file. The result is a zero-length file will be restored along with the extended attributes, if they were successfully backed up. More importantly, xfsrestore will continue on to restore the rest of the backup. This patch also changes xfsdump so that if it fails to open a file, it does not try to dump the extended attributes. This prevents xfsrestore from creating zero-length files in the situation described above. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-03-02xfsdump: use the full 32-bit generation numberBill Kendall16-120/+335
xfsdump historically has truncated the inode generation number to the low 12 bits when writing out directory entries. This makes it possible for xfsrestore to mistakingly think 2 directory entries refer to the same inode when dealing with incremental or resumed dumps. A message such as this is an indication of this problem: WARNING: unable to unlink current file prior to restore This patch changes xfsdump to use the full 32-bit inode generation number. A change to part of the dump format (direnthdr_t) was required, so the dump format version has been bumped to 3. xfsdump also required changes to its inode-to-generation cache. This map is not persistent though, so no compatibility or version changes were required there. xfsdump can still generate a format 2 dump using the new -K option. This is useful when moving a filesystem to a system with an older version of xfsrestore. xfsrestore has been changed to support the old and new dump formats. This required a change to its persistent data structures (for cumulative restores), so the housekeeping version number was bumped as well. When restoring a series of incremental/resumed dumps, if the oldest restore used 12-bit generation numbers then they will be used throughout the restore series to avoid mass confusion. In the rare case that a cumulative restore is done using a format 3 dump followed by a format 2 dump, the user must specifically tell xfsrestore to use format 2 generation numbers throughout the restore series by using the -K option on the first restore. It's recommended that users do a level 0 backup of their filesystems with the new xfsdump so that future incremental restores can take advantage of the full 32-bit generation number. This patch also fixes a couple of instances where the dump format was being displayed with an incorrect value. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-05xfsdump: allow system() to obtain exit statusBill Kendall1-4/+7
xfsdump explicitly ignores SIGCHLD in order to prevent librmt rsh processes from becoming zombies. However, doing so interferes with the ability for system() to determine a command's exit status. Setting up a handler for SIGCHLD will not work either, since xfsdump is now multi-threaded and the main thread (which handles signals) might handle a child exit before the thread running system() can. I also attempted to use waitpid() when tearing down a librmt session, but this has the potential to block indefinitely if there is a problem on the remote side. (And using WNOHANG tended to never catch the exit.) In the end, I settled on just not touching SIGCHLD at all. There may be a zombie rsh when librmt is used, but typically it will be alive until the end of the backup and in any case will be cleaned up when xfsdump/restore exits. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2012-02-05xfsdump: fix restore of ext attrs on root directoryBill Kendall1-1/+1
xfsrestore fails to restore extended attributes on the root directory because Node2path(), which returns a pathname relative to the restore root, returns an empty string instead of ".". Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-12-08xfsdump: obsolete excluding files by extended attrBill Kendall2-42/+1
xfsdump supports excluding files by setting the "no-dump" flag using chattr, or by adding an extended attribute named "SGI_XFSDUMP_SKIP_FILE". The former is the preferred method, and a deprecation warning has been issued for 5+ years if the latter method is used. This patch removes support for the "SGI_XFSDUMP_SKIP_FILE" attribute. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-20xfsdump: add .ltdep to .gitignoreBen Myers1-0/+1
Make git ignore all .ltdep files. They are created as part of the build process: inventory/.ltdep librmt/.ltdep Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-20xfsdump: handle Ctrl-D during promptsBill Kendall1-11/+22
xfsdump does not currently handle Ctrl-D well during a dialog prompt. If some text is entered followed by Ctrl-D, an assert will trip because xfsdump expects a new-line character at the end of the user's input (or if asserts are disabled, the last character the user entered will be dropped). If Ctrl-D is entered without entering any response, some dialog callers (e.g., tree_subtree_inter()) will abort because they receive an unexpected response code. This patch changes xfsdump to behave like other interactive commands (xfs_db, bash, parted, ...) with respect to Ctrl-D. If Ctrl-D precedes any input, an empty string is returned. If Ctrl-D follows some input, it is ignored and xfsdump will continue to wait for more input. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: enable multiple streamsBill Kendall12-194/+74
IRIX contained an environment referred to as "miniroot" where sproc threads were either not available, or at least not used in xfsdump. Throughout xfsdump there's a "miniroot" variable which indicates whether or not thread support is enabled. On Linux this variable has always been false in order to disable support for multiple streams. Now that the threading infracstructure has been converted over to pthreads, this patch removes the "miniroot" variable and enables the option of using multiple streams. Note that another feature in xfsdump, using a ring buffer for I/O to tapes, also depends on thread support. I'm leaving that disabled for now until more testing has been done. Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: path lookup cache must be thread specificBill Kendall1-1/+1
The xfsrestore path lookup routine (maps an ino + generation number to a pathname) contains a cache for fast lookups of consecutive files in the same parent directory. This cache either needs to be protected by a lock or a cache is needed per thread. I took the latter approach since it doesn't add lock contention and it increases the cache hit rate (it's relatively unlikely that each stream is processing files in the same directory). Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: process thread exit statusBill Kendall5-59/+73
When IRIX sprocs were in use, the main thread was notified of a thread exit just as if a child process exited -- it received SIGCHLD. The main thread would grab the pid and exit status, then call cldmgr_died() to inform it that the child was gone so the slot in the child array could be freed up for reuse. This patch implements a similar mechanism for pthreads. The "c_busy" field in struct cld has been replaced with a "c_state" field that indicates whether the array slot is free (C_AVAIL), in use (C_ALIVE), or is waiting to be joined (C_EXITED). Additionally a "c_exit_code" field has been added to store the thread's exit value. Normally this is set when the thread entry function returns, but it is initialized to EXIT_INTERRUPT in case the thread is cancelled or calls pthread_exit() rather than returning (neither of which happens in the code today). When the child thread starts, it registers a pthread cleanup handler which takes care of marking the child as C_EXITED and notifies the main thread that a child is gone. Doing this in a cleanup handler ensures that it's done regardless of how the thread exits. The main thread's loop is based around sigsuspsend(), so the notification is done by sending SIGUSR1. The main thread will then call cldmgr_join() to join all exited threads and obtain their exit status. Additional changes: * cldmgr_findbypid() has been removed, it's no longer referenced. * stream_dead() no longer grabs the lock(), because it's called only from cldmgr_join() which already holds the lock(). Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: convert IRIX sproc threads to pthreadsBill Kendall18-217/+127
The existing (disabled) threading code in xfsdump is based on IRIX sprocs. This patch converts the code to use pthreads. The threading code remains disabled at this point. Changes: - pid_t to pthread_t - getpid() to pthread_self() - "pid1 == pid2" to pthread_equal(tid1, tid2) - sigprocmask() to pthread_sigmask() - sproc() to pthread_create() Also the following are not referenced and have been removed: - cldmgr_pid2streamix() - PROCMAX - r_slavepid - sproc.c and sproc.h Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: simplify qlock ordinal bitmapBill Kendall4-199/+14
The qlock abstraction manages an array of ordinal bitmaps, one bitmap for each thread. The bitmap indicates which locks a thread is holding and is used to verify that the locks are obtained in the correct order. There is no need to use an array to store the bitmaps, and in fact adding entries to the array is broken because qlock_thrdcnt is not protected by a lock. A simpler approach is to create a per-thread bitmap using thread local storage. With this change, there is no need for each new thread to register with the qlock abstraction, so qlock_thrdinit() goes away. Remove qlock_init() since it can be statically initialized, and that means there's no need for a flag (qlock_inited) indicating that the module has been initialized. Also there's no longer a need to track or limit the number of threads that the qlock abstraction can handle. Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: implement lock abstraction with pthreadsBill Kendall5-303/+88
This patch implements xfsdump's locking abstraction using pthread locking primitives. The obsolete IRIX locking code has been removed. The POSIX semaphore implementation on Linux does not provide a count of threads waiting to decrement the semaphore, so qsemPblocked() has been removed. It was called from a few asserts, but the current count of the semaphore was also checked in adjacent asserts, so it was deemed acceptable to remove the qsemPblocked() asserts. A few debug-level log calls had to be changed to use the "no lock" flag to prevent locks from being acquired out of order. This is used in various debug messages throughout xfsdump. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: remove multi-stream synchronous dir dumpBill Kendall4-199/+75
When doing multi-stream dumps, the directories are dumped by each stream in lock-step fashion. A stream backs up a given directory, then waits for all others to finish that directory, then they all move on to the next one. During restore a single stream is chosen to apply the directory dump. This patch changes xfsdump so that only one stream dumps the directories. The other streams begin dumping files immediately. This results in a faster backup, which is presumably why multiple streams are being used in the first place. It also removes the barrier routines in qlock.c as they were only used by the "SYNCDIR" code. Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10xfsdump: link with libpthreadBill Kendall6-2/+26
This patch changes xfsdump/xfsrestore to link with libpthread in preparation for enabling multi-stream support. The libpthread checks are the same as those used in xfsprogs. Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-10path: fix 1 byte overflow with empty listsMike Frysinger1-0/+2
If pap->pa_cnt is 0, then the local buffer is allocated as 1 byte, but the code then writes two bytes to it '/' and '\0'. Reviewed-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-03xfsdump: incremental dump directory selectionBill Kendall8-8/+57
When doing incremental backups, xfsdump does a recursive scan through the filesystems to determine the proper set of unchanged directories to include in the dump in order to make the dump self-contained (allowing files to be restored from this dump without applying the base dumps first). For high-inode count filesystems, the recursive scan may consume a significant portion of the backup time. This patch adds a -D option which causes xfsdump to skip the recursive scan. Unchanged directories will not be dumped, so the base dump(s) will have to be loaded prior to restoring files from the dump. When restoring files from such a dump, a message is issued to alert the user that files may end up in the orphanage if the base dump(s) has not been applied. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-11-03xfsdump: fix metadata restore on split filesBill Kendall1-17/+33
xfsrestore does not apply certain metadata until all of the file's data has been restored. This allows, for example, files with the immutable flag set to be restored properly. While testing multi-stream restores, I noticed that files split across multiple streams did not have their metadata restored. Looking into this further, it also can occur with just a single stream when the dump spans multiple tapes. Specifically it requires that end-of-tape is hit just as a file is finished (before a new file is begun), and the restore is performed as separate xfsrestore invocations (one per tape). The fix is to check to see if a file is completely restored whenever we hit the end of a media file. The current code is broken because it relies on all media files being applied during the same restore session. This also moves the S_ISREG() check into restore_complete_reg() rather than relying on callers to make the check. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-10-143.0.6 releasev3.0.6Alex Elder2-6/+4
Signed-off-by: Alex Elder <aelder@sgi.com>
2011-10-14xfsdump: update summaries in preparation for release 3.0.6Alex Elder3-1/+17
Signed-off-by: Alex Elder <alder@sgi.com> Reviewed-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2011-09-29xfsdump: handle dump files with checksum bugBill Kendall2-9/+26
xfsdump previously contained a bug in the code which generated a checksum on the header for extended attributes. This bug was recently fixed, but a new xfsrestore will fail if it encounters an old dump file which had checksums enabled. (This is unlikely since checksums have just recently been enabled in the build, and the above-mentioned bug was fixed at the same time.) This patch uses a new flag in an extattrhdr_t to indicate a checksum is present. If this is set, the checksum is validated. If instead the old checksum flag is set, a warning is issued saying the header could not be validated, and xfsrestore will assume the header is valid. Note that with this change a new dump cannot be restored with an old restore which has checksums enabled. But as I mentioned, old restores do not have checksums enabled. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-09-23invutil: fix a gcc warningChristoph Hellwig1-2/+1
We never use the lines variable in put_line, except by writing to. Replace the fairly ugly getmaxyx macro causing this with the getmaxx call (which is used by getmaxyx underneath) to only get the number of columns. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-09-21xfsdump: call mlog_exit in content_stream_restoreBill Kendall1-41/+35
This patch adds mlog_exit() calls to all the return paths in content_stream_restore(). mlog_exit() is supposed to be called before returning from content_stream_dump() and content_stream_restore(), but the latter did not do so, allowing for the stream exit status to be unset. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-09-21xfsdump: remove redundant error code mappingBill Kendall2-17/+7
Currently there is both an exit_strings array and an exit_codestring() function for mapping an exit code to a string. They are very similar except the latter prefaces every string with "EXIT_" and the former uses "SUCCESS" instead of "NORMAL", and cannot handle an invalid exit code. exit_codestring() is not currently used in active code (it's for multi-stream), so its values can be changed to allow the exit_strings array to be removed. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-09-21xfsdump: remove unnecessary #ifdefsBill Kendall15-208/+19
There are a number of #defines in xfsdump that are always enabled and no longer need to be conditional code. This patch removes the following macros and enables the related code unconditionally: - SIZEEST is required for multi-stream dumps for determining split points. - RMT, BASED and SESSCPLT are tied to command line options (dump/restore -m, dump -B and restore -Q, respectively). - INVCONVFIX, PIPEINVFIX, and EOMFIX are all related to fixes that went in a long time ago. - WHITEPARSE allows for filenames with spaces and special chars to be properly parsed during an interactive restore session. - DOSOCKS allows Unix domain sockets to be backed up and restored. Other special files (block/char devs, FIFOs) are always backed up, so do the same for sockets. Additionally the definition of F_FSSETDM has been removed from restore/Makefile since it is never referenced. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-09-21xfsdump: enable dump header checksumsBill Kendall4-103/+44
Various structures in a dump file optionally contain a checksum, but the code to compute and validate the checksum has not been enabled. The checksum code has a negligible performance impact and so this patch enables the checksum code unconditionally. Also: - make sure all header sizes are multiples of 4 bytes (a requirement of the checksum routine) - zero structures to ensure internal padding has a known value - fix a bug in dump_extattr_buildrecord() which checksummed the wrong header structure - add calc_checksum() and is_checksum_valid() routines to cut down on duplicate code Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: refactor exit_codestring()Bill Kendall2-34/+11
Simplify exit_codestring(), which maps an exit code into a string. Make it available to all code which includes "exit.h". Also remove the unused type "exit_t". Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: refactor ring_createBill Kendall4-54/+15
ring_create() takes a thread creation function pointer. The two callers of ring_create() pass pointers to identical but separate functions. This can be simplified by moving the thread creation code into ring_create() itself. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: refactor inventory session creationBill Kendall1-83/+92
Move the inventory session creation out of content_init and into a new function, create_inv_session, in order to simplify restoration of the signal mask. TTY-related signals are blocked prior to calling create_inv_session and restored afterwards. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: convert to the POSIX signal APIBill Kendall5-111/+79
Convert from using the System V signal API to the POSIX API. For xfsdump, this mostly means replacing sigrelse/sighold with sigprocmask, sigset with sigaction and sigpause with sigsuspend. Note that sigprocmask calls will be replaced with pthread_sigmask when pthread support is added to xfsdump. childmain() and cldmgr_entry() are thread entry points. By the time they are spawned the main thread will have already set its signal mask, so no need to setup signals in the thread as the mask is inherited. ring_slave_entry() is a thread entry point but is spawned before the main thread has its signal mask setup. Setup the thread's mask to block the same signals that the main thread will block. The main thread should be reworked to set its mask earlier, but that will require a fair amount of refactoring that is beyond the scope of this patch. Also simplify code to generate a core file to just use abort() rather than sending SIGQUIT and then waiting for it to arrive. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: rework dialog to use main signal handlerBill Kendall3-15/+26
xfsdump currently swaps in a different signal handler for the duration of a dialog. This patch changes the code to have a global signal handler which will first give the dialog a chance to process the signal. If a dialog is not active or if it is not interested in the signal, the signal will be processed as usual. There is one side effect to this change. SIGQUIT is now caught in the miniroot/pipeline case as the handler needs to be setup in case a dialog needs it. The signal handler will exit in this case just as if SIGQUIT was not caught, the only real difference being that a core file will not be generated. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: rework dialog timeout and EINTR relianceBill Kendall1-26/+39
The current dialog code uses alarm(2) to implement the dialog timeout. This is suboptimal as the main loop already makes use of alarm. Additionally the existing code relies on its blocking read(2) being interrupted if a signal is received. This is not guaranteed to work as a signal may be delivered to a different thread. Both of these issues can be resolved by using select(2) rather than a blocking read. 'dlog_allowed_flag' and 'dlog_signo_received' are now marked 'volatile' to prevent them from being optimized out from being checked during a loop. This also changes dlog_desist() to not change 'dlog_ttyfd', as that could impact a dialog already in progress. Clearing 'dlog_allowed_flag' is sufficient to disable dialogs. Finally add an assert to dlog_string_query() to check that dialogs are allowed to make it consistent with other promptinput() callers. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-26xfsdump: remove SIGCHLD handlingBill Kendall4-160/+33
The multi-stream version of xfsdump for IRIX used sprocs for threading. When a "thread" exits with sprocs, a SIGCHLD is sent to the main thread just as if a regular child process exited. A future multi-stream version of xfsdump will use pthreads, so the SIGCHLD processing is no longer needed. The only processes forked from xfsdump now are librmt rsh sessions, and xfsdump doesn't process their exit status (instead relying on failed librmt calls.) So explicitly ignore SIGCHLD now so that if rsh sessions exit early they do not become zombies. cldmgr_killall() is no longer useful as there are no children registered with the child manager module, and in the future with pthreads all threads will exit just by exiting the main thread. Also cleanup sighandler() by removing signal handling code for child processes and removing SIGCHLD handling in the parent process. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-09xfsdump: process EPIPE instead of catching SIGPIPEBill Kendall4-55/+7
Looking forward towards a multi-threaded xfsdump, it's simpler to handle pipe failures as a system call failure (EPIPE) rather than through a signal handler which may run in a separate thread. The existing error handling code handles EPIPE just fine, so the only required change is to ignore SIGPIPE. Some sections of code already temporarily ignore SIGPIPE -- they no longer need to do so since it will already be ignored. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-09xfsdump: remove conditional OPENMASKED codeBill Kendall2-112/+4
xfsdump contains a couple wrapper functions which block signals during an open(2) call. This code is conditionally compiled and has not been enabled for a long time. Remove the wrappers rather than converting them to use the POSIX signal API. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-09xfsdump: allow multi-digit dialog promptsBill Kendall1-12/+9
xfsdump issues a multiple-choice dialog in various circumstances (e.g., media change request). An assert incorrectly limits this to at most 8 choices even though the code can handle up to 9. Remove the assert and change the code to handle multi-digit responses. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-08-02build using CFLAGS passed in at configureTheodore Ts'o1-0/+1
In order to build xfsprogs in a hermetic build, we need be able to pass in -I and -L flags to the compiler and linker, respectively. This needs to be used by the configure script, but we also need to make sure these flags are used by the Makefiles as well. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-07-22configure.in: declare a requirement for at least autoconf 2.50Theodore Ts'o1-0/+1
On Debian/Ubuntu systems, if autoconf version 2.13 is installed, autoconf will try to automatically figure out whether autoconf 2.13 or something more modern is required (since the autoconf maintainers, curses be upon them, didn't bother to maintain compatibility between autoconf 2.13 and 2.50). Unfortunately, the hueristics aren't perfect, and although the configure.in file looks superficially like it will be compatible with autoconf 2.13, it isn't. You will end up with a number of very subtle compilation failures if you use autoconf 2.13. So declare a requirement for autoconf 2.50 using AC_PREREQ(2.50). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Christoph Hellwig <hch@lst.de>
2011-07-17xfsdump: don't hard code shell configurationDave Chinner2-1/+1
Recent changes to debian unstable user space have caused the xfsdump build to break as certain shell functionality is being assumed by libtool and friends. The configure scripts test and select the correct shell, but the input files ignore this and hard code the shell to use and hence now break. Fix this by using the shell that the configure scripts decide is the right one to use. Signed-off-by: Dave Chinner <dchinner@redhat.com>
2011-03-303.0.5 releasev3.0.5Alex Elder2-2/+2
Signed-off-by: Alex Elder <aelder@sgi.com>
2011-03-30xfsdump: update CHANGES file for releaseAlex Elder2-0/+33
Update the CHANGES file in preparation for releasing xfsdump 3.0.5. Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Nathan Scott <nathans@debian.org>
2011-03-01xfsdump: fix bug restricting -f pathname lengthBill Kendall1-17/+1
A temporary buffer storing the dump filename (-f) is smaller than the otherwise allowed pathname length. This buffer is used to extract the pathname from additional parameters specified as part of the -f argument. As these parameters are an undocumented and unused extension of the -f argument, simply remove this code. Note that drive_alloc() always dups the given pathname, so 'optarg' is passed directly. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2011-03-01xfsdump: prune inventory sessions by session idBill Kendall4-25/+91
Add a new "-s <sessid>" option that allows xfsinvutil to prune inventory sessions by their ID instead of only by filesystem and cutoff date. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsdump: fix xfs_invutil dependency generationBill Kendall1-1/+1
Correct the target name for dependency generation in the invutil Makefile. This is now consistent with other dump makefiles and eliminates "No such file or directory" errors during the build. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsdump: remove old namreg codeBill Kendall3-323/+1
Remove the old, unused namreg code under the 'common' directory. This was superceded a long time ago by the version under the 'restore' directory. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: check for compatible xfsrestoreBill Kendall2-10/+108
When resuming a restore or doing a cumulative restore, xfsrestore reads state information left around by the previous invocation. This patch adds logic to determine whether or not restore is able to make sense of the sense information. The xfsrestore man page has also been updated to make the user aware of the requirement to use a compatible restore and system when resuming restores. Signed-off-by: Bill Kendall <wkendall@sgi.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: remove nix_tBill Kendall1-68/+44
The nix_t type is a 64-bit version of a (32-bit) nh_t, created "to facilitate conversion to a 64-bit offset." At this point there's only one case where an nh_t is converted to an off64_t, so just do an explicit cast in that case and remove the nix_t. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: make node lookup more efficientBill Kendall3-149/+129
When converting an nh_t to a segment index and relative node index, use shift and bitwise-and instead of division and modulo. Results show this is about 50% faster than the current method. Signed-off-by: Bill Kendall <wkendall@sgi.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: fix node table setupBill Kendall3-55/+80
The node table setup code unintentionally limits the amount of virtual memory that will be used for the node table. Rather than setting a limit based on the remaining virtual memory, the node table is limited to the amount of memory it thinks it will need based on the dump's inode count. But the node table stores directory entries, not inodes, and so dumps with lots of hard links end up thrashing mapping and unmapping segments of the node table to stay within the self-imposed virtual memory limit. This patch also changes the node table to ensure that there are a power of two nodes per segment. Profiling revealed that while building the node table, 50% of the restore cpu time was spent doing division and modulo to convert a node index into its segment index and offset within the segment. This change prepares the node table for another patch which will change the lookup mechanism to use shift and bitwise-and. Also don't bother passing the estimated segment table size to the window abstraction. It has to deal with resizing the table anyway and can choose a reasonable starting size. Signed-off-by: Bill Kendall <wkendall@sgi.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: cleanup node allocationBill Kendall1-104/+38
Simplify the node allocation code. The current code takes some number of nodes from a new segment and links them into the freelist whenever the freelist is depleted. There's no reason to put the new nodes on the freelist, we can just allocate the next available new node as needed. This also saves a trip through win_map/win_unmap if there are no nodes on the freelist (the common case). Newly allocated nodes are no longer zeroed in this code, but all allocations are done through Node_alloc which does initialize each field. Also remove a couple of TREE_DEBUG messages that were not useful. Signed-off-by: Bill Kendall <wkendall@sgi.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: mmap dirent names for faster lookupsBill Kendall3-33/+73
Pathname resolution in xfsrestore is about 4x faster if the file containing dirent names ("namreg") is memory mapped. If xfsrestore is unable to map the file (e.g., due to virtual memory constraints) fallback to the existing seek-and-read approach. The file is mapped after all directory entries have been written to the "namreg" file. If the caller tries to add additional entries after the file has been mapped, it will be unmapped and restore will resort back to seek-and-read lookups. Signed-off-by: Bill Kendall <wkendall@sgi.com> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: cache path lookupsBill Kendall1-5/+37
In order to resolve a pathname, xfsrestore must work from an inode number (from the dump) and recurse up the directory entry tree that it has constructed. Each level of recursion requires a seek and read to get the name of the dirent, and possibly a mmap of a section of the directory entry tree if it is not already mapped (and in that case, possibly a munmap of another section). It's quite common to resolve pathnames in the same directory consecutively, so simply caching the parent directory pathname from the previous lookup saves quite a bit of overhead. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: change nrh_t from 32 to 64 bitsBill Kendall3-30/+23
An nrh_t refers to a byte offset in a file containing all the pathname components from a dump. At an average filename length of 20 characters, an nrh_t would overflow on a dump containing ~214 million directory entries. Removing this limitation allows xfsrestore to handle 4 billion directory entries. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-11-29xfsrestore: turn off NODECHKBill Kendall2-2/+4
The NODECHK macro should only be enabled as needed for development/debugging. Having it on limits xfsrestore to dumps with 268 million directory entries instead of 4 billion. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-09-11xfsdump: add missing sys/stat.h includesMike Frysinger3-0/+3
Newer glibc is better about namespace pollution. That means package need to include sys/stat.h if they wish to use things from it. Xfsdump fails in a few spots due to this.
2010-08-03xfsdump: fix depend targetsAlex Elder6-13/+17
There's no need to re-make the dependency files all the time. Make it so the "depend" target rebuilds the ".dep" file only if necessary. Also change the name of the dependency file created for "ltdepend" to be ".ltdep". Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
2010-07-22fix configure --prefixChristoph Hellwig1-3/+8
We need to substitute root_sbindir and root_libdir even for the case where we don't have the different from the default prefix, otherwise xfsdump won't build for that case with rpath errors, and wouldn't install correctly either. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reported-by: Christian Kujau <lists@nerdbynature.de> Tested-by: Christian Kujau <lists@nerdbynature.de>
2010-05-17unbreak make update-poArkadiusz Miśkiewicz1-1/+1
Unbreak make update-po. Was causing: "/bin/sh: ../po/pl.po: cannot execute - Permission denied" Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl> Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-05-17use /bin/bash as install-sh uses bash syntaxArkadiusz Miśkiewicz1-1/+1
Bashizm requires /bin/bash to be used instead of /bin/sh. Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl> Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-05-06xfsdump: exempt quota files from filesize checksBill Kendall3-6/+39
xfsdump backs up quota information by generating quota dump files ("xfs_quota -c dump") in the root of the filesystem being dumped. If the user filters files from the dump based on max file size (-z option) the quota files may not be dumped. The following patch makes the quota files exempt from the max filesize checks. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
2010-02-13xfsdump: digitally sign release tagsAlex Elder1-2/+2
Arrange for the commit marking a new release to include a "Signed-off-by" line, and have the corresponding tag include a digital signature. Signed-off-by: Alex Elder <aelder@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-01-26xfsdump: Automatic build dependency calculationsDave Chinner8-35/+53
Currently the xfsdump builds do not have any automatic dependency calculations. It relies on a separate make depend run to build or update dependency information. It also relies on an external makedepend binary. If that binary does not exist, the dependencies do not get calculated. To remove the dependency on makedepend, gcc can be used instead as it has a command to generate dependency information. This patch changes the dependency rule building to use gcc. In case anyone uses an old (several years) gcc compiler or a compiler that doesn't support gcc compatible dependency generation, a new configure check is added to turn off dependency checking so builds can still be done. To use the dependencies automatically, we need to use a special include makefile directive to include the build dependencies into the current makefile. Essentially once the dependencies are calculated, they can be included into the makefile and make will recalculate the build dependencies automatically based on that information. Hence we get a build that automatically calculates and keeps dependencies up to date without dependence on any external tools. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-01-21xfsdump: Clean up build outputDave Chinner7-33/+67
We don't need to see every compiler command line for every file that is compiled. This makes it hard to see warnings and errors during compile. For progress notification, we really only need to see the directory/file being operated on. Turn down the verbosity of output by suppressing various make output and provide better overall visibility of which directory is being operated on, what the operation is and what is being done to the files by the build/clean process. The old style verbose builds can still be run via "make V=1 ..." Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
2010-01-133.0.4 releasev3.0.4root1-1/+1
Signed-off-by: Alex Elder <aelder@sgi.com>
2010-01-12xfsdump: bump version and update changelogChristoph Hellwig3-1/+12
Including a debian changelog update Nathan sent me earlier. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com>
2010-01-06improve xfsinvutil man page and argument processingBill Kendall3-132/+87
xfsinvtuil's man page is not clear about which options may be used together. The argument processing was not very complete either. Document and enforce the following: * -F and -i are mutually exclusive. * -u and -M are mutually exclusive. * -m requires -u or -M. * Date string can only be passed when using -u and -M. * -n is equivalent to -F. Remove it from the man page, but still support it in case there are scripts out there using it. Also fix an issue parsing time strings which occur during DST. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2010-01-06use time32_t consistently in xfsdump treeBill Kendall22-95/+153
xfsdump stores time_t as 32-bits in its dump and inventory structures for portability/historical reasons. xfsinvutil uses time_t directly, leading to some strange results on systems which have a 64-bit time_t. The 32-bit time-related functions were factored out into their own file since they are now used by xfsinvutil, and their original file (util.c) could not easily be linked with xfsinvutil due to dependencies on many other dump/restore modules. Fix the one case where printf is called with 2 arguments that are calls to ctime32(). This occurs in CheckAndPruneInvIndexFile() -- otherwise the patch is the same. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-12-21update build systemNathan Scott24-594/+211
Update the xfsdump build system to match all the improvements made to xfsprogs. Signed-off-by: Nathan Scott <nscott@aconex.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-11-25Revert "3.0.3 release" and "use lpath_to_handle when restoringAlex Elder4-27/+36
symlinks" This reverts 2 commits that were published 2009-10-23 on oss.sgi.com: bad902e76bef3f8d592ba6fb9a30f290959d8cfe and 040e37332f4c86033fa9f84c95fbe04a4f89ff42 The state of the tree should now match this commit: cd1534881b1eb96b3eef6bb4d00b789cb31b18b8 Signed-off-by: Alex Elder <aelder@sgi.com>
2009-10-233.0.3 releasev3.0.3Alex Elder3-2/+6
Adds more robust handling of symbolic links by xfs_restore. Signed-off-by: Alex Elder <aelder@sgi.com>
2009-10-23use lpath_to_handle when restoring symlinksBill Kendall1-34/+21
Update xfsrestore to use the new lpath_to_handle function when dealing with symlinks. Signed-off-by: Bill Kendall <wkendall@sgi.com> Reviewed-by: Alex Elder <aelder@sgi.com> Signed-off-by: Alex Elder <aelder@sgi.com>
2009-06-05add -x flags to include/install-shRobert Herndon1-0/+0
Signed-off-by: Robert Herndon <rherndon@sgi.com>
2009-05-11Merge branch 'master' of git://oss.sgi.com/xfs/cmds/xfsdumpChristoph Hellwig1-1/+1
Correct the 3.0.1 release date to the real one.
2009-05-10Merge branch 'master' of hera.kernel.org:/pub/scm/fs/xfs/xfsdump-devChristoph Hellwig5-4/+14
2009-05-09Debian packaging updates, and bumped minor version to 3.0.2.v3.0.2Nathan Scott5-4/+14
Signed-off-by: Nathan Scott <nathans@debian.org>
2009-05-053.0.1 releasev3.0.1Felix Blyakher1-1/+1
2009-05-05Modified permission for release.sh: 644 -> 755Felix Blyakher1-0/+0
Signed-off-by: Felix Blyakher <felixb@sgi.com> Reviewed-by: Christoph Helwig <hch@lst.de>
2009-05-02add release.shChristoph Hellwig2-1/+26
Add a little script to automate releases. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Felix Blyakher <felixb@sgi.com>
2009-05-02add .gitignoreChristoph Hellwig1-0/+134
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
2009-04-29keep autoconf-generated files over make distcleanChristoph Hellwig1-11/+14
We do want to ship the autoconf-generated files over make distclean and pick them up in Makepkgs so that a user compiling the program doesn't require autoconf. For that split up make distclean from make realclean and exclude the files we want to keep form the former. To make this easier to maintain adher to stricter rules of use for CONFIGURE and LDIRT. CONFIGURE now includes all generated files from autoconf (or for it like our copied install-sh) and gets only removed on make realclean, but added to LSRCFILES so that Makepkgs can pick it up. Everything else than needs to be removed on a realclean gets assigned to LDIRT. Also split up the configure rule into one to generate the configure script and one to run it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Frysinger <vapier@gentoo.org>
2009-04-23fix libtool spellingChristoph Hellwig1-1/+1
Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Martin Steigerwald <Martin@lichtvoll.de>
2009-04-16xfsdump: bump version and updates CHANGESChristoph Hellwig2-1/+7
Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Felix Blyakher <felixb@sgi.com> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
2009-03-24automake and libtool fixesAndreas Gruenbacher6-513/+20
Remove aclocal.m4 from the repository and generate it when needed. Move the AC_PROG_LIBTOOL autoconf macro and use libtoolize according to the libtool info pages. Make sure that libtoolize adds the auxiliary files (config.guess and config.sub). Move install-sh into include/ so that libtoolize does not destroy it. Split up the ``make clean'' and ``make distclean'' targets: the former removes all files generated during a build. The latter removes all files generated by libtoolize, autoconf, and configure as well. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-03-23fix tarball names generated by MakepkgsChristoph Hellwig3-3/+3
Currently Makepkgs generates the source tarball as xfsdump-version.src.tar.gz, which is not what we used for recent releases and not what most other open source packages do. Change it to xfsdump-version.tar.gz, and rename the binary tarball to xfsdump-version.bin.tar.gz Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
2009-03-21make sure Makpekgs is completeChristoph Hellwig3-9/+4
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
2009-03-16Fix cross-compile issues with libtool and compiler.Barry Naujok3-9/+4
This is equivalent to commit de7b3f6 from Barry Naujok <bnaujok@sgi.com> in the acl package/ Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-02-26remove Distribution/Packager tagJan Engelhardt1-2/+0
There exist a number of rpm specfile tags that make it possible to mislead users of the produced RPM package, because its presence overrides anything that has been specified in ~/.rpmmacros (or the configuration files of the build system used). Such is especially annoying when Packager:/Vendor: is put in specfiles, because it is then almost impossible to get the name/email of the person who _really_ did the packaging (assuming s/he set it in their .rpmmacros). Such similarly applies to the Distribution: tag, which is why I suggest its removal and let the build systems provide the proper string instead. Signed-off-by: Jan Engelhardt <jengelh@medozas.de> Reviewed-by: Christoph Hellwig <hch@lst.de>
2009-02-23xfsdump: fix system() error reportingChristoph Hellwig1-1/+2
Positive returns from system need the WEXITSTATUS macro applies to get the real exit code of the executed command. Based on analysis in oss BZ #804. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Timothy Shimmin <timothy.shimmin@gmail.com>
2009-02-043.0.0 releaseFelix Blyakher1-1/+1
2009-01-30small update for CHANGESChristoph Hellwig1-0/+2
Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Felix Blyakher <felixb@sgi.com>
2009-01-28Update debian packaging for xfsdump-3.0 release.Nathan Scott4-5/+11
Also cleanup a few things - watch file unnecessary and gives us more lintian warnings, ditched. Update uploaders to list those who do the uploading. Signed-off-by: Nathan Scott <nathans@debian.org>
2009-01-28version & rpm spec file updateNathan Scott3-4/+13
Update xfsdump version to 3.0.0 to denote the slightly different relationship with xfsprogs now (moved files, removed libxfs.h dependencies). Reviewed-by: Christoph Hellwig <hch@lst.de>
2009-01-25only symlink development libraries when neededMike Frysinger1-1/+3
We dont want to generate symlinks when the libdir is the same as the devlibdir, otherwise we clobber the real files with broken symlinks. Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Nathan Scott <nscott@aconex.com>
2009-01-24correct CIH_DUMPATTR_SUBTREE settingdean gaudet1-1/+1
subtreep is freed and set to 0 a few lines before the test for setting CIH_DUMPATTR_SUBTREE, which means it never gets set. Check for subtreecnt instead. Note that this flag is unused by xfsrestore so all this is rather harmless. Reviewed-by: Christoph Hellwig <hch@lst.de>
2009-01-24remove files moved over to xfsprogsChristoph Hellwig6-1898/+2
xfs_fsr has been moved to xfsprogs, so delete it from xfsdump. Also remove the xfs_estimate manpage which now has followed the xfs_estimate tool. Signed-off-by: Christoph Hellwig <hch@lst.de>
2009-01-08Various fixes to allow xfsdump/xfsrestore to work with 64KMark Goodwin2-7/+1
page size. This is essentially Chinner's patch from a while back. Signed-off-by: Bill Kendall <wkendall@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com> Signed-off-by: Mark Goodwin <markgw@sgi.com>
2009-01-02xfs_fsr: fix insufficient space checkChris Wedgwood1-6/+12
The xfs_fsr insufficient check should consider the blocks used not the file length. Without this change it is not possible to reorganize sparse files when file size exceeds the free space. Signed-off-by: Chris Wedgwood <cw@f00f.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
2009-01-02fix fsrlast location in --help outputChristoph Hellwig1-28/+4
Make sure xfs_fsr --help outputs the correct location for the fsrlast file. Also add a _PATH_FSRLAST define to not have to keep this multiple times in the source code, and remove a comment in xfs_fsr.c duplicating the help text and manpage. This fixes Debian bug #491525. Reported-by: J?rgen Tegn?r <jorgen.tegner@telia.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Eric Sandeen <sandeen@sandeen.net>