linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org, Mathias Troiden <mathias.troiden@gmail.com>
Subject: Re: [PATCH] xfs_repair: detect invalid zero-sized symlink inodes
Date: Wed, 1 Mar 2017 08:32:04 -0800	[thread overview]
Message-ID: <20170301163204.GK5297@birch.djwong.org> (raw)
In-Reply-To: <1488380403-5826-1-git-send-email-bfoster@redhat.com>

On Wed, Mar 01, 2017 at 10:00:03AM -0500, Brian Foster wrote:
> Mathias Troiden reproduced a filesystem corruption that resulted in
> a zero-sized local format symlink inode. This is invalid state and
> results in an inode that cannot be accessed or modified.
> 
> The kernel detects this problem on inode access, fails and warns the
> user to umount and run xfs_repair. Unfortunately, xfs_repair doesn't
> even detect the problem. Thus the user has no path to recovery.
> 
> Update xfs_repair to check for invalid zero-sized symlinks and flag
> them as corrupted. This results in tossing the inode, but returns
> the fs to a valid state.
> 
> Reported-by: Mathias Troiden <mathias.troiden@gmail.com>
> Signed-off-by: Brian Foster <bfoster@redhat.com>

Looks good,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  repair/dinode.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/repair/dinode.c b/repair/dinode.c
> index 8d01409..d664f87 100644
> --- a/repair/dinode.c
> +++ b/repair/dinode.c
> @@ -1385,6 +1385,11 @@ process_symlink(
>  		return(1);
>  	}
>  
> +	if (be64_to_cpu(dino->di_size) == 0) {
> +		do_warn(_("zero size symlink in inode %" PRIu64 "\n"), lino);
> +		return 1;
> +	}
> +
>  	/*
>  	 * have to check symlink component by component.
>  	 * get symlink contents into data area
> -- 
> 2.7.4
> 
> --
> 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

  reply	other threads:[~2017-03-01 16:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 15:00 [PATCH] xfs_repair: detect invalid zero-sized symlink inodes Brian Foster
2017-03-01 16:32 ` Darrick J. Wong [this message]
2017-03-02  0:35 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170301163204.GK5297@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mathias.troiden@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).