| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 1/5] xfs: take the ilock around xfs_bmapi_read in xfs_zero_remaining_bytes |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Thu, 05 Dec 2013 07:58:31 -0800 |
| Delivered-to: | xfs@xxxxxxxxxxx |
| References: | <20131205155830.620826868@xxxxxxxxxxxxxxxxxxxxxx> |
| User-agent: | quilt/0.60-1 |
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Index: xfs/fs/xfs/xfs_bmap_util.c
===================================================================
--- xfs.orig/fs/xfs/xfs_bmap_util.c 2013-12-05 11:37:57.791685284 +0100
+++ xfs/fs/xfs/xfs_bmap_util.c 2013-12-05 11:39:43.599683113 +0100
@@ -1147,6 +1147,7 @@ xfs_zero_remaining_bytes(
xfs_mount_t *mp = ip->i_mount;
int nimap;
int error = 0;
+ uint lock_mode;
/*
* Avoid doing I/O beyond eof - it's not necessary
@@ -1159,11 +1160,15 @@ xfs_zero_remaining_bytes(
if (endoff > XFS_ISIZE(ip))
endoff = XFS_ISIZE(ip);
+ lock_mode = xfs_ilock_map_shared(ip);
+
bp = xfs_buf_get_uncached(XFS_IS_REALTIME_INODE(ip) ?
mp->m_rtdev_targp : mp->m_ddev_targp,
BTOBB(mp->m_sb.sb_blocksize), 0);
- if (!bp)
- return XFS_ERROR(ENOMEM);
+ if (!bp) {
+ error = XFS_ERROR(ENOMEM);
+ goto out_unlock;
+ }
xfs_buf_unlock(bp);
@@ -1209,6 +1214,8 @@ xfs_zero_remaining_bytes(
}
}
xfs_buf_free(bp);
+out_unlock:
+ xfs_iunlock_map_shared(ip, lock_mode);
return error;
}
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/5] extent list locking fixes, Christoph Hellwig |
|---|---|
| Next by Date: | Re: Sudden File System Corruption, Ben Myers |
| Previous by Thread: | Re: [PATCH 4/5] xfs: use xfs_ilock_map_shared in xfs_attr_get, Dave Chinner |
| Next by Thread: | Re: [PATCH 1/5] xfs: take the ilock around xfs_bmapi_read in xfs_zero_remaining_bytes, Ben Myers |
| Indexes: | [Date] [Thread] [Top] [All Lists] |