lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 23 Jun 2010 22:01:44 +0300
From:	"Amir G." <amir73il@...rs.sourceforge.net>
To:	Theodore Tso <tytso@....edu>
Cc:	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
	Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: [PATCH] call ext4_forget() and ext4_free_blocks() in the same 
	transaction

Hi,

We have experienced bitmap inconsistencies after crash during file
delete under heavy load.
The crash is not file system related and I the following patch in
ext4_free_branches() fixes the recovery problem.

If the transaction is restarted and there is a crash before the new
transaction is committed,
then after recovery, the blocks that this indirect block points to
have been freed, but the indirect block itself
has not been freed and may still point to some of the free blocks
(because of the ext4_forget()).

So ext4_forget() should be called inside ext4_free_blocks() to avoid
this problem.
Are there any consequences to this patch that I am not aware of?

Amir.

Signed-off-by: Amir Goldstein <amir73il@...rs.sf.net>

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 42272d6..682e2fa 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4458,6 +4458,7 @@ static void ext4_free_branches(handle_t *handle,
struct inode *inode,
 {
        ext4_fsblk_t nr;
        __le32 *p;
+       int     flags;

        if (ext4_handle_is_aborted(handle))
                return;
@@ -4520,7 +4521,7 @@ static void ext4_free_branches(handle_t *handle,
struct inode *inode,
                         * revoke records must be emitted *before* clearing
                         * this block's bit in the bitmaps.
                         */
-                       ext4_forget(handle, 1, inode, bh, bh->b_blocknr);
+                       flags =
EXT4_FREE_BLOCKS_METADATA|EXT4_FREE_BLOCKS_FORGET;

                        /*
                         * Everything below this this pointer has been
@@ -4546,8 +4547,7 @@ static void ext4_free_branches(handle_t *handle,
struct inode *inode,
                                            blocks_for_truncate(inode));
                        }

-                       ext4_free_blocks(handle, inode, 0, nr, 1,
-                                        EXT4_FREE_BLOCKS_METADATA);
+                       ext4_free_blocks(handle, inode, 0, nr, 1, flags);

                        if (parent_bh) {
                                /*
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ