Red Hat Bugzilla – Bug 892291
guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
Last modified: 2013-11-20 23:42:32 EST
Description of problem:
My project ostree uses hardlinks extensively; I have a bit of code which tries link() and falls back to a copy if it gets EXDEV.
Unfortunately, something in the guestmount/fuse/kernel chain is giving me ENOENT, when it should be EXDEV. I've added a workaround to ostree, but this is suboptimal.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. guestmount --rw -o allow_root --pid-file guestmount.pid -a test.img -m /dev/sda3 -m /dev/sda1:/boot mnt
2. cd mnt
3. touch foo
4. ln foo boot/foo
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Unfortunately this missed RHEL 6.4. However it's a fairly
serious bug as it turns out. The full description, along
with patches, is here:
Fix included in upstream libguestfs 1.16.35.
This is fixed by the rebase (bug 958183).
Reproduced with libguestfs-1.16.34-1.el6.x86_64
# mkdir mountpoint
# guestmount --rw -o allow_root --pid-file guestmount.pid -a RHEL-Server-6.0-32-hvm.raw -m /dev/vg_dhcp669266/lv_root -m /dev/sda1:/boot mountpoint
# cd mountpoint/
# touch foo
# ln foo boot/foo
ln: creating hard link `boot/foo' => `foo': No such file or directory
Give error "No such file or directory"
Verified with libguestfs-1.20.11-2.el6.x86_64
[root@dhcp-9-42]# guestmount --rw -o allow_root --pid-file guestmount.pid -a RHEL-Server-6.0-32-hvm.raw -m /dev/vg_dhcp669266/lv_root -m /dev/sda1:/boot mountpoint
[root@dhcp-9-42]# cd mountpoint/
[root@dhcp-9-42 mountpoint]# touch foo
[root@dhcp-9-42 mountpoint]# ln foo boot/foo
ln: creating hard link `boot/foo' => `foo': Invalid cross-device link
Check the errno
[root@dhcp-9-42 mountpoint]# cat /usr/include/asm-generic/errno-base.h | grep EXDEV
#define EXDEV 18 /* Cross-device link */
So, change the status to verified.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.