From: Dave Chinner <david@fromorbit.com>
To: Ritesh Harjani <ritesh.list@gmail.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: journal geometry is not properly bounds checked
Date: Mon, 19 Jun 2023 18:48:33 +1000 [thread overview]
Message-ID: <ZJAWYXDFJrlqCbQu@dread.disaster.area> (raw)
In-Reply-To: <87r0q7n9bu.fsf@doe.com>
On Mon, Jun 19, 2023 at 01:59:57PM +0530, Ritesh Harjani wrote:
> Dave Chinner <david@fromorbit.com> writes:
> > + if (sbp->sb_logsunit > 1) {
> > + if (sbp->sb_logsunit % sbp->sb_blocksize) {
> > + xfs_notice(mp,
> > + "log stripe unit %u bytes must be a multiple of block size",
> > + sbp->sb_logsunit);
> > + return -EFSCORRUPTED;
> > + }
> > + if (sbp->sb_logsunit > XLOG_MAX_RECORD_BSIZE) {
> > + xfs_notice(mp,
> > + "log stripe unit %u bytes must be a multiple of block size",
> > + sbp->sb_logsunit);
>
> I guess this xfs_notice message needs to be corrected.
>
> > + return -EFSCORRUPTED;
> > + }
> > + }
> > +
> > +
> > +
> > +
>
> too many new lines here ^^^
Fixed.
>
> > - * We can, however, reject mounts for CRC format filesystems, as the
> > + * We can, however, reject mounts for V5 format filesystems, as the
> > * mkfs binary being used to make the filesystem should never create a
> > * filesystem with a log that is too small.
> > */
> > min_logfsbs = xfs_log_calc_minimum_size(mp);
> > -
> > if (mp->m_sb.sb_logblocks < min_logfsbs) {
> > xfs_warn(mp,
> > "Log size %d blocks too small, minimum size is %d blocks",
> > mp->m_sb.sb_logblocks, min_logfsbs);
> > error = -EINVAL;
>
> Are we using this error now?
I'm not changing the existing error for this case.
>
> > - } else if (mp->m_sb.sb_logblocks > XFS_MAX_LOG_BLOCKS) {
> > - xfs_warn(mp,
> > - "Log size %d blocks too large, maximum size is %lld blocks",
> > - mp->m_sb.sb_logblocks, XFS_MAX_LOG_BLOCKS);
> > - error = -EINVAL;
> > - } else if (XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks) > XFS_MAX_LOG_BYTES) {
> > - xfs_warn(mp,
> > - "log size %lld bytes too large, maximum size is %lld bytes",
> > - XFS_FSB_TO_B(mp, mp->m_sb.sb_logblocks),
> > - XFS_MAX_LOG_BYTES);
> > - error = -EINVAL;
> > - } else if (mp->m_sb.sb_logsunit > 1 &&
> > - mp->m_sb.sb_logsunit % mp->m_sb.sb_blocksize) {
> > - xfs_warn(mp,
> > - "log stripe unit %u bytes must be a multiple of block size",
> > - mp->m_sb.sb_logsunit);
> > - error = -EINVAL;
> > - fatal = true;
> > - }
> > - if (error) {
> > +
> > /*
> > * Log check errors are always fatal on v5; or whenever bad
> > * metadata leads to a crash.
> > */
> > - if (fatal) {
> > + if (xfs_has_crc(mp)) {
> > xfs_crit(mp, "AAIEEE! Log failed size checks. Abort!");
> > ASSERT(0);
> > goto out_free_log;
>
> yes, only here in goto out_free_log we will return "error".
> Then why not shift error = -EINVAL in this if block?
Because I tried to change as little as needed to fix the issue. I
didn't think it was necessary to move it from where it was....
Fixed.
-Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2023-06-19 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 7:00 [PATCH] xfs: journal geometry is not properly bounds checked Dave Chinner
2023-06-19 8:29 ` Ritesh Harjani
2023-06-19 8:48 ` Dave Chinner [this message]
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=ZJAWYXDFJrlqCbQu@dread.disaster.area \
--to=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=ritesh.list@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.