linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] jbd2: Prevent panic for destroyed devices
Date: Sun, 13 Mar 2016 18:28:06 -0400	[thread overview]
Message-ID: <20160313222806.GK29218@thunk.org> (raw)
In-Reply-To: <1455618965-26699-2-git-send-email-dmonakhov@openvz.org>

On Tue, Feb 16, 2016 at 02:36:05PM +0400, Dmitry Monakhov wrote:
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 81e6226..f2760c8 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1333,6 +1333,18 @@ static int jbd2_write_superblock(journal_t *journal, int write_op)
>  	if (!(journal->j_flags & JBD2_BARRIER))
>  		write_op &= ~(REQ_FUA | REQ_FLUSH);
>  	lock_buffer(bh);
> +	/*
> +	 * Some disk drives may invalidate its page cache on failure
> +	 * so sbh becomes unmapped.
> +	 */
> +	if (!buffer_mapped(bh)) {

I think checking bh->bdev == NULL is a better check for this
condition.

> +		/* Disk dissapeared under us, there is nothing we can

Spelling nit: "disappeared"

> +		   do but complain */
> +		printk(KERN_ERR "JBD2: journal superblock was invalidated "
> +		       "for %s.\n", journal->j_devname);
> +		return -EIO;
> +	}
> +

This is missing a an "unlock_buffer(bh)" before we return.


>  	if (buffer_write_io_error(bh)) {
>  		/*
>  		 * Oh, dear.  A previous attempt to write the journal

		       	      		 	 - Ted
						 

  reply	other threads:[~2016-03-13 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 10:36 [PATCH 1/2] ext4: Prevent panic for destroyed devices Dmitry Monakhov
2016-02-16 10:36 ` [PATCH 2/2] jbd2: " Dmitry Monakhov
2016-03-13 22:28   ` Theodore Ts'o [this message]
2016-02-18  9:35 ` [PATCH 1/2] ext4: " Dmitry Monakhov
2016-02-19  5:13   ` Theodore Ts'o
2016-03-13 22:26 ` Theodore Ts'o

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=20160313222806.GK29218@thunk.org \
    --to=tytso@mit.edu \
    --cc=dmonakhov@openvz.org \
    --cc=linux-ext4@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).