diff mbox

[2/5] xfs: don't iunlock unlocked inodes

Message ID 151579465207.8694.2459805113822761321.stgit@magnolia (mailing list archive)
State Accepted
Headers show

Commit Message

Darrick J. Wong Jan. 12, 2018, 10:04 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

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>
---
 fs/xfs/scrub/scrub.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Brian Foster Jan. 15, 2018, 2:41 p.m. UTC | #1
On Fri, Jan 12, 2018 at 02:04:12PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> 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 |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
> index 9c177ea..89178b9 100644
> --- a/fs/xfs/scrub/scrub.c
> +++ b/fs/xfs/scrub/scrub.c
> @@ -193,7 +193,8 @@ xfs_scrub_teardown(
>  		sc->fs_frozen = false;
>  	}
>  	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));
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c
index 9c177ea..89178b9 100644
--- a/fs/xfs/scrub/scrub.c
+++ b/fs/xfs/scrub/scrub.c
@@ -193,7 +193,8 @@  xfs_scrub_teardown(
 		sc->fs_frozen = false;
 	}
 	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));