The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Maciej Babinski <maciej@imsa.edu>, Jens Axboe <axboe@suse.de>,
	"ext2-devel@lists.sourceforge.net"
	<ext2-devel@lists.sourceforge.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.5.46 ext3 errors
Date: Wed, 06 Nov 2002 16:24:57 -0800	[thread overview]
Message-ID: <3DC9B2D9.1081249C@digeo.com> (raw)
In-Reply-To: 20021106175542.A8364@imsa.edu

Maciej Babinski wrote:
> 
> I got this same error while running "seq 1000000|xargs touch"
> in an otherwise empty directory. It got as far as about 20,000
> files before the filesystem was remounted ro.
> 

Looks like we had some overeager cut-n-paste in the Orlov
conversion.

The per-blockgroup inode and directory accounting is being
double-accounted for, and we're not journalling the updates...

This should fix it up, but it is untested.


--- 25/fs/ext3/ialloc.c~ext3-inodes-count-fix	Wed Nov  6 16:16:55 2002
+++ 25-akpm/fs/ext3/ialloc.c	Wed Nov  6 16:24:20 2002
@@ -227,11 +227,6 @@ static int find_group_dir(struct super_b
 	}
 	if (!best_desc)
 		return -1;
-	best_desc->bg_free_inodes_count =
-		cpu_to_le16(le16_to_cpu(best_desc->bg_free_inodes_count) - 1);
-	best_desc->bg_used_dirs_count =
-		cpu_to_le16(le16_to_cpu(best_desc->bg_used_dirs_count) + 1);
-	mark_buffer_dirty(best_bh);
 	return best_group;
 }
 
@@ -355,14 +350,7 @@ fallback:
 	}
 
 	return -1;
-
 found:
-	desc->bg_free_inodes_count =
-		cpu_to_le16(le16_to_cpu(desc->bg_free_inodes_count) - 1);
-	desc->bg_used_dirs_count =
-		cpu_to_le16(le16_to_cpu(desc->bg_used_dirs_count) + 1);
-	sbi->s_dir_count++;
-	mark_buffer_dirty(bh);
 	return group;
 }
 
@@ -410,9 +398,6 @@ static int find_group_other(struct super
 	return -1;
 
 found:
-	desc->bg_free_inodes_count =
-		cpu_to_le16(le16_to_cpu(desc->bg_free_inodes_count) - 1);
-	mark_buffer_dirty(bh);
 	return group;
 }
 
@@ -521,9 +506,11 @@ repeat:
 	if (err) goto fail;
 	gdp->bg_free_inodes_count =
 		cpu_to_le16(le16_to_cpu(gdp->bg_free_inodes_count) - 1);
-	if (S_ISDIR(mode))
+	if (S_ISDIR(mode)) {
 		gdp->bg_used_dirs_count =
 			cpu_to_le16(le16_to_cpu(gdp->bg_used_dirs_count) + 1);
+		EXT3_SB(sb)->s_dir_count++;
+	}
 	BUFFER_TRACE(bh2, "call ext3_journal_dirty_metadata");
 	err = ext3_journal_dirty_metadata(handle, bh2);
 	if (err) goto fail;

_

  reply	other threads:[~2002-11-07  0:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-06  7:54 2.5.46 ext3 errors Jens Axboe
2002-11-06  8:26 ` Jens Axboe
2002-11-06 12:51   ` Stephen Rothwell
2002-11-06 23:55 ` Maciej Babinski
2002-11-07  0:24   ` Andrew Morton [this message]
2002-11-07  3:12     ` Maciej Babinski

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=3DC9B2D9.1081249C@digeo.com \
    --to=akpm@digeo.com \
    --cc=axboe@suse.de \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej@imsa.edu \
    /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