public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Chinner <dgc@sgi.com>
To: Nathan Scott <nathans@xfs.org>
Cc: Roger Willcocks <roger@filmlight.ltd.uk>, xfs@oss.sgi.com
Subject: Re: race in xfs_rename? (fwd)
Date: Wed, 6 Sep 2006 12:31:28 +1000	[thread overview]
Message-ID: <20060906023128.GN10950339@melbourne.sgi.com> (raw)
In-Reply-To: <20060906083448.J3365803@wobbly.melbourne.sgi.com>

On Wed, Sep 06, 2006 at 08:34:48AM +1000, Nathan Scott wrote:
> Hi Roger,
> 
> I'm gonna be rude and fwd your mail to the list - in the hope
> someone there will be able to help you.  I'm running out of time
> @sgi and have a bunch of stuff still to get done before I skip
> outta here - having to look at the xfs_rename locking right now
> might just be enough to make my head explode. ;)
> 
> cheers.
> 
> ----- Forwarded message from Roger Willcocks <roger@filmlight.ltd.uk> -----
> 
> Date: 05 Sep 2006 14:30:30 +0100
> To: nathans@sgi.com
> X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) 
> From: Roger Willcocks <roger@filmlight.ltd.uk>
> Subject: race in xfs_rename?
> 
> Hi Nathan,
> 
> I think I must be missing something here:
> 
> xfs_rename calls xfs_lock_for_rename, which i-locks the source file and
> directory, target directory, and (if it already exists) the target file.
> 
> It returns a two-to-four entry list of participating inodes.
> 
> xfs_rename unlocks them all, creates a transaction, and then locks them
> all again.
> 
> Surely while they're unlocked, another processor could jump in and
> fiddle with the underlying files and directories?

I don't think that can happen due to i_mutex locking at the vfs layer
i.e. in do_rename() via lock_rename() and in vfs_rename_{dir,other}().
Hence I think it is safe for XFS to do what it does.

FWIW, in Irix where there is no higher layer locking, XFS has extra
checks and locks (ancestor lock, inode generation count checks, etc)
to ensure nothing changed when the locks were dropped and regained.
AFAICT, the Linux XFS code doesn't need to do of this because the VFS
guarantees us that things won't change.....

Cheers,

Dave.
-- 
Dave Chinner
Principal Engineer
SGI Australian Software Group

  reply	other threads:[~2006-09-06  2:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-05 22:34 race in xfs_rename? (fwd) Nathan Scott
2006-09-06  2:31 ` David Chinner [this message]
2006-09-08 14:06   ` Roger Willcocks

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=20060906023128.GN10950339@melbourne.sgi.com \
    --to=dgc@sgi.com \
    --cc=nathans@xfs.org \
    --cc=roger@filmlight.ltd.uk \
    --cc=xfs@oss.sgi.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