Re: [PATCH 2/2] jbd2: Prevent panic for destroyed devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux