From: Dipankar Sarma <dipankar@in.ibm.com>
To: Frank van Maarseveen <frankvm@frankvm.com>
Cc: Pablo Fernandez <pablo.ferlop@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: max_fd
Date: Sat, 24 Sep 2005 00:16:15 +0530 [thread overview]
Message-ID: <20050923184615.GB4573@in.ibm.com> (raw)
In-Reply-To: <20050923184056.GA2024@janus>
On Fri, Sep 23, 2005 at 08:40:56PM +0200, Frank van Maarseveen wrote:
> On Fri, Sep 23, 2005 at 10:56:53PM +0530, Dipankar Sarma wrote:
> >
> > Well, the main reason is that if that code is somehow copied
> > by to a lock-free critical section, it could cause problems.
> > If you dereference ->fdt multiple times in a lock-free
> > section, you could see two different pointers due to
> > a concurrent update.
>
> thanks for the explanation. This raises a lot of other questions. What
> if max_fds is updated by RCU right after obtaining it...
If you are updating it, you hold the lock. That way you can't
be racing with another update. Secondly, changing max_fds
would require allocating a new fdtable structure and
updating ->fdt to point to the new structure, all under
the files_struct lock. The lock-free readers may see the
older fdtable which is kept around until the RCU grace
period is over. That makes it safe.
Thanks
Dipankar
prev parent reply other threads:[~2005-09-23 18:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-23 12:37 max_fd Pablo Fernandez
2005-09-23 15:55 ` max_fd Dipankar Sarma
2005-09-23 17:03 ` max_fd Frank van Maarseveen
2005-09-23 17:26 ` max_fd Dipankar Sarma
2005-09-23 18:40 ` max_fd Frank van Maarseveen
2005-09-23 18:46 ` Dipankar Sarma [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=20050923184615.GB4573@in.ibm.com \
--to=dipankar@in.ibm.com \
--cc=frankvm@frankvm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pablo.ferlop@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox