xfs
[Top] [All Lists]

Re: [PATCH 1/3] xfs: unlock the inode before log force in xfs_fsync

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 1/3] xfs: unlock the inode before log force in xfs_fsync
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Mon, 19 Sep 2011 08:59:03 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20110918204909.860669185@xxxxxxxxxxxxxxxxxxxxxx>
References: <20110918204748.547510183@xxxxxxxxxxxxxxxxxxxxxx> <20110918204909.860669185@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Sun, Sep 18, 2011 at 04:47:49PM -0400, Christoph Hellwig wrote:
> Only read the LSN we need to push to with the ilock held, and then release
> it before we do the log force to improve concurrency.
> 
> This also removes the only direct caller of _xfs_trans_commit, thus
> allowing it to be merged into the plain xfs_trans_commit again.
> 
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> 
> Index: xfs/fs/xfs/xfs_file.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_file.c        2011-09-07 10:59:55.742961175 +0200
> +++ xfs/fs/xfs/xfs_file.c     2011-09-07 11:08:12.830462974 +0200
> @@ -137,6 +137,7 @@ xfs_file_fsync(
>       struct xfs_trans        *tp;
>       int                     error = 0;
>       int                     log_flushed = 0;
> +     xfs_lsn_t               lsn = 0;
>  
>       trace_xfs_file_fsync(ip);
>  
> @@ -214,8 +215,10 @@ xfs_file_fsync(
>                */
>               xfs_trans_ijoin(tp, ip);
>               xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
> -             xfs_trans_set_sync(tp);
> -             error = _xfs_trans_commit(tp, 0, &log_flushed);
> +             error = xfs_trans_commit(tp, 0);
> +
> +             ASSERT(xfs_ipincount(ip));

That's a racy assert. If the trans commit causes the CIL to be
pushed, that could complete and unpin the inode before we start
executing here again and check the pin count.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>