All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Tejun Heo <tj@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [REGRESSION] cdrom drive doesn't detect removal
Date: Wed, 22 Sep 2010 01:09:50 +0200	[thread overview]
Message-ID: <1285110590.2822.9.camel@maxim-laptop> (raw)
In-Reply-To: <1285069338.3124.4.camel@maxim-laptop>

On Tue, 2010-09-21 at 13:42 +0200, Maxim Levitsky wrote: 
> On Thu, 2010-09-16 at 08:51 +0200, Kay Sievers wrote: 
> > On Thu, Sep 16, 2010 at 00:20, Maxim Levitsky <maximlevitsky@gmail.com> wrote:
> > > So it makes the sense.
> > > It turns out that hal is still running on ubuntu systems, and yes, it
> > > still polls the drives, and yes I disabled that feature....
> > > So restoring that polling feature indeed fixes that problem for now.
> > > Yet, why without that commit detection did work?
> > 
> > Really, I have no idea how this can happen. You could only find out
> > with blocktrace, if something else is trying to open the device. The
> > state change in the drive should not be able to get known to the host
> > unless something is causing i/o with open().
> > 
> > Kay
> 
> Due to some unexplained laziness, I didn't put a printk to cdrom_open to
> figure out if drive is polled or not without hal.
> Today I finally found why kgdb didn't work (it was conflict with nmi
> watchdog), and just for fun I have put a breakpoint to cdrom_open.
> Well udisks *does* poll the drive, every few seconds, and therefore this
> is a regression.
> I will soon look at udisk source to see how it polls the drive.
> (Maybe it uses exclusive open and hal doesn't or something like that.)

I just did a strace on udisks, and it is pretty much self explanatory.
(While CD is mounted).


open("/dev/sr0", O_RDONLY|O_EXCL|O_NONBLOCK) = -1 EBUSY (Device or resource busy)
poll([{fd=5, events=POLLIN}, {fd=3, events=POLLIN}], 2, 1997) = 0 (Timeout)
open("/dev/sr0", O_RDONLY|O_EXCL|O_NONBLOCK) = -1 EBUSY (Device or resource busy)
poll([{fd=5, events=POLLIN}, {fd=3, events=POLLIN}], 2, 1997) = 0 (Timeout)
open("/dev/sr0", O_RDONLY|O_EXCL|O_NONBLOCK) = -1 EBUSY (Device or resource busy)
poll([{fd=5, events=POLLIN}, {fd=3, events=POLLIN}], 2, 1997) = 0 (Timeout)
open("/dev/sr0", O_RDONLY|O_EXCL|O_NONBLOCK) = -1 EBUSY (Device or resource busy)

Sure, a filesystem is mounted, so exclusive access fails...

So, we end up with impossible to solve problem.
We want on one hand to guard the burner against polling programs that disturb it, but one the other hand
we must do polling to check CD status.

Unless the kernel does the polling, but then we also must stop it when burning is done.
I think that we need new ioctl in the CD driver that would give absolute access to the burning application, and lock it fully.

What to do?

Best regards,
	Maxim Levitsky



  reply	other threads:[~2010-09-21 23:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-12  9:49 [REGRESSION] cdrom drive doesn't detect removal Maxim Levitsky
2010-09-14  1:27 ` Maxim Levitsky
2010-09-14  7:39   ` Tejun Heo
2010-09-14  8:07     ` Kay Sievers
2010-09-14 23:38       ` Maxim Levitsky
2010-09-14 23:49         ` Kay Sievers
2010-09-15  0:37           ` Maxim Levitsky
2010-09-15  1:01             ` Kay Sievers
2010-09-15 13:27               ` Henrique de Moraes Holschuh
2010-09-15 13:44                 ` Kay Sievers
2010-09-15 22:20                   ` Maxim Levitsky
2010-09-16  6:51                     ` Kay Sievers
2010-09-21 11:42                       ` Maxim Levitsky
2010-09-21 23:09                         ` Maxim Levitsky [this message]
2010-09-22  7:38                           ` Tejun Heo
2010-09-22 13:41                             ` Maxim Levitsky
2010-09-22 13:58                               ` Maxim Levitsky
2010-09-23  8:47                                 ` Tejun Heo
2010-09-23  9:21                                   ` Kay Sievers
2010-09-30  6:30                                     ` Florian Mickler
2010-09-30  7:48                                       ` Kay Sievers
2010-09-30 11:38                                         ` Florian Mickler
2010-09-30 14:17                                           ` Maxim Levitsky
2010-09-30 14:49                                             ` Florian Mickler
2010-09-30 19:27                                               ` Kay Sievers
2010-09-30 20:14                                                 ` Florian Mickler
2010-09-30 20:32                                                   ` Kay Sievers
2010-09-30 20:47                                                     ` Florian Mickler
2010-09-30 20:57                                                       ` Kay Sievers
2010-10-01  5:55                                               ` Tejun Heo
2010-10-01  7:54                                                 ` Florian Mickler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285110590.2822.9.camel@maxim-laptop \
    --to=maximlevitsky@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hmh@hmh.eng.br \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.