xfs
[Top] [All Lists]

[PATCH] xfs: fix inode pincount check in fsync

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: fix inode pincount check in fsync
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Christoph Hellwig <hch@xxxxxx>
Date: Wed, 17 Feb 2010 14:34:57 -0500
Sender: Christoph Hellwig <hch@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.19 (2009-01-05)
We need to hold the ilock to check the inode pincount safely.  While
we're at it also remove the check for ip->i_itemp->ili_last_lsn, a
pinned inode always has it set.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/linux-2.6/xfs_file.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_file.c        2010-02-17 10:46:24.440003402 
+0100
+++ xfs/fs/xfs/linux-2.6/xfs_file.c     2010-02-17 10:47:25.499028406 +0100
@@ -180,17 +180,12 @@ xfs_file_fsync(
                 * disk yet, the inode will be still be pinned.  If it is,
                 * force the log.
                 */
-               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);
-                       }
+                       error = _xfs_log_force_lsn(ip->i_mount,
+                                       ip->i_itemp->ili_last_lsn,
+                                       XFS_LOG_SYNC, &log_flushed);
                }
+               xfs_iunlock(ip, XFS_ILOCK_SHARED);
        }
 
        if (ip->i_mount->m_flags & XFS_MOUNT_BARRIER) {

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