[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19f34abd0803120929j19a043bq711e8a374edbdfe8@mail.gmail.com>
Date: Wed, 12 Mar 2008 17:29:54 +0100
From: "Vegard Nossum" <vegard.nossum@...il.com>
To: "Frank Munzert" <frankm@...ux.vnet.ibm.com>
Cc: mingo@...e.hu, linux-kernel@...r.kernel.org
Subject: Re: BUG: lock held when returning to user space
On Wed, Mar 12, 2008 at 4:45 PM, Frank Munzert
<frankm@...ux.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists