Commit 0443970a authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] SMP-safe ext2/namei.c

	BKL held around ->i_nlink changes in ext2/namei.c.  That makes
namei.c SMP-safe (dir.c already is).  BKL dropped around ext2_free_inode() -
it's already SMP-safe (the only place that needed BKL was DQUOT_FREE_INODE()
and it got BKL in the previous patch).
parent ccc1d4a6
...@@ -60,9 +60,7 @@ void ext2_delete_inode (struct inode * inode) ...@@ -60,9 +60,7 @@ void ext2_delete_inode (struct inode * inode)
inode->i_size = 0; inode->i_size = 0;
if (inode->i_blocks) if (inode->i_blocks)
ext2_truncate (inode); ext2_truncate (inode);
lock_kernel();
ext2_free_inode (inode); ext2_free_inode (inode);
unlock_kernel();
return; return;
no_delete: no_delete:
......
...@@ -39,13 +39,17 @@ ...@@ -39,13 +39,17 @@
static inline void ext2_inc_count(struct inode *inode) static inline void ext2_inc_count(struct inode *inode)
{ {
lock_kernel();
inode->i_nlink++; inode->i_nlink++;
unlock_kernel();
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
static inline void ext2_dec_count(struct inode *inode) static inline void ext2_dec_count(struct inode *inode)
{ {
lock_kernel();
inode->i_nlink--; inode->i_nlink--;
unlock_kernel();
mark_inode_dirty(inode); mark_inode_dirty(inode);
} }
...@@ -73,17 +77,13 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry) ...@@ -73,17 +77,13 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry)
if (dentry->d_name.len > EXT2_NAME_LEN) if (dentry->d_name.len > EXT2_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
lock_kernel();
ino = ext2_inode_by_name(dir, dentry); ino = ext2_inode_by_name(dir, dentry);
inode = NULL; inode = NULL;
if (ino) { if (ino) {
inode = iget(dir->i_sb, ino); inode = iget(dir->i_sb, ino);
if (!inode) { if (!inode)
unlock_kernel();
return ERR_PTR(-EACCES); return ERR_PTR(-EACCES);
}
} }
unlock_kernel();
d_add(dentry, inode); d_add(dentry, inode);
return NULL; return NULL;
} }
...@@ -105,9 +105,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode) ...@@ -105,9 +105,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, int mode)
inode->i_fop = &ext2_file_operations; inode->i_fop = &ext2_file_operations;
inode->i_mapping->a_ops = &ext2_aops; inode->i_mapping->a_ops = &ext2_aops;
mark_inode_dirty(inode); mark_inode_dirty(inode);
lock_kernel();
err = ext2_add_nondir(dentry, inode); err = ext2_add_nondir(dentry, inode);
unlock_kernel();
} }
return err; return err;
} }
...@@ -300,8 +298,11 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, ...@@ -300,8 +298,11 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
ext2_inc_count(old_inode); ext2_inc_count(old_inode);
ext2_set_link(new_dir, new_de, new_page, old_inode); ext2_set_link(new_dir, new_de, new_page, old_inode);
new_inode->i_ctime = CURRENT_TIME; new_inode->i_ctime = CURRENT_TIME;
if (dir_de) if (dir_de) {
lock_kernel();
new_inode->i_nlink--; new_inode->i_nlink--;
unlock_kernel();
}
ext2_dec_count(new_inode); ext2_dec_count(new_inode);
} else { } else {
if (dir_de) { if (dir_de) {
......
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