[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 13 Mar 2016 18:28:06 -0400
From: Theodore Ts'o <tytso@....edu>
To: Dmitry Monakhov <dmonakhov@...nvz.org>
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 2/2] jbd2: Prevent panic for destroyed devices
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
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists