summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2016-02-08 10:46:51 +1100
committerDave Chinner <david@fromorbit.com>2016-02-08 10:46:51 +1100
commit4b680afb42b9e1b504444583098401a00e63ed3c (patch)
tree6170a1d972054795a8a38afa7404dacb1230eaef /fs/xfs/xfs_bmap_util.c
parent36f90b0a2ddd60823fe193a85e60ff1906c2a9b3 (diff)
downloadlinux-0-day-4b680afb42b9e1b504444583098401a00e63ed3c.tar.gz
linux-0-day-4b680afb42b9e1b504444583098401a00e63ed3c.tar.xz
xfs: lock rt summary inode on allocation
RT allocation can fail on a debug kernel with: XFS: Assertion failed: xfs_isilocked(ip, XFS_ILOCK_SHARED|XFS_ILOCK_EXCL), file: fs/xfs/libxfs/xfs_bmap.c, line: 4039 When modifying the summary inode during allocation. This occurs because the summary inode is never locked, and xfs_bmapi_* operations expect it to be locked. The summary inode is effectively protected byt he lock on the bitmap inode, so this really is only a debug kernel issue. Signed-off-by: Dave Chinner <dchinner@redhat.com> Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r--fs/xfs/xfs_bmap_util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 45ec9e40150c3..07ef29b9b4648 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -202,10 +202,12 @@ xfs_bmap_rtalloc(
ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
/*
- * Lock out other modifications to the RT bitmap inode.
+ * Lock out modifications to both the RT bitmap and summary inodes
*/
xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL);
+ xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL);
+ xfs_trans_ijoin(ap->tp, mp->m_rsumip, XFS_ILOCK_EXCL);
/*
* If it's an allocation to an empty file at offset 0,