summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/ext3/ialloc.c6
-rw-r--r--fs/ext3/super.c3
-rw-r--r--include/linux/ext3_fs_sb.h1
3 files changed, 8 insertions, 2 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 13f61fc9e85a..c0c206fea391 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -446,8 +446,8 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
return ERR_PTR(-ENOMEM);
ei = EXT3_I(inode);
- es = EXT3_SB(sb)->s_es;
sbi = EXT3_SB(sb);
+ es = sbi->s_es;
if (S_ISDIR(mode)) {
if (test_opt (sb, OLDALLOC))
group = find_group_dir(sb, dir);
@@ -591,7 +591,9 @@ got:
if (IS_DIRSYNC(inode))
handle->h_sync = 1;
insert_inode_hash(inode);
- inode->i_generation = EXT3_SB(sb)->s_next_generation++;
+ spin_lock(&sbi->s_next_gen_lock);
+ inode->i_generation = sbi->s_next_generation++;
+ spin_unlock(&sbi->s_next_gen_lock);
ei->i_state = EXT3_STATE_NEW;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index e2b4a68ccd1a..ea5cfb9ce3c7 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -31,6 +31,7 @@
#include <linux/smp_lock.h>
#include <linux/buffer_head.h>
#include <linux/vfs.h>
+#include <linux/random.h>
#include <asm/uaccess.h>
#include "xattr.h"
#include "acl.h"
@@ -1287,6 +1288,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
goto failed_mount2;
}
sbi->s_gdb_count = db_count;
+ get_random_bytes(&sbi->s_next_generation, sizeof(u32));
+ spin_lock_init(&sbi->s_next_gen_lock);
/*
* set up enough so that it can read an inode
*/
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index e9b4012cc776..590fd69ec045 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -49,6 +49,7 @@ struct ext3_sb_info {
int s_desc_per_block_bits;
int s_inode_size;
int s_first_ino;
+ spinlock_t s_next_gen_lock;
u32 s_next_generation;
u32 s_hash_seed[4];
int s_def_hash_version;