mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Amit Shah <amit.shah@redhat.com>
Cc: Tejun Heo <tj@kernel.org>, David Zeuthen <zeuthen@gmail.com>,
	Martin Pitt <martin.pitt@ubuntu.com>,
	Kay Sievers <kay.sievers@vrfy.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] cdrom: always check_disk_change() on open
Date: Fri, 29 Apr 2011 10:15:50 +0200	[thread overview]
Message-ID: <4DBA73B6.6040603@kernel.dk> (raw)
In-Reply-To: <20110429060200.GA5107@amit-x200.redhat.com>

On 2011-04-29 08:57, Amit Shah wrote:
> On (Wed) 06 Apr 2011 [05:20:09], Tejun Heo wrote:
>> cdrom_open() called check_disk_change() after the rest of open path
>> succeeded which leads to the following bizarre behavior.
>>
>> * After media change, if the device opened without O_NONBLOCK,
>>   open_for_data() naturally fails with -ENOMEDIA and
>>   check_disk_change() is never called.  The media is known to be gone
>>   and the open failure makes it obvious to the userland but device
>>   invalidation never happens.
>>
>> * But if the device is opened with O_NONBLOCK, all the checks are
>>   bypassed and cdrom_open() doesn't notice that the media is not there
>>   and check_disk_change() is called and invalidation happens.
>>
>> There's nothing to be gained by avoiding calling check_disk_change()
>> on open failure.  Common cases end up calling check_disk_change()
>> anyway.  All we get is inconsistent behavior.
>>
>> Fix it by moving check_disk_change() invocation to the top of
>> cdrom_open() so that it always gets called regardless of how the rest
>> of open proceeds.
>>
>> Signed-off-by: Tejun Heo <tj@kernel.org>
>> Reported-by: Amit Shah <amit.shah@redhat.com>
>> Tested-by: Amit Shah <amit.shah@redhat.com>
> 
> Ping?
> 
> Also, please mark this for stable-2.6.38.

Done, added for 2.6.39 and marked stable for 2.6.38.

-- 
Jens Axboe


  parent reply	other threads:[~2011-04-29  8:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 12:20 Tejun Heo
2011-04-06 12:22 ` [PATCH 2/2] block: rescan partitions on invalidated devices on -ENOMEDIA too Tejun Heo
2011-04-29  6:57 ` [PATCH 1/2] cdrom: always check_disk_change() on open Amit Shah
2011-04-29  8:15   ` Tejun Heo
2011-04-29  8:15   ` Jens Axboe [this message]
2011-04-29  8:16     ` Tejun Heo
2011-04-29  8:28       ` Jens Axboe
2011-05-10  6:42     ` Amit Shah
2011-05-10  7:44       ` Jens Axboe
2011-05-10  8:13         ` Amit Shah
2011-09-03 22:14 ` [regression] CD-ROM polling blocks suspend on some machines (Re: [PATCH 1/2] cdrom: always check_disk_change() on open) Jonathan Nieder
2011-09-04  2:42   ` Tejun Heo
2011-09-04 15:05     ` [regression] CD-ROM polling blocks suspend on some machines Jonathan Nieder
2011-09-05  1:49     ` [regression] CD-ROM polling blocks suspend on some machines (Re: [PATCH 1/2] cdrom: always check_disk_change() on open) Jameson Graef Rollins
2011-09-06 17:45       ` Tejun Heo
2011-09-07  8:50         ` Matthijs Kooijman
2011-09-11  4:08           ` Tejun Heo
2011-10-24 20:25             ` Gaudenz Steinlin
2011-10-26 18:26               ` Matthijs Kooijman - Brevidius
2011-10-26 22:25                 ` Tejun Heo
2011-10-28 13:47                   ` Matthijs Kooijman
2011-10-30 20:35                     ` Tejun Heo
2011-10-31  9:28                       ` Matthijs Kooijman
2011-10-31 15:26                         ` Tejun Heo
2011-12-19 11:12                           ` Matthijs Kooijman
2011-12-19 16:44                             ` Tejun Heo

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=4DBA73B6.6040603@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=amit.shah@redhat.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.pitt@ubuntu.com \
    --cc=tj@kernel.org \
    --cc=zeuthen@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome