PATCH for filesys corruption in ext3 with data=journal

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

 



On Friday May 31, neilb@cse.unsw.edu.au wrote:
> 
> Hi,
> 
>  as I mentioned in earlier mail to ext3-users I have been getting some
> corruption on an ext3 filesystem that has been serving NFS.  I am now
> confident that I fully understand the problem and have a patch.
> 
> It only affects data=journal mode and I wonder if it might also be the
> cause of the corruption noted by a number of people on linux-kernel.
> 
> First I will explain the problem.  Then display the patch.

I should follow-up to say that the patch isn't quite complete.
Just next to
 +			clear_bit(BH_Freed, &bh->b_state);
we need
 +			clear_bit(BH_JBDDirty, &bh->b_state);

This seems to be working for me.

NeilBrown

> 
> 
> --- ./fs/jbd/commit.c	2002/05/28 04:15:18	1.1
> +++ ./fs/jbd/commit.c	2002/05/28 22:44:48
> @@ -663,12 +663,13 @@
>  		 * there's no point in keeping a checkpoint record for
>  		 * it. */
>  		bh = jh2bh(jh);
> -		if (buffer_jdirty(bh)) {
> +		if (buffer_jdirty(bh) && !__buffer_state(bh, Freed)) {
>  			JBUFFER_TRACE(jh, "add to new checkpointing trans");
>  			__journal_insert_checkpoint(jh, commit_transaction);
>  			JBUFFER_TRACE(jh, "refile for checkpoint writeback");
>  			__journal_refile_buffer(jh);
>  		} else {
> +			clear_bit(BH_Freed, &bh->b_state);
>  			J_ASSERT_BH(bh, !buffer_dirty(bh));
>  			J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
>  			__journal_unfile_buffer(jh);
> --- ./fs/jbd/transaction.c	2002/05/26 23:13:05	1.2
> +++ ./fs/jbd/transaction.c	2002/05/28 09:24:45
> @@ -1834,6 +1834,7 @@
>  		 * running transaction if that is set, but nothing
>  		 * else. */
>  		JBUFFER_TRACE(jh, "on committing transaction");
> +		set_bit(BH_Freed, &bh->b_state);
>  		if (jh->b_next_transaction) {
>  			J_ASSERT(jh->b_next_transaction ==
>  					journal->j_running_transaction);





[Index of Archives]         [Linux RAID]     [Kernel Development]     [Red Hat Install]     [Video 4 Linux]     [Postgresql]     [Fedora]     [Gimp]     [Yosemite News]

  Powered by Linux