From: Vlad Yasevich <vladislav.yasevich@hp.com>
To: Zach Brown <zach.brown@oracle.com>
Cc: lksctp-developers@lists.sourceforge.net, netdev@vger.kernel.org,
Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH] sctp: lock_sock_nested in sctp_sock_migrate
Date: Mon, 25 Jun 2007 16:24:23 -0400 [thread overview]
Message-ID: <46802477.5030005@hp.com> (raw)
In-Reply-To: <20070622221446.GB7547@mami.zabbo.net>
Zach Brown wrote:
> I'm not sure that I've gotten either the sctp or lockdep details right,
> but with this patch I don't get lockdep yelling at me any more :)
>
> ------
>
> sctp: lock_sock_nested in sctp_sock_migrate
>
> sctp_sock_migrate() grabs the socket lock on a newly allocated socket while
> holding the socket lock on an old socket. lockdep worries that this might
> be a recursive lock attempt.
>
> task/3026 is trying to acquire lock:
> (sk_lock-AF_INET){--..}, at: [<ffffffff88105b8c>] sctp_sock_migrate+0x2e3/0x327 [sctp]
> but task is already holding lock:
> (sk_lock-AF_INET){--..}, at: [<ffffffff8810891f>] sctp_accept+0xdf/0x1e3 [sctp]
>
> This patch tells lockdep that this locking is safe by using
> lock_sock_nested().
Hm... This is another case of of two different sockets taking the same lock...
Arjan, did this every get fixed, or is the nested locking the right solution
to this?
Thanks
-vlad
>
> Signed-off-by: Zach Brown <zach.brown@oracle.com>
>
> diff -r 8adcfdf2545b net/sctp/socket.c
> --- a/net/sctp/socket.c Fri Jun 22 11:11:33 2007 -0700
> +++ b/net/sctp/socket.c Fri Jun 22 15:05:22 2007 -0700
> @@ -6084,8 +6084,11 @@ static void sctp_sock_migrate(struct soc
> * queued to the backlog. This prevents a potential race between
> * backlog processing on the old socket and new-packet processing
> * on the new socket.
> - */
> - sctp_lock_sock(newsk);
> + *
> + * The caller has just allocated newsk so we can guarantee that other
> + * paths won't try to lock it and then oldsk.
> + */
> + lock_sock_nested(newsk, SINGLE_DEPTH_NESTING);
> sctp_assoc_migrate(assoc, newsk);
>
> /* If the association on the newsk is already closed before accept()
>
next prev parent reply other threads:[~2007-06-25 20:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-22 22:14 [PATCH] sctp: lock_sock_nested in sctp_sock_migrate Zach Brown
2007-06-25 20:24 ` Vlad Yasevich [this message]
2007-06-25 20:24 ` Arjan van de Ven
2007-06-25 20:38 ` Vlad Yasevich
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=46802477.5030005@hp.com \
--to=vladislav.yasevich@hp.com \
--cc=arjan@linux.intel.com \
--cc=lksctp-developers@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=zach.brown@oracle.com \
/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.