Bug 1566021

Summary: Error occurs on udisksctl loop-setup once the loop node doesn't exist
Product: Red Hat Enterprise Linux 7 Reporter: xhe <xhe>
Component: udisks2Assignee: Vojtech Trefny <vtrefny>
Status: CLOSED WONTFIX QA Contact: guazhang <guazhang>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.5CC: guazhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-15 07:38:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description xhe@redhat.com 2018-04-11 11:17:01 UTC
Description of problem:
Error occurs on udisksctl loop-setup once the loop node doesn't exist.


Version-Release number of selected component (if applicable):
udisks2-2.7.3-6.el7.x86_64

How reproducible:
often

Steps to Reproduce:
1. find a free loop device
# losetup -f 
/dev/loop6
2. delete the loop device
# rm -rf /dev/loop6
3. execute udisksctl loop-setup
# udisksctl loop-setup -f /tmp/tfile

NOTE: if run firstly "mknod /dev/loopX b 7 0", then run "udisksctl loop-setup ..", it works. Not sure if this is what expected. 

Actual results:
*************** snip ******************
# udisksctl loop-setup -f /tmp/tfile
Error setting up loop device for /tmp/tfile: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dbd_2dloop_2derror_2dquark.Code1: Error creating loop device: Failed to open the /dev/loop6 device: No such file or directory
***************************************

Expected results:
The command of udisksctl loop-setup works.

Additional info:

Comment 2 xhe@redhat.com 2018-04-11 11:47:39 UTC
So weird, I have the loop node here, but it's still failed to run "udisksctl loop-setup..."

# mknod /dev/loop6 b 7 0
# udisksctl loop-setup -f /tmp/tfile_loop9
Error setting up loop device for /tmp/tfile_loop9: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dbd_2dloop_2derror_2dquark.Code0: Error creating loop device: Failed to associate the /dev/loop6 device with the file descriptor: Device or resource busy
# ls /dev/loop*
loop0         loop2         loop4         loop6         loop8         
loop1         loop3         loop5         loop7         loop-control  
# lsblk -f
NAME                        FSTYPE      LABEL UUID                                   MOUNTPOINT                                                                    
loop0                                                                                
loop1                                                                                
loop2                       crypto_LUKS       251f0c1f-8de0-40ff-86c7-9458ecf8b0e3   
loop3                       crypto_LUKS       7aa4c383-0c4b-4905-aff2-a712d736b719   
loop4                       crypto_LUKS       7a459e87-0fac-4680-a437-9d07e68c0d09   
loop5                       crypto_LUKS       9f122012-dce5-4f19-9647-acac9e4ded22   
loop7                                                                                
loop8

Comment 3 xhe@redhat.com 2018-04-11 11:59:25 UTC
Is the failure caused by the second time of running loop-setup? is it not allowed?

# udisksctl loop-setup -f /tmp/tfile002  ---> works good at first time
Mapped file /tmp/tfile002 as /dev/loop0.

# udisksctl loop-setup -f /tmp/tfile003  ---> error at second time
Error setting up loop device for /tmp/tfile003: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dbd_2dloop_2derror_2dquark.Code0: Error creating loop device: Failed to associate the /dev/loop6 device with the file descriptor: Device or resource busy

Comment 4 xhe@redhat.com 2018-04-12 10:28:40 UTC
I almost hit different issue when I run "udisksctl loop-setup xxx".

# udisksctl loop-setup -f /tmp/tfile_loop1
Error setting up loop device for /tmp/tfile_loop1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error waiting for loop object after creating /dev/loop1Timed out waiting for object

Then, I tried to use losetup to do everything( includes detach the loop1 and losetup again), I found original issue mentioned in #c0 on losetup. Therefore I filed another bug for losetup https://bugzilla.redhat.com/show_bug.cgi?id=1566432
 
# losetup -D
# losetup  -a
/dev/loop0: [64768]:1001699 (/tmp/tfile_loop0)
# rm -rf /tmp/tfile_loop1 
# dd if=/dev/zero of=/tmp/tfile_loop1 bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 1.49049 s, 704 MB/s
# losetup -f
/dev/loop1
# losetup /dev/loop1 -f /tmp/tfile_loop1 
losetup: /dev/loop1: failed to set up loop device: No such device or address
# mknod /dev/loop1 b 7 5
mknod: ‘/dev/loop1’: File exists

Comment 7 RHEL Program Management 2021-02-15 07:38:23 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.