Bug (?) : cumulative xfsrestore does not restore files and folders in a directory which was renamed

Damien Gombault
2016-06-22T14:45:25Z

[-- Attachment #1.1: Type: text/plain, Size: 2121 bytes --]

Hi.

I have reported few weeks ago a bug on the Red Hat Bugzilla for CentOS 7 : https://bugzilla.redhat.com/show_bug.cgi?id=1341126
I had to restore a level0+level1 dump for my ownCloud server, but during the level1 restoration, xfsrestore showed many warnings and some directories/files were not restored.
I recently tried to restore a more recent level0+level1 dump and I get the same results with other directories/files.
I tried to figure out why and now I am able to reproduce the problem with a minimal test case.

Here is the test case :

Create a new XFS filesystem, mount it as "/mnt/test"
Then in "/mnt/test"
Create a directory "dira/"
Create a file "filea" in directory "dira/"
You should get :

.
└── dira
└── filea

Make a level 0 dump :
xfsdump -l 0 -f /root/test0.dump /mnt/test

Rename "dira/" to "dirA/"
Create a directory "dirb/" in "dirA/"
Create a file "fileb" in "dirb/"
You should get :

.
└── dirA
├── dirb
│ └── fileb
└── filea

Make a level 1 dump :
xfsdump -l 1 -f /root/test1.dump /mnt/test

Create a new XFS filesystem, mount it as "/mnt/restore"

Restore (cumulative mode) level 0 dump :
xfsrestore -r -f /root/test0.dump /mnt/restore/

Restore (cumulative mode) level 1 dump :
xfsrestore -r -f /root/test1.dump /mnt/restore/

You get a WARNING :
xfsrestore: WARNING: open of dirA/dirb/fileb failed: Aucun fichier ou dossier de ce type: discarding ino 526337 (No such file or directory in English)
Directory "dirb" and file "fileb" is not restored :

.
├── dirA
│ └── filea
└── xfsrestorehousekeepingdir
├── dirattr
├── dirextattr
├── namreg
├── state
└── tree

I attached test0.dump (level 0 dump), test1.dump (level 1 dump), debug0.txt (xfsrestore level 0 debug trace), debug1.txt (xfsrestore level 1 debug trace).

I can reproduce it on CentOS 7 and Fedora 24.
On Fedora 24, I used :
xfsprogs-4.5.0-1.fc24.x86_64
xfsdump-3.1.6-2.fc24.x86_64
kernel-4.5.7-300.fc24.x86_64

Is there a bug in xfsdump/xfsrestore tools and cumulative restoration feature ?

[-- Attachment #1.2: Type: text/html, Size: 2468 bytes --]

[-- Attachment #2: debug0.txt --]
[-- Type: text/plain, Size: 3414 bytes --]

xfsrestore: raising stack size soft limit from 0x800000 to 0x2000000
xfsrestore: getpagesize( ) returns 4096
xfsrestore: parent tid is 140547709941632
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.4 (dump format 3.0)
xfsrestore: thread 140547587008256 created for stream 0
xfsrestore: Media_create
xfsrestore: checking and validating command line dump id/label
xfsrestore: searching media for dump
xfsrestore: Media_mfile_next: purp==0 pos==0
xfsrestore: examining media file 0
xfsrestore: file 0 in object 0 of stream 0
xfsrestore: file 0 in stream, file 0 of dump 0 on object
xfsrestore: dump found: checking
xfsrestore: dump description:
xfsrestore: hostname: hostrecia1.recia.fr
xfsrestore: mount point: /mnt/test
xfsrestore: volume: /dev/mapper/centos_hostrecia1-test
xfsrestore: session time: Wed Jun 22 12:19:26 2016
xfsrestore: level: 0
xfsrestore: session label: "test"
xfsrestore: media label: "test"
xfsrestore: file system id: a81fa86b-92dd-41ea-862a-dc2a3e45d0b8
xfsrestore: session id: 817f2f21-bc06-46d5-b6a4-f49d1a059efe
xfsrestore: media id: f93e8f03-7606-4069-b754-e18b2972322c
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: Media_mfile_next: purp==1 pos==1
xfsrestore: dump session label: "test"
xfsrestore: dump session id: 817f2f21-bc06-46d5-b6a4-f49d1a059efe
xfsrestore: stream 0, object 0, file 0
xfsrestore: initializing directory attributes registry
xfsrestore: initializing directory entry name registry
xfsrestore: initializing directory hierarchy image
xfsrestore: node_init: vmsz = 4611686018427359231 (0x3fffffffffff8fff) segsz = 58720256 (0x3800000) nodesperseg = 1048576 (0x100000) winmapmax = 4096 (0x1000)
xfsrestore: pre-growing new node array segment at 32768 size 58720256
xfsrestore: reading directories
xfsrestore: reading the ino map
xfsrestore: reading the directories
xfsrestore: directory 2048 0 (0): updating
xfsrestore: dirent dira 2051 0: adding (new)
xfsrestore: directory 2051 0 (0): upgrading to dir
xfsrestore: dirent filea 2052 0: adding (new)
xfsrestore: 2 directories and 2 entries processed
xfsrestore: number of mmap calls for windows = 1
xfsrestore: Media_atnondir
xfsrestore: directory post-processing
xfsrestore: adjusting dirent ref flags
xfsrestore: applying subtree selections
xfsrestore: making new directories
xfsrestore: mkdir dira
xfsrestore: getting next media file for non-dir restore
xfsrestore: Media_mfile_next: purp==2 pos==3
xfsrestore: dump session label: "test"
xfsrestore: dump session id: 817f2f21-bc06-46d5-b6a4-f49d1a059efe
xfsrestore: stream 0, object 0, file 0
xfsrestore: restoring non-directory files
xfsrestore: media file 0 in object 0 of stream 0
xfsrestore: file 0 in stream, file 0 in dump 0 on object
xfsrestore: restoring dira/filea (2052 0)
xfsrestore: restoring regular file ino 2052 dira/filea
xfsrestore: Media_end: pos==3
xfsrestore: getting next media file for non-dir restore
xfsrestore: Media_mfile_next: purp==2 pos==0
xfsrestore: tree finalize
xfsrestore: content.c: 2605: mlog_exit called: exit_code: SUCCESS return: OK (success)
xfsrestore: all children have exited
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: main.c: 871: mlog_exit called: exit_code: SUCCESS return: UNKNOWN (unknown error)
xfsrestore: Restore Summary:
xfsrestore: stream 0 /root/test0.dump OK (success)
xfsrestore: Restore Status: SUCCESS

[-- Attachment #3: debug1.txt --]
[-- Type: text/plain, Size: 3699 bytes --]

xfsrestore: raising stack size soft limit from 0x800000 to 0x2000000
xfsrestore: getpagesize( ) returns 4096
xfsrestore: parent tid is 139893610231680
xfsrestore: using file dump (drive_simple) strategy
xfsrestore: version 3.1.4 (dump format 3.0)
xfsrestore: thread 139893487298304 created for stream 0
xfsrestore: Media_create
xfsrestore: checking and validating command line dump id/label
xfsrestore: searching media for dump
xfsrestore: Media_mfile_next: purp==0 pos==0
xfsrestore: examining media file 0
xfsrestore: file 0 in object 0 of stream 0
xfsrestore: file 0 in stream, file 0 of dump 0 on object
xfsrestore: dump found: checking
xfsrestore: dump description:
xfsrestore: hostname: hostrecia1.recia.fr
xfsrestore: mount point: /mnt/test
xfsrestore: volume: /dev/mapper/centos_hostrecia1-test
xfsrestore: session time: Wed Jun 22 12:20:42 2016
xfsrestore: level: 1
xfsrestore: session label: "test"
xfsrestore: media label: "test"
xfsrestore: file system id: a81fa86b-92dd-41ea-862a-dc2a3e45d0b8
xfsrestore: session id: 27606c57-7b3b-43ff-83b9-69158e75f612
xfsrestore: media id: 1fcb7c9c-44b2-427d-becc-d10816e2c430
xfsrestore: using online session inventory
xfsrestore: searching media for directory dump
xfsrestore: Media_mfile_next: purp==1 pos==1
xfsrestore: dump session label: "test"
xfsrestore: dump session id: 27606c57-7b3b-43ff-83b9-69158e75f612
xfsrestore: stream 0, object 0, file 0
xfsrestore: initializing directory attributes registry
xfsrestore: reading directories
xfsrestore: reading the ino map
xfsrestore: reading the directories
xfsrestore: directory 2048 0 (0): updating
xfsrestore: dirent dirA 2051 0: renaming (name)
xfsrestore: directory 2051 0 (0): updating
xfsrestore: dirent filea 2052 0: retaining (nondir)
xfsrestore: dirent dirb 526336 1283006502: adding (new)
xfsrestore: directory 526336 1283006502 (1283006502): upgrading to dir
xfsrestore: dirent fileb 526337 1283006502: adding (new)
xfsrestore: 3 directories and 4 entries processed
xfsrestore: number of mmap calls for windows = 1
xfsrestore: Media_atnondir
xfsrestore: directory post-processing
xfsrestore: adjusting dirent ref flags
xfsrestore: applying subtree selections
xfsrestore: eliminating unreferenced directory entries
xfsrestore: rename dir dira to orphanage/2051.0
xfsrestore: making new directories
xfsrestore: performing directory renames
xfsrestore: rename dir orphanage/2051.0 to dirA
xfsrestore: processing hard links
xfsrestore: processing hardlinks to 2052 0
xfsrestore: processing hardlinks to 526337 1283006502
xfsrestore: getting next media file for non-dir restore
xfsrestore: Media_mfile_next: purp==2 pos==3
xfsrestore: dump session label: "test"
xfsrestore: dump session id: 27606c57-7b3b-43ff-83b9-69158e75f612
xfsrestore: stream 0, object 0, file 0
xfsrestore: restoring non-directory files
xfsrestore: media file 0 in object 0 of stream 0
xfsrestore: file 0 in stream, file 0 in dump 0 on object
xfsrestore: restoring dirA/dirb/fileb (526337 1283006502)
xfsrestore: restoring regular file ino 526337 dirA/dirb/fileb
xfsrestore: WARNING: open of dirA/dirb/fileb failed: Aucun fichier ou dossier de ce type: discarding ino 526337
xfsrestore: Media_end: pos==3
xfsrestore: getting next media file for non-dir restore
xfsrestore: Media_mfile_next: purp==2 pos==0
xfsrestore: tree finalize
xfsrestore: content.c: 2605: mlog_exit called: exit_code: SUCCESS return: OK (success)
xfsrestore: all children have exited
xfsrestore: restore complete: 0 seconds elapsed
xfsrestore: main.c: 871: mlog_exit called: exit_code: SUCCESS return: UNKNOWN (unknown error)
xfsrestore: Restore Summary:
xfsrestore: stream 0 /root/test1.dump OK (success)
xfsrestore: Restore Status: SUCCESS

[-- Attachment #4: test0.dump --]
[-- Type: application/octet-stream, Size: 21632 bytes --]

[-- Attachment #5: test1.dump --]
[-- Type: application/octet-stream, Size: 21960 bytes --]

[-- Attachment #6: Type: text/plain, Size: 121 bytes --]