Bug 892291 - guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
guestmount: link() incorrectly returns ENOENT, when it should be EXDEV
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
Depends On: 895905 958183
  Show dependency treegraph
Reported: 2013-01-06 06:11 EST by Colin Walters
Modified: 2013-11-20 23:42 EST (History)
3 users (show)

See Also:
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.
Story Points: ---
Clone Of:
: 895905 (view as bug list)
Last Closed: 2013-11-20 23:42:32 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Colin Walters 2013-01-06 06:11: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):


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 Product and Program Management 2013-01-11 01:47:31 EST
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 09:50:21 EST
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 13:55:00 EDT
Fix included in upstream libguestfs 1.16.35.
Comment 6 Richard W.M. Jones 2013-06-28 06:55:04 EDT
This is fixed by the rebase (bug 958183).
Comment 11 bfan 2013-09-18 02:19:35 EDT
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 03:53:25 EDT
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-20 23:42:32 EST
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.