All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Matthew Wilcox <willy@linux.intel.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: Ensure that inode is non-NULL before calling ext4_error_inode
Date: Wed, 2 Apr 2014 18:47:35 +0200	[thread overview]
Message-ID: <20140402164735.GC8657@quack.suse.cz> (raw)
In-Reply-To: <20140402143630.GB27299@linux.intel.com>

On Wed 02-04-14 10:36:30, Matthew Wilcox wrote:
> 
> __ext4_handle_dirty_metadata can be called with a NULL inode, but
> ext4_error_inode can't.  This is supposed to be a "can't happen" path,
> so we need to find out whether it can legitimately happen or whether
  It can legitimately happen - there is metadata (like bitmaps, inode
table, group descriptor) which doesn't belong to any inode. Thus we leave
inode argument as NULL for these.

> there's some other bug that is causing this to happen.  This prevents
> a NULL pointer reference, so it should be included regardless of what
> the underlying error is.
  I'd prefer wrapping that several-line error into braces. But whatever.
Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
> ---
>  fs/ext4/ext4_jbd2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
> index 3fe29de..383d586 100644
> --- a/fs/ext4/ext4_jbd2.c
> +++ b/fs/ext4/ext4_jbd2.c
> @@ -259,7 +259,8 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
>  		if (WARN_ON_ONCE(err)) {
>  			ext4_journal_abort_handle(where, line, __func__, bh,
>  						  handle, err);
> -			ext4_error_inode(inode, where, line,
> +			if (inode)
> +				ext4_error_inode(inode, where, line,
>  					 bh->b_blocknr,
>  					 "journal_dirty_metadata failed: "
>  					 "handle type %u started at line %u, "
> -- 
> 1.9.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      parent reply	other threads:[~2014-04-02 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 14:36 [PATCH] ext4: Ensure that inode is non-NULL before calling ext4_error_inode Matthew Wilcox
2014-04-02 15:32 ` Theodore Ts'o
2014-04-02 16:47 ` 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=20140402164735.GC8657@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=willy@linux.intel.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.