public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephen C. Tweedie" <sct@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
	Alexander Viro <viro@math.psu.edu>,
	Andrew Morton <akpm@zip.com.au>
Cc: Stephen Tweedie <sct@redhat.com>,
	ext2-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] Orlov allocator directory accounting bug
Date: Fri, 15 Nov 2002 11:08:30 +0000	[thread overview]
Message-ID: <20021115110830.D4512@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

Hi,

In looking at the fix for the ext3 Orlov double-accounting bug, I
noticed a change to the sb->s_dir_count accounting, restoring a
missing s_dir_count++ when we allocate a new directory.

However, I can't find anywhere in the code where we decrement this
again on directory deletion, neither in ext2 nor in ext3, in 2.4 nor
in 2.5.

Patch below is against Ted's 2.4 Orlov-for-ext3 backport, but it looks
like we need something similar in both ext2 and ext3 in 2.5, too.

--Stephen

[-- Attachment #2: 4200-orlov-dircount.patch --]
[-- Type: text/plain, Size: 568 bytes --]

--- linux-2.4-ext3merge/fs/ext3/ialloc.c.=K0023=.orig	Fri Nov 15 11:02:23 2002
+++ linux-2.4-ext3merge/fs/ext3/ialloc.c	Fri Nov 15 11:02:23 2002
@@ -263,9 +263,11 @@
 		if (gdp) {
 			gdp->bg_free_inodes_count = cpu_to_le16(
 				le16_to_cpu(gdp->bg_free_inodes_count) + 1);
-			if (is_directory)
+			if (is_directory) {
 				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);

                 reply	other threads:[~2002-11-15 11:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20021115110830.D4512@redhat.com \
    --to=sct@redhat.com \
    --cc=akpm@zip.com.au \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@math.psu.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