Bug 437362

Summary: eject misidentifies removeable devices
Product: [Fedora] Fedora Reporter: Jeremy Fitzhardinge <jeremy>
Component: ejectAssignee: Zdenek Prikryl <zprikryl>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 8CC: bkj, chkr, james, tmz
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 2.1.5-7.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-21 22:15:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jeremy Fitzhardinge 2008-03-13 17:53:20 UTC
Description of problem:
eject on my ipod now fails, whereas it used to work:
: ezr:pts/20; eject /dev/sdb
eject: device "/dev/sdb" doesn't have a removable flag
exit status 1

Version-Release number of selected component (if applicable):
eject-2.1.5-6.fc8

How reproducible:
Always

Steps to Reproduce:
1.Plug in ipod
2.Note device
3.eject <device>
  
Actual results:
: ezr:pts/20; eject /dev/sdb
eject: device "/dev/sdb" doesn't have a removable flag
exit status 1

Expected results:
Successful eject.

Additional info:
Running strace on eject shows that its reading the removable flag for sda rather
than sdb:
...
12982 fstatat64(3, "sda", {st_mode=S_IFBLK|0640, st_rdev=makedev(8, 0), ...}, 0) = 0
12982 close(3)                          = 0
12982 open("/sys/block/sda/removable", O_RDONLY) = 3
12982 fstat64(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
12982 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
= 0xb7fc5000
12982 read(3, "0\n", 4096)              = 2
12982 close(3)                          = 0
...

$ cat /sys/block/sda/removable
0
$ cat /sys/block/sdb/removable
1

Comment 1 Jeremy Fitzhardinge 2008-03-13 17:54:42 UTC
This failure appeared in the latest update, which I just yum installed this morning.

Comment 2 Zdenek Prikryl 2008-03-13 18:17:40 UTC
Could you please send an output from

$ ls -la /dev/sd*

Comment 3 Jeremy Fitzhardinge 2008-03-13 18:41:23 UTC
brw-r----- 1 root disk 8,  0 2008-03-07 07:21 /dev/sda
brw-r----- 1 root disk 8,  1 2008-03-07 07:21 /dev/sda1
brw-r----- 1 root disk 8,  2 2008-03-07 07:21 /dev/sda2
brw-r----- 1 root disk 8,  3 2008-03-07 15:22 /dev/sda3
brw-r----- 1 root disk 8,  4 2008-03-07 07:21 /dev/sda4
brw-r----- 1 root disk 8,  5 2008-03-07 07:21 /dev/sda5
brw-r----- 1 root disk 8,  6 2008-03-07 07:21 /dev/sda6
brw-r----- 1 root disk 8, 16 2008-03-13 11:38 /dev/sdb
brw-r----- 1 root disk 8, 17 2008-03-13 11:38 /dev/sdb1


Comment 4 Jeremy Fitzhardinge 2008-03-13 19:07:09 UTC
Same happens with a normal USB stick, as you might expect.  If I plug in 2
external devices, so I have sd[abc], then "eject sdc" still looks at sda's
removable state.

Comment 5 Zdenek Prikryl 2008-03-13 19:17:13 UTC
Yes, I found the bug. Try to fix ASAP.

Comment 6 Eugene Savelov 2008-03-15 18:48:51 UTC
the same bug happens in fc7 update  - eject-2.1.5-6.fc7


Comment 7 Zdenek Prikryl 2008-03-16 09:47:50 UTC
*** Bug 432187 has been marked as a duplicate of this bug. ***

Comment 8 Zdenek Prikryl 2008-03-17 12:25:21 UTC
*** Bug 437739 has been marked as a duplicate of this bug. ***

Comment 9 Fedora Update System 2008-03-17 15:49:13 UTC
eject-2.1.5-7.fc8 has been submitted as an update for Fedora 8

Comment 10 Fedora Update System 2008-03-17 16:00:50 UTC
eject-2.1.5-7.fc7 has been submitted as an update for Fedora 7

Comment 11 Brian Miller 2008-03-18 22:04:35 UTC
eject-2.1.5-7.fc8 did not work. I still get the same error message. Rolling back
to 2.1.5-5 works fine.

Comment 12 BKJ 2008-03-18 23:58:09 UTC
works fine for me on fc8

Comment 13 Zdenek Prikryl 2008-03-19 08:20:18 UTC
(In reply to comment #11)
> eject-2.1.5-7.fc8 did not work. I still get the same error message. Rolling back
> to 2.1.5-5 works fine.

Could you post here what are you trying to eject, $ ls -la /dev/<device>, $ ls
-la /sys/block/ and $ cat /sys/block/<device>/removable?

Thanks

Comment 14 Christian Krause 2008-03-19 19:20:08 UTC
I've tested the new build and it works fine. Strac'ing it verifies that now the
"removable" flag of the correct interface is checked (and not always sda).


Comment 15 Fedora Update System 2008-03-21 22:15:34 UTC
eject-2.1.5-7.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2008-03-21 22:19:10 UTC
eject-2.1.5-7.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.