lkml.org 
[lkml]   [2006]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: 2.6.17-rc6-mm1/pktcdvd - BUG: possible circular locking
From
Date
On Fri, 2006-07-14 at 13:22 +0200, Peter Osterlund wrote:
> > and what locking prevents this? And via multiple opens?
>
> You are right that my reasoning was incorrect. If someone is doing
> "pktsetup ; pktsetup -d" quickly in a loop while someone else is
> trying to open the device, one thread could be at the start of
> pkt_open() at the same time as another thread is in pkt_new_dev().
>
> However, I added a 5s delay in pkt_open() to enlarge the race window.
> I still couldn't make the driver lock up though. The explanation is
> that pkt_new_dev() calls blkdev_get() with the CD device (eg /dev/hdc)
> as bdev parameter, while do_open() locks the bd_mutex for the pktcdvd
> device (eg /dev/pktcdvd/0).
>
> Do you still think this could deadlock? If not, how should the code be
> annotated to make this warning go away?

unless we KNOW it won't deadlock (eg we have a "this cannot deadlock
BECAUSE of X, Y and Z") I don't think annotations are the right idea. In
addition, the "how to annotate" really depends on what X, Y and Z
are....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-14 15:49    [W:0.080 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site