Commit 6d205f12 authored by Vladimir Saveliev's avatar Vladimir Saveliev Committed by Linus Torvalds

[PATCH] reiserfs: fix key decrementing

This patch fixes a bug in function decrementing a key of stat data item.

Offset of reiserfs keys are compared as signed values.  To set key offset
to maximal possible value maximal signed value has to be used.

This bug is responsible for severe reiserfs filesystem corruption which
shows itself as warning vs-13060.  reiserfsck fixes this corruption by
filesystem tree rebuilding.
Signed-off-by: default avatarVladimir Saveliev <vs@namesys.com>
Cc: <reiserfs-dev@namesys.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 505fa2c4
...@@ -23,7 +23,7 @@ static void sd_decrement_key(struct cpu_key *key) ...@@ -23,7 +23,7 @@ static void sd_decrement_key(struct cpu_key *key)
{ {
key->on_disk_key.k_objectid--; key->on_disk_key.k_objectid--;
set_cpu_key_k_type(key, TYPE_ANY); set_cpu_key_k_type(key, TYPE_ANY);
set_cpu_key_k_offset(key, (loff_t) (-1)); set_cpu_key_k_offset(key, (loff_t)(~0ULL >> 1));
} }
static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize) static int sd_is_left_mergeable(struct reiserfs_key *key, unsigned long bsize)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment