Skip to contentSkip to conversation

reiser4: fixed bug in reiser4_kill_root()

PATCH In review Edward Shishkin 2 participants 3 messages Nov 8, 2017 – Nov 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiser4: fixed bug in reiser4_kill_root()

Hi all,

Probably, this is the most essential "old sleeping" bug found for the latest 3 years. It could lead to data corruption (not proven). Details are in the changeset.
It will go to reiser4-for-4.13.1 and higher. For other stuff please, apply (backport, etc) by yourself.

Thanks,
Edward.

commit 5e8518e0031c97e21830372721ee7a5fae78d610

Author: Edward Shishkin <[email protected]>
Date:   Wed Nov 8 21:27:44 2017 +0100

Fixed bug in reiser4_kill_root(): wrong function was called for reinitialization of the old root. As the result, cached number of items remained not updated (i.e. corruption of memory data structures). In practice problems could happen when removing file sets large enough to reduce storage tree height, i.e. when old root is killed and its single child becomes a new root.

jnode.c +1 -1
index d8b2f8600..0f1594cd6 100644
@@ -1310,7 +1310,7 @@ static int remove_znode(jnode * node, reiser4_tree * tree)
 }
 
 /* ->init() method for formatted nodes */
-static int init_znode(jnode * node)
+int init_znode(jnode * node)
 {
 	znode *z;
 
tree_mod.c +1 -1
index 26fff5f08..f9687df8f 100644
@@ -317,7 +317,7 @@ static int reiser4_kill_root(reiser4_tree * tree /* tree from which root is
 		write_unlock_tree(tree);
 
 		/* reinitialise old root. */
-		result = node_plugin_by_node(old_root)->init(old_root);
+		result = init_znode(ZJNODE(old_root));
 		znode_make_dirty(old_root);
 		if (result == 0) {
 			assert("nikita-1279", node_is_empty(old_root));
znode.h +1 -0
index 164fb985a..613377ef6 100644
@@ -218,6 +218,7 @@ extern void znode_remove(znode *, reiser4_tree *);
 extern znode *znode_parent(const znode * node);
 extern znode *znode_parent_nolock(const znode * node);
 extern int znode_above_root(const znode * node);
+extern int init_znode(jnode *node);
 extern int init_znodes(void);
 extern void done_znodes(void);
 extern int znodes_tree_init(reiser4_tree * ztree);
#1 lore raw
Quoted 8 lines · Edward Shishkin

Hi all,

Probably, this is the most essential "old sleeping" bug found for the latest 3 years. It could lead to data corruption (not proven). Details are in the changeset.
It will go to reiser4-for-4.13.1 and higher. For other stuff please, apply (backport, etc) by yourself.

Much appreciated, Edward.

I will apply patch during my build of Linux 4.13.12 for Debian -- later in the evening/night -- to give it a spin.

uname -a
Linux huitzilopochtli 4.13.0-1+reiser4.0.1-amd64 #1 SMP Debian 4.13.11-1+reiser4.0.1 (2017-11-03) x86_64 GNU/Linux

Best Professional Regards.

Signature · 6 lines
Jose R R
http://metztli.it
---------------------------------------------------------------------------------------------
Download Metztli Reiser4: Debian Stretch with Linux 4.12
---------------------------------------------------------------------------------------------
for AMD64 https://sf.net/projects/metztli-reiser4/
#2 lore raw
Quoted 11 lines · Jose R R
Quoted 8 lines · Edward Shishkin

Hi all,

Probably, this is the most essential "old sleeping" bug found for the latest 3 years. It could lead to data corruption (not proven). Details are in the changeset.
It will go to reiser4-for-4.13.1 and higher. For other stuff please, apply (backport, etc) by yourself.

Quoted 4 lines

Much appreciated, Edward.

I will apply patch during my build of Linux 4.13.12 for Debian -- later in the evening/night -- to give it a spin.

Done: wrapped upstream Linux 4.13.12 into (latest) Debian packaging
for Linux 4.13.11-1 and modified version accordingly for
stretch-backports:
< https://sourceforge.net/projects/metztli-reiser4/files/Reiser4-Linux-4.13.12-1_for-Stretch/

Quoted 6 lines

uname -a
Linux huitzilopochtli 4.13.0-1+reiser4.0.1-amd64 #1 SMP Debian 4.13.11-1+reiser4.0.1 (2017-11-03) x86_64 GNU/Linux

Giving a spin to latest bugfix in transparent-compression environment:
uname -a
Linux huitzilopochtli 4.13.0-1+reiser4.0.1-amd64 #1 SMP Debian 4.13.12-1+reiser4.0.1 (2017-11-04) x86_64 GNU/Linux

Thanks again, Ed.

Best Professional Regards.

Signature · 6 lines
Jose R R
http://metztli.it
---------------------------------------------------------------------------------------------
Download Metztli Reiser4: Debian Stretch with Linux 4.12
---------------------------------------------------------------------------------------------
for AMD64 https://sf.net/projects/metztli-reiser4/