From: Eduard Bloch <edi@gmx.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
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 00:40:21 +0200 [thread overview]
Message-ID: <20070331224021.GA6488@rotes76.wohnheim.uni-kl.de> (raw)
In-Reply-To: <20070331232002.7b478f37@the-village.bc.nu>
#include <hallo.h>
* Alan Cox [Sat, Mar 31 2007, 11:20:02PM]:
> > But the desktop needs some means to deal with that. AFAICS the only
> > feasible way for applications to communicate about device usage policy
> > is locking with O_EXCL. Many people do not realize that even read-only
>
> serial ports and mail both use fcntl file locking , which is much more
> flexible.
Again, what does that have to do with the problem at hand? Our problem is
not about locking on a single file (no matter which mechanism is used)
but the coordination of locks _behind_ the userspace access. Or
alternatively reassigning all access to one device file.
> > > The kernel does not have sufficient information to handle /dev/sg locking
> >
> > But the kernel knows already that there is a block device behind it. It
> > is displayed in sysfs. It shall "just" reuse the lock mechanism of that
> > device, not more and not less. Naturally this "just" definition is
> > bendable and that is why I initially asked here.
>
> This doesn't help. There are legitimate reasons to use /dev/sg on a
> device which is active. For most subsystems this actually makes a lot of
> sense when doing things like enclosure control.
For such uses one can omit the locking. Problem solved.
> > The sad thing is, this is just another assumption. At least on Debian
> > /dev/sgX belongs to the cdrom group when it's a cdrom device and the
> > permissions do just invite to work with it.
>
> Which means it is privilegded.
So? Then let's make /etc/shadow privilegded too: chmod a+r /etc/shadow
> > > The desktop user space should really know what it is doing with the CD
> > > device if it wants to do things like CD burning. If the serial port
> > > people could get this right in 1977 then there is no excuse fo the CD
> >
> > Serial port? Do we have multiple drivers with multiple interfaces
> > accessing the same hardware simultaneously and independently? I don't
> > think so.
>
> getty/modem/uucp/terminal emulator/slip/ppp/..
>
> I do think so.
Nice try, but where are the different conflicting drivers with different
userspace interfaces? Do you have some more flawed comparisons of that
kind?
> > 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.
The alternative is finding a mapping to the correct block device and act
on this one (with O_EXCL or with fcntl, or both). Sysfs looks like a
good method to get information for such mapping but unfortunately you
(kernel developers) are going to cut even this last path soon (see
CONFIG_SYSFS_DEPRECATED and its bold description).
Is there any other way I need to know about? Some Voodoo ioctl?
Regards,
Eduard.
--
<alphascorpii> hm, was kann man denn so aus brot machen ...
<maxx> knusprige ente (mit etwas geduld)
next prev parent reply other threads:[~2007-03-31 22:40 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 [this message]
2007-04-01 0:14 ` Alan Cox
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=20070331224021.GA6488@rotes76.wohnheim.uni-kl.de \
--to=edi@gmx.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=debburn-devel@lists.alioth.debian.org \
--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®