public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Viorel Canja, Softwin" <vcanja@bitdefender.com>
To: Paul Wagland <paul@wagland.net>
Cc: "David S. Miller" <davem@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re[2]: problem in tcp_v4_synq_add ?
Date: Wed, 10 Mar 2004 13:42:52 +0200	[thread overview]
Message-ID: <1487103774.20040310134252@bitdefender.com> (raw)
In-Reply-To: <F750F6B1-7271-11D8-AFFE-000A95CD704C@wagland.net>

Hello Paul,

This comment in sock.h makes things clearer :

397         /* The syn_wait_lock is necessary only to avoid tcp_get_info having
398          * to grab the main lock sock while browsing the listening hash
399          * (otherwise it's deadlock prone).
400          * This lock is acquired in read mode only from tcp_get_info() and
401          * it's acquired in write mode _only_ from code that is actively
402          * changing the syn_wait_queue. All readers that are holding
403          * the master sock lock don't need to grab this lock in read mode
404          * too as the syn_wait_queue writes are always protected from
405          * the main sock lock.
406          */


best regards,
Viorel

Wednesday, March 10, 2004, 11:04:41 AM, you wrote:


PW> On Mar 9, 2004, at 20:30, David S. Miller wrote:

>> On Tue, 9 Mar 2004 13:27:41 +0200
>> "Viorel Canja, Softwin" <vcanja@bitdefender.com> wrote:
>>
>>> Shouldn't  "write_lock(&tp->syn_wait_lock);" be moved before
>>> "req->dl_next = lopt->syn_table[h];" to avoid a race condition ?
>>
>> Nope, the listening socket's socket lock is held, and all things that
>> add members to these hash chains hold that lock.

PW> Is that the same as saying that the write_lock() is not needed at all?
PW> Since it is already guaranteed to be protected with a different lock?

PW> Cheers,
PW> Paul



  reply	other threads:[~2004-03-10 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 11:27 problem in tcp_v4_synq_add ? Viorel Canja, Softwin
2004-03-09 19:30 ` David S. Miller
2004-03-10  9:04   ` Paul Wagland
2004-03-10 11:42     ` Viorel Canja, Softwin [this message]
2004-03-10 21:37     ` David S. Miller

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=1487103774.20040310134252@bitdefender.com \
    --to=vcanja@bitdefender.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@wagland.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox