xfs: don't iunlock unlocked inodes
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 17 Jan 2018 02:53:57 +0000 (18:53 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 18 Jan 2018 05:00:46 +0000 (21:00 -0800)
Don't iunlock an unlocked inode, which can happen if the parent pointer
scrubber bails out with sc->ip unlocked while trying to grab the parent
directory inode.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/scrub/scrub.c

index 0ed2a123cbb855ce1aed1dcdd153453ed01abea2..26c75967a0724f23966c8b80df7f06455193c6e4 100644 (file)
@@ -159,7 +159,8 @@ xfs_scrub_teardown(
                sc->tp = NULL;
        }
        if (sc->ip) {
-               xfs_iunlock(sc->ip, sc->ilock_flags);
+               if (sc->ilock_flags)
+                       xfs_iunlock(sc->ip, sc->ilock_flags);
                if (sc->ip != ip_in &&
                    !xfs_internal_inum(sc->mp, sc->ip->i_ino))
                        iput(VFS_I(sc->ip));