diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-01-19 05:07:14 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-19 05:07:14 -0800 |
| commit | 6283f86ec40c482d69acb720451cf69098009b9d (patch) | |
| tree | 4903885c0244ae51156c28cc66700003da237944 /fs/ext2 | |
| parent | 70d4c9f258a2d99d8dfe7f7274967872573b0f63 (diff) | |
[PATCH] ext2: s_next_generation locking
There is no locking around the increment of this per-filesystem counter.
Create a new lock, just for this.
Diffstat (limited to 'fs/ext2')
| -rw-r--r-- | fs/ext2/ialloc.c | 2 | ||||
| -rw-r--r-- | fs/ext2/super.c | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 20d396902c25..95ad61fc80b7 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -599,7 +599,9 @@ got: ei->i_dir_start_lookup = 0; ei->i_state = EXT2_STATE_NEW; ext2_set_inode_flags(inode); + spin_lock(&sbi->s_next_gen_lock); inode->i_generation = sbi->s_next_generation++; + spin_unlock(&sbi->s_next_gen_lock); insert_inode_hash(inode); if (DQUOT_ALLOC_INODE(inode)) { diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 410f95252bdb..576951e2bbdd 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -809,6 +809,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) } 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 */ |
