From: Al Viro <viro@ftp.linux.org.uk>
To: Joshua Hudson <joshudson@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: RFC replace some locking of i_sem wiht atomic_t
Date: Sun, 2 Apr 2006 19:43:15 +0100 [thread overview]
Message-ID: <20060402184315.GD27946@ftp.linux.org.uk> (raw)
In-Reply-To: <bda6d13a0604021101h6cd362efn6d832bfb1275080c@mail.gmail.com>
On Sun, Apr 02, 2006 at 11:01:30AM -0700, Joshua Hudson wrote:
> Herein lies the problem with the current locking scheme:
> 1. rename locks target if it exists, but target may be created by
> link() immediately
> after the check&lock procedure.
> 2. The target of link() is completely unprotected.
3. You have failed to RTFS or RTFM.
> Against ext2, this can result in a corrupted filesystem (two directory
> entries with
> the same name) by a three-way race between two instances of link() and one
> unlink().
Not really.
> 1. Both instances of link are started with target being the same name
> in the same directory.
> 2. unlink() is started on a different name in the same directory.
> 3. link() 1 doesn't find a free slot in the first page, moves to the second.
> *rescheduled before locking second page*
> 4. unlink() finds target in first page, removes it.
> 5. link() 2 finds free slot in first page, creates entry, finishes
> 6. link() 1 continues, finds space in second page, creates entry
And this is BS, since link() _does_ grab ->i_sem on directory it modifies.
So does unlink().
next prev parent reply other threads:[~2006-04-02 18:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-01 0:08 RFC replace some locking of i_sem wiht atomic_t Joshua Hudson
2006-04-02 18:01 ` Joshua Hudson
2006-04-02 18:43 ` Al Viro [this message]
[not found] ` <bda6d13a0604021508g3cc03506yce0170166dc0eda2@mail.gmail.com>
2006-04-02 22:09 ` Joshua Hudson
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=20060402184315.GD27946@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=joshudson@gmail.com \
--cc=linux-kernel@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 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.