From: Darrick J. Wong Date: Tue, 10 Jan 2017 02:18:49 +0000 (-0600) Subject: xfs: error out if trying to add attrs and anextents > 0 X-Git-Tag: v4.10.0-rc1~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9656ed10f72f80bc19ca03dbe8b660b2238b92fa;p=thirdparty%2Fxfsprogs-dev.git xfs: error out if trying to add attrs and anextents > 0 Source kernel commit: 0f352f8ee8412bd9d34fb2a6411241da61175c0e We shouldn't assert if somehow we end up trying to add an attr fork to an inode that apparently already has attr extents because this is an indication of on-disk corruption. Instead, return an error code to userspace. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 8c360ca8b..e5ef60127 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -1144,6 +1144,10 @@ xfs_bmap_add_attrfork( goto trans_cancel; if (XFS_IFORK_Q(ip)) goto trans_cancel; + if (ip->i_d.di_anextents != 0) { + error = -EFSCORRUPTED; + goto trans_cancel; + } if (ip->i_d.di_aformat != XFS_DINODE_FMT_EXTENTS) { /* * For inodes coming from pre-6.2 filesystems. @@ -1151,7 +1155,6 @@ xfs_bmap_add_attrfork( ASSERT(ip->i_d.di_aformat == 0); ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; } - ASSERT(ip->i_d.di_anextents == 0); xfs_trans_ijoin(tp, ip, 0); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);