From: Nathan Lynch <ntl-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
To: Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org
Subject: Re: lockdep complaint from ckpt-v15
Date: Fri, 08 May 2009 15:20:43 -0500 [thread overview]
Message-ID: <m3ocu3ny78.fsf@pobox.com> (raw)
In-Reply-To: <4A047F03.2050803-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> (Oren Laadan's message of "Fri\, 08 May 2009 14\:50\:43 -0400")
Oren Laadan <orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.org> writes:
> Hi Nathan,
>
> This was observed before:
> https://lists.linux-foundation.org/pipermail/containers/2009-February/015595.html
> (and you replied :)
Heh, thought it seemed familiar.
> I believe it's a false alarm: the code takes the pipe's inode mutexthen takes
> the same mutex (of a different inode) when writing data out
> to the output file descriptor.
>
> This could create a deadlock if the user provides the pipe's fd as the output
> file; Howver, I protects against that by explicitly checking that the file of
> the pipe isn't the file in ctx->file.
That will prevent deadlock on that one inode, yes, but I believe lockdep
is pointing to a different problem. Locks of the same class have to be
acquired in some pre-determined order, and lockdep has to be taught that
order. In other words, if it's okay to acquire these inode mutexes in
this order, it must be forbidden to acquire them in the reverse order.
Otherwise you have the potential for AB-BA deadlock. At least, that's
my impression after spending some time with the lockdep and vfs locking
docs... hope I'm right :)
There are vfs operations (rename etc) which need to acquire multiple
inodes' i_mutex in the same class -- the ordering rules are expressed in
include/linux/fs.h:inode_i_mutex_lock_class and with use of
mutex_lock_nested() in e.g. fs/namei.c:lock_rename(). But I don't see
immediately how to apply these mechanisms to this situation.
prev parent reply other threads:[~2009-05-08 20:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 16:59 lockdep complaint from ckpt-v15 Nathan Lynch
[not found] ` <m3ljp7pm2e.fsf-e+AXbWqSrlAAvxtiuMwx3w@public.gmane.org>
2009-05-08 18:50 ` Oren Laadan
[not found] ` <4A047F03.2050803-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2009-05-08 20:20 ` Nathan Lynch [this message]
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=m3ocu3ny78.fsf@pobox.com \
--to=ntl-e+axbwqsrlaavxtiumwx3w@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=orenl-eQaUEPhvms7ENvBUuze7eA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.