[udisks] CD-ROM polling failed due to O_EXCL flag (poller.c)

Karel Zak kzak at redhat.com
Tue Mar 1 03:55:01 PST 2011


On Sat, Feb 26, 2011 at 04:53:16PM +0800, PCMan wrote:
> Thanks for the suggestions.
> I made a new patch reading from /proc/self/mountinfo as suggested by you.
> In addition, no code is taken from HAL so there is no license issue now.
> Please review the patch attached to this mail.
> 
> On Sat, Feb 26, 2011 at 12:12 AM, Kay Sievers <kay.sievers at vrfy.org> wrote:
> > On Fri, Feb 25, 2011 at 14:47, PCMan <pcman.tw at gmail.com> wrote:
> >> I made a small patch against the latest udisks in git after hacking HAL daemon
> >> and it works. Please review the patch. Thanks a lot.
> >>
> >> https://bugs.freedesktop.org/attachment.cgi?id=43798&action=edit
> >
> > mtab is officially dead now, even in mount(8). Please always use

 well, it's experimental death :-)

> > /proc/self/mountinfo, it has the major/minor in there, which is a far
> > more reliable match than the device file name. Example is here:

 are you sure?

 [...]

> +  if (stat (device_file, &statbuf) < 0)
> +      return FALSE;
> +
> +  ret = FALSE;
> +  f = fopen ("/proc/self/mountinfo", "r");
> +  if (f)
> +    {
> +      while (fgets(line, 100, f))
> +        {
> +          if (sscanf(line, "%*s %*s %d:%d", &major, &minor) == 2)
> +            {
> +              if (makedev(major, minor) == statbuf.st_rdev)


 major/minor numbers are not reliable with btrfs (at least on
 2.6.35.6-45.fc14.x86_64), btrfs uses some funny dev_t numbers:

    # modprobe scsi_debug dev_size_mb=500 sector_size=512
    # fdisk /dev/sdb

    # mkfs.btrfs /dev/sdb1
    # mount /dev/sdb1 /mnt/test

    # cat /sys/block/sdb/sdb1/dev 
    8:17
    ^^^^

    # grep /dev/sdb1 /proc/self/mountinfo
    44 20 0:37 / /mnt/test rw,relatime - btrfs /dev/sdb1 rw,ssd
          ^^^^

    # ll /sys/dev/block/0\:37/
    ls: cannot access /sys/dev/block/0:37/: No such file or directory

 This is not all, there is also problem with stat.st_dev numbers for
 files on btrfs filesystem:

    # touch /mnt/test/hello
    # stat --format "%d" /mnt/test/hello
    39
   
 summary:

    device         = 8:17
    mouninfo       = 0:17
    stat(2) st_dev = 0:39

 
 I hope this all is a bug, because I cannot imagine distribution that
 uses FS with these "features". 
 
 (CC to Josef who cares about btrfs on Fedora).

    Karel

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com


More information about the devkit-devel mailing list