All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] ext2: do not sleep in ext2_error()
Date: Thu, 16 Sep 2021 11:48:36 +0200	[thread overview]
Message-ID: <20210916094836.GD10610@quack2.suse.cz> (raw)
In-Reply-To: <YTIZpijSZc+ykNUY@mit.edu>

On Fri 03-09-21 08:48:38, Theodore Ts'o wrote:
> On Fri, Sep 03, 2021 at 12:05:38PM +0300, Dan Carpenter wrote:
> > No one expects error logging functions to sleep so sometimes they are
> > called with spinlocks held.  In this case the problematic call tree is:
> > 
> > ext2_statfs() <- disables preempt
> > -> ext2_count_free_inodes()
> >    -> ext2_get_group_desc()
> >       -> ext2_error()
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > This is just from static analysis.  NOT TESTED!
> > 
> > Probably a safer fix would be to just call pr_err() instead of
> > ext2_error() in ext2_get_group_desc().  I can send that fix instead if
> > people want.
> 
> Looking at both of the ext2_error() calls in ext2_get_group_desc(),
> those are really more in the way of assertions rather than warning of
> an on-disk corruption issue.  The second "group descriptor not loaded"
> should never happen, and the "block_group >= groups_count" should have
> been caught via an invalid block number or check by the caller (or an
> outright code bug in say ext2_statfs().
> 
> So I suspect both of those would be more usefule as a WARN() rather
> than a call to ext2_error(), since stack trace would actually provide
> more useful data to root causing the issue.  Jan, what do you think?

Yes, I agree. Definitely better than not flushing error on other
ext2_error() calls. BTW, Dan, I don't see a patch with WARN() in my inbox.
Did it get lost somewhere?

								Honza

-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      parent reply	other threads:[~2021-09-16  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03  9:05 [PATCH] ext2: do not sleep in ext2_error() Dan Carpenter
2021-09-03 12:48 ` Theodore Ts'o
2021-09-03 13:09   ` Dan Carpenter
2021-09-16  9:48   ` Jan Kara [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=20210916094836.GD10610@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=dan.carpenter@oracle.com \
    --cc=jack@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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.