xfs
[Top] [All Lists]

[PATCH 10/11] xfs: always return with the iolock held from xfs_file_aio_

To: xfs@xxxxxxxxxxx
Subject: [PATCH 10/11] xfs: always return with the iolock held from xfs_file_aio_write_checks
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 08 Dec 2011 10:58:05 -0500
References: <20111208155755.323930705@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
While xfs_iunlock is fine with 0 lockflags the calling conventions are much
cleaner if xfs_file_aio_write_checks never returns without the iolock held.

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

---
 fs/xfs/xfs_file.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: xfs/fs/xfs/xfs_file.c
===================================================================
--- xfs.orig/fs/xfs/xfs_file.c  2011-12-07 12:46:31.343897882 +0100
+++ xfs/fs/xfs/xfs_file.c       2011-12-07 12:48:33.309903801 +0100
@@ -636,7 +636,9 @@ out_lock:
 /*
  * Common pre-write limit and setup checks.
  *
- * Returns with iolock held according to @iolock.
+ * Called with the iolocked held either shared and exclusive according to
+ * @iolock, and returns with it held.  Might upgrade the iolock to exclusive
+ * if called for a direct write beyond i_size.
  */
 STATIC ssize_t
 xfs_file_aio_write_checks(
@@ -653,8 +655,7 @@ xfs_file_aio_write_checks(
 restart:
        error = generic_write_checks(file, pos, count, S_ISBLK(inode->i_mode));
        if (error) {
-               xfs_rw_iunlock(ip, XFS_ILOCK_EXCL | *iolock);
-               *iolock = 0;
+               xfs_rw_iunlock(ip, XFS_ILOCK_EXCL);
                return error;
        }
 

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