public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>, xfs@oss.sgi.com
Subject: Re: [PATCH 3/4] [PATCH 3/4] xfs: remove wrapper for the fsync file operation
Date: Wed, 17 Feb 2010 03:33:34 -0500	[thread overview]
Message-ID: <20100217083334.GC19943@infradead.org> (raw)
In-Reply-To: <20100217040944.GK28392@discord.disaster>

On Wed, Feb 17, 2010 at 03:09:44PM +1100, Dave Chinner wrote:
> > +		xfs_iunlock(ip, XFS_ILOCK_SHARED);
> > +		if (xfs_ipincount(ip)) {
> > +			if (ip->i_itemp->ili_last_lsn) {
> > +				error = _xfs_log_force_lsn(ip->i_mount,
> > +						ip->i_itemp->ili_last_lsn,
> > +						XFS_LOG_SYNC, &log_flushed);
> > +			} else {
> > +				error = _xfs_log_force(ip->i_mount,
> > +						XFS_LOG_SYNC, &log_flushed);
> > +			}
> > +		}
> 
> To be technically correct, the ilock should be held over the
> pincount check and log force, as is done in xfs_iunpin_wait().
> That way we can guarantee the inode was correctly forced and not
> unpinned between the unlock/check/log force being issued. I know
> this is just a copy of the existing fsync code, but I think that
> the existing code is wrong, too. ;)

Yes, no changes to the code semantics here.  But that ipincount check
is a relatively recent addition from me, too - so thanks for the
slightly delayed review as the comment is absolutely correct.  I'll
prepare a patch for it

> Also, if the inode is pinned while we have it locked, then
> ip->i_itemp->ili_last_lsn is guaranteed to be set as it is updated
> in IOP_COMMITTING() which is called during transaction commit.
> 
> As it is, ili_last_lsn is never reset to zero after a transaction,
> so i think the _xfs_log_force() branch will never be executed,
> either.

True, the same also applies to __xfs_iunpit_wait, I'll look into
that in another patch.  This will also apply to Ben's nfsd
commit_metadata patch.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2010-02-17  8:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15  9:44 [PATCH 0/4] implement optimized fdatasync Christoph Hellwig
2010-02-15  9:44 ` [PATCH 1/4] [PATCH 1/4] xfs: merge xfs_lrw.c into xfs_file.c Christoph Hellwig
2010-02-17  3:36   ` Dave Chinner
2010-02-17  8:14     ` Christoph Hellwig
2010-02-15  9:44 ` [PATCH 2/4] [PATCH 2/4] xfs: remove wrappers for read/write file operations Christoph Hellwig
2010-02-17  3:55   ` Dave Chinner
2010-02-17  8:31     ` Christoph Hellwig
     [not found]       ` <20100217211355.GR28392@discord.disaster>
2010-02-17 22:41         ` Dave Chinner
2010-02-25 20:33       ` Alex Elder
2010-02-15  9:44 ` [PATCH 3/4] [PATCH 3/4] xfs: remove wrapper for the fsync file operation Christoph Hellwig
2010-02-17  4:09   ` Dave Chinner
2010-02-17  8:33     ` Christoph Hellwig [this message]
2010-02-15  9:44 ` [PATCH 4/4] [PATCH 4/4] xfs: implement optimized fdatasync Christoph Hellwig
2010-02-17  4:17   ` Dave Chinner
2010-02-15 21:04 ` [PATCH 0/4] " Andi Kleen
2010-02-15 21:49   ` Christoph Hellwig

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=20100217083334.GC19943@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --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