Util-Linux Archive on lore.kernel.org
 help / color / Atom feed
From: Karel Zak <kzak@redhat.com>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] blkid: open device in nonblock mode.
Date: Wed, 8 Jan 2020 09:25:52 +0100
Message-ID: <20200108082552.dmofs7fe7624oniv@10.255.255.10> (raw)
In-Reply-To: <20200107161918.GX4113@kitsune.suse.cz>

On Tue, Jan 07, 2020 at 05:19:18PM +0100, Michal Suchánek wrote:
> On Tue, Jan 07, 2020 at 05:04:43PM +0100, Karel Zak wrote:
> > On Mon, Nov 04, 2019 at 09:23:15PM +0100, Michal Suchanek wrote:
> > > When autoclose is set (kernel default but many distributions reverse the
> > > setting) opening a CD-rom device causes the tray to close.
> > 
> > I found unwanted side effect, open() with O_NONBLOCK also successes
> > when there is no medium. Unfortunately, we ignore I/O errors for
> > CDROMs to support some crazy hybrid media -- so overall result is many
> > I/O warnings in system logs.
> > 
> > I have added CDROM_DRIVE_STATUS to the logic to stop probing when
> > there is no medium. Let's hope it will be enough:
> > 
> > https://github.com/karelzak/util-linux/commit/dc30fd4383e57a0440cdb0e16ba5c4336a43b290
> 
> It it probably safer to do
> switch (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT)) {
> to support some crazy CD changers.

Good point, I have seen it in kernel docs, but forgot to use it.
Fixed. Thanks for review.

    Karel

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


      reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 20:23 Michal Suchanek
2019-11-05 11:41 ` Karel Zak
2019-11-05 17:13   ` Michal Suchánek
2019-11-06  8:02     ` Michal Suchánek
2019-11-06  8:48       ` Karel Zak
2019-11-06  9:45         ` Michal Suchánek
2019-11-12  8:27         ` Anatoly Pugachev
2019-11-12  8:58           ` Karel Zak
2019-11-06  9:00 ` Karel Zak
2020-01-07 16:04 ` Karel Zak
2020-01-07 16:19   ` Michal Suchánek
2020-01-08  8:25     ` Karel Zak [this message]

Reply instructions:

You may reply publically 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=20200108082552.dmofs7fe7624oniv@10.255.255.10 \
    --to=kzak@redhat.com \
    --cc=msuchanek@suse.de \
    --cc=util-linux@vger.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

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org
	public-inbox-index util-linux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git