Message ID | 20200211221018.709125-3-preichl@redhat.com (mailing list archive) |
---|---|
State | Deferred, archived |
Headers | show |
Series | [v4,1/4] xfs: Refactor xfs_isilocked() | expand |
On Tue, Feb 11, 2020 at 11:10:17PM +0100, Pavel Reichl wrote: > In its current form, xfs_isilocked() is only able to test one lock type at a > time - ilock, iolock, or mmap lock, but combinations are not properly handled. > The intent here is to check that both XFS_IOLOCK_EXCL and XFS_ILOCK_EXCL are > held, so test them each separately. > > The commit ecfea3f0c8c6 ("xfs: split xfs_bmap_shift_extents") ORed the flags > together which was an error, so this patch reverts that part of the change and > check the locks independently. Commit message should wrap at 68-72 columns. > Fixes: ecfea3f0c8c6 ("xfs: split xfs_bmap_shift_extents") > > Reviewed-by: Eric Sandeen <sandeen@redhat.com> > Suggested-by: Dave Chinner <dchinner@redhat.com> > Signed-off-by: Pavel Reichl <preichl@redhat.com> > --- > Changelog from V3: > Commit message extened. Same comment as the previous patch about the subject - "fix" and abbreviations. xfs: xfs_isilocked() can only check a single lock type Cheers, Dave.
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index bc2be29193aa..c9dc94f114ed 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5829,7 +5829,8 @@ xfs_bmap_collapse_extents( if (XFS_FORCED_SHUTDOWN(mp)) return -EIO; - ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL)); + ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); + ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); if (!(ifp->if_flags & XFS_IFEXTENTS)) { error = xfs_iread_extents(tp, ip, whichfork); @@ -5946,7 +5947,8 @@ xfs_bmap_insert_extents( if (XFS_FORCED_SHUTDOWN(mp)) return -EIO; - ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL)); + ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); + ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); if (!(ifp->if_flags & XFS_IFEXTENTS)) { error = xfs_iread_extents(tp, ip, whichfork);