lkml.org 
[lkml]   [2008]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: BUG: lock held when returning to user space
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


\
 
 \ /
  Last update: 2008-03-12 17:33    [W:0.092 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site