mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Frank Munzert" <frankm@linux.vnet.ibm.com>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: BUG: lock held when returning to user space
Date: Wed, 12 Mar 2008 17:29:54 +0100	[thread overview]
Message-ID: <19f34abd0803120929j19a043bq711e8a374edbdfe8@mail.gmail.com> (raw)
In-Reply-To: <47D7FAA0.1090802@linux.vnet.ibm.com>

On Wed, Mar 12, 2008 at 4:45 PM, Frank Munzert
<frankm@linux.vnet.ibm.com> wrote:
>  we provided a device driver vmur dealing with z/VM virtual unit record
>  devices (reader, punch, printer). A corresponding user space tool
>  provides functions similar to the CMS commands RECEIVE, PUNCH, PRINT.
>  Unit record devices are not meant for concurrent read or write by
>  multiple users, that's why we need to serialize access. The driver's
>  open method uses  mutex_trylock or  mutex_lock_interruptible  to  ensure
>  exclusive access to the device, while its  release method  uses
>  mutex_unlock.

snip.

>  For the vmur device driver it is crucial to have only one process access
>  a given unit record device node at a given time. So having open hold the
>  mutex and return to user space is exactly what we want. Is  there any
>  annotation  to tell lockdep to suppress or bypass this kind of warning?

This sounds like a serious abuse of mutexes.

Wouldn't it be correct to use the mutex to protect a separate variable
(which indicates whether the device has been open()ed) and nothing
else? Then there is no need to hold the mutex across the syscalls and
open() can simply fail if the separate variable is set.


Kind regards,
Vegard Nossum

  reply	other threads:[~2008-03-12 16:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 15:45 Frank Munzert
2008-03-12 16:29 ` Vegard Nossum [this message]
2008-03-12 21:40 ` Jiri Kosina
2008-03-13 15:43   ` Daniel Walker
2008-03-13 17:39     ` Peter Zijlstra
2008-03-13 17:56       ` Daniel Walker
  -- strict thread matches above, loose matches on Subject: below --
2008-03-13 16:49 J.C. Pizarro
2007-10-27 14:19 Gabriel C
2007-10-27 15:12 ` Jiri Kosina
2007-10-27 15:28   ` Peter Zijlstra
2007-10-27 15:46     ` Andrew Morton
2007-10-28 11:12       ` Jiri Kosina
2007-10-29 12:20         ` Alessandro Zummo
2007-10-27 16:35     ` Linus Torvalds
2007-10-27 22:47     ` Jiri Kosina
2007-10-27 15:47   ` Arjan van de Ven
2007-10-27 16:09     ` Peter Zijlstra
2007-10-27 17:05       ` Arjan van de Ven

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=19f34abd0803120929j19a043bq711e8a374edbdfe8@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=frankm@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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®