mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Eduard Bloch <edi@gmx.de>
Cc: linux-kernel@vger.kernel.org, debburn-devel@lists.alioth.debian.org
Subject: Re: broken device locking, sg vs. sg_io on block devices
Date: Sun, 1 Apr 2007 01:14:52 +0100	[thread overview]
Message-ID: <20070401011452.7c0cbce9@the-village.bc.nu> (raw)
In-Reply-To: <20070331224021.GA6488@rotes76.wohnheim.uni-kl.de>

> > > The use of /dev/sg* is still common practice, its invention predates
> > 
> > The /dev/sg interface cannot do the locking. If you use /dev/sg you are
> 
> Again, it doesn't have to. It can pass the locking operations to the
> related block device driver.

No it can't. The driver has no idea what the locking rules are for
arbitary command blocks send to arbitary devices. /dev/sg is a *raw*
interface. You can send anything to anyone, and the locking rules for
that are far too complex for a giant morass of kernel code to get added.

The mess begins because you use /dev/sg and put it in a cdrom group
instead of using SG_IO on the /dev/sr device. The mess continues because
of the user of O_EXCL locking thus forcing re-open/close by HAL instead
of fcntl based co-operative locking.

The job of the kernel is not and never has been to anticipate and correct
everything stupid someone tries to do in user space. 

As I said before the people wanting to arbitrate serial ports got this
right in the mid 1970's your situation is not much more complicated,
unless you persist in using /dev/sg - which yes does make it hard, but so
does writing it in COBOL, or while standing on your head. And the
solution to all three cases is the same *DONT DO IT*

Alan

  reply	other threads:[~2007-03-31 23:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200703261811.21448.gerald@itzgrund.net>
2007-03-30 11:17 ` Eduard Bloch
2007-03-30 13:43   ` Christoph Hellwig
2007-03-30 14:21     ` Eduard Bloch
2007-03-30 18:10       ` Alan Cox
2007-03-31 17:07         ` Eduard Bloch
2007-03-31 22:20           ` Alan Cox
2007-03-31 22:40             ` Eduard Bloch
2007-04-01  0:14               ` Alan Cox [this message]
2007-04-01  2:34                 ` Oleg Verych
2007-04-07 11:21             ` Eduard Bloch
2007-04-11 10:12               ` Eduard Bloch
2007-04-11 11:31                 ` Alan Cox
2007-04-11 12:19                   ` Eduard Bloch
2007-03-30 19:09       ` Jan Engelhardt

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=20070401011452.7c0cbce9@the-village.bc.nu \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=debburn-devel@lists.alioth.debian.org \
    --cc=edi@gmx.de \
    --cc=linux-kernel@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
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

all inboxes | Powered by JetHome®