Bug 892291 - guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
Summary: guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
Depends On: 895905 958183
TreeView+ depends on / blocked
Reported: 2013-01-06 11:11 UTC by Colin Walters
Modified: 2013-11-21 04:42 UTC (History)
3 users (show)

Fixed In Version: libguestfs-1.20.9-5.el6
Doc Type: Bug Fix
Doc Text:
Cause: Creating a hard link when using guestmount. Consequence: If creating the hard link fails, the wrong error was returned. This could result in applications failing, or failing to print the correct error message (making diagnosis of the true causes of problems difficult). Fix: Error handling in guestmount has been rewritten. Result: Correct errors are returned to guestmount users.
Clone Of:
: 895905 (view as bug list)
Last Closed: 2013-11-21 04:42:32 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:1536 0 normal SHIPPED_LIVE Moderate: libguestfs security, bug fix, and enhancement update 2013-11-21 00:40:55 UTC

Description Colin Walters 2013-01-06 11:11:32 UTC
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):


How reproducible:


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
Actual results:


Expected results:


Comment 2 RHEL Program Management 2013-01-11 06:47:31 UTC
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.

Comment 3 Richard W.M. Jones 2013-01-21 14:50:21 UTC
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:


Comment 5 Richard W.M. Jones 2013-04-11 17:55:00 UTC
Fix included in upstream libguestfs 1.16.35.

Comment 6 Richard W.M. Jones 2013-06-28 10:55:04 UTC
This is fixed by the rebase (bug 958183).

Comment 11 bfan 2013-09-18 06:19:35 UTC
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"

Comment 12 bfan 2013-10-21 07:53:25 UTC
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.

Comment 14 errata-xmlrpc 2013-11-21 04:42:32 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.