From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/4] xfs: fix log block underflow during recovery cycle verification
Date: Mon, 23 Oct 2017 16:50:22 -0700 [thread overview]
Message-ID: <20171023235022.GJ5483@magnolia> (raw)
In-Reply-To: <20171023144646.50107-3-bfoster@redhat.com>
On Mon, Oct 23, 2017 at 10:46:44AM -0400, Brian Foster wrote:
> Unfortunately it is possible for mkfs to format very small
> filesystems with too small of an internal log with respect to the
> various minimum size and block count requirements. If this occurs
> when the log happens to be smaller than the scan window used for
> cycle verification and the scan wraps the end of the log, the
> start_blk calculation in xlog_find_head() underflows and leads to an
> attempt to scan an invalid range of log blocks. This results in log
> recovery failure and a failed mount.
>
> Since there may be filesystems out in the wild with this kind of
> geometry, we cannot simply refuse to mount. Instead, cap the scan
> window for cycle verification to the size of the physical log. This
> ensures that the cycle verification proceeds as expected when the
> scan wraps the end of the log.
>
> Reported-by: Zorro Lang <zlang@redhat.com>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_log_recover.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 80b37a2..019de58 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -760,7 +760,7 @@ xlog_find_head(
> * in the in-core log. The following number can be made tighter if
> * we actually look at the block size of the filesystem.
> */
> - num_scan_bblks = XLOG_TOTAL_REC_SHIFT(log);
> + num_scan_bblks = min_t(int, log_bbnum, XLOG_TOTAL_REC_SHIFT(log));
> if (head_blk >= num_scan_bblks) {
> /*
> * We are guaranteed that the entire check can be performed
> --
> 2.9.5
>
> --
> 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
next prev parent reply other threads:[~2017-10-23 23:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 14:46 [PATCH 0/4] xfs: miscellaneous log recovery fixes Brian Foster
2017-10-23 14:46 ` [PATCH 1/4] xfs: sanity check log record range parameters Brian Foster
2017-10-23 23:49 ` Darrick J. Wong
2017-10-24 11:30 ` Brian Foster
2017-10-25 5:09 ` Darrick J. Wong
2017-10-23 14:46 ` [PATCH 2/4] xfs: fix log block underflow during recovery cycle verification Brian Foster
2017-10-23 23:50 ` Darrick J. Wong [this message]
2017-10-23 14:46 ` [PATCH 3/4] xfs: drain the buffer LRU on mount Brian Foster
2017-10-23 16:39 ` Darrick J. Wong
2017-10-23 16:54 ` Brian Foster
2017-10-24 0:23 ` Darrick J. Wong
2017-10-24 14:06 ` Brian Foster
2017-10-24 19:47 ` Brian Foster
2017-10-23 14:46 ` [PATCH RFC 4/4] xfs: enforce a maximum total iclog buffer size Brian Foster
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=20171023235022.GJ5483@magnolia \
--to=darrick.wong@oracle.com \
--cc=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/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).