linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: ?????? shin hong <hongshin@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: BUG? a suspected race bug at alloc_fd()
Date: Fri, 7 Aug 2009 05:08:12 -0600	[thread overview]
Message-ID: <20090807110812.GR3711@parisc-linux.org> (raw)
In-Reply-To: <2014bcab0908062155n6973cb7cg43bc5dcb19261a72@mail.gmail.com>

On Fri, Aug 07, 2009 at 01:55:10PM +0900, ?????? shin hong wrote:
> In alloc_fd(), spin_lock(&files->file_lock) synchronizes
> the execution of its gurading code block(line 448~486 at fs/file.c).
> 
> However, by invocation of expand_files() at line 458,
> spin_lock(&file->file_lock) can be released and re-taken
> since expand_files() invokes expand_fdtable() and expand_fdtable()
> release &files->file_lock and re-take the lock (line 206~208).
> 
> For this reason, the execution of alloc_fd() might result race condition
> if other threads are scheduled between the lock releasing and re-taking.

        /*
         * If we needed to expand the fs array we
         * might have blocked - try again.
         */
        if (error)
                goto repeat;

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

      reply	other threads:[~2009-08-07 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  4:55 BUG? a suspected race bug at alloc_fd() 홍신 shin hong
2009-08-07 11:08 ` Matthew Wilcox [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=20090807110812.GR3711@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=hongshin@gmail.com \
    --cc=linux-fsdevel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).