Commit b5b83bae authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] hpfs: hpfs iget locking cleanup preparation

	Preparation to hpfs iget locking cleanup - remaining iget() callers
replaced with explicit iget_locked() + call hpfs_read_inode()/unlock_new_inode()
if inode is new.
parent eb3a6d15
...@@ -244,11 +244,16 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name ...@@ -244,11 +244,16 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
*/ */
hpfs_lock_iget(dir->i_sb, de->directory || (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) ? 1 : 2); hpfs_lock_iget(dir->i_sb, de->directory || (de->ea_size && hpfs_sb(dir->i_sb)->sb_eas) ? 1 : 2);
if (!(result = iget(dir->i_sb, ino))) { result = iget_locked(dir->i_sb, ino);
if (!result) {
hpfs_unlock_iget(dir->i_sb); hpfs_unlock_iget(dir->i_sb);
hpfs_error(dir->i_sb, "hpfs_lookup: can't get inode"); hpfs_error(dir->i_sb, "hpfs_lookup: can't get inode");
goto bail1; goto bail1;
} }
if (result->i_state & I_NEW) {
hpfs_read_inode(result);
unlock_new_inode(result);
}
hpfs_result = hpfs_i(result); hpfs_result = hpfs_i(result);
if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;
hpfs_unlock_iget(dir->i_sb); hpfs_unlock_iget(dir->i_sb);
......
...@@ -249,10 +249,14 @@ void hpfs_write_inode(struct inode *i) ...@@ -249,10 +249,14 @@ void hpfs_write_inode(struct inode *i)
hpfs_inode->i_rddir_off = NULL; hpfs_inode->i_rddir_off = NULL;
} }
hpfs_lock_iget(i->i_sb, 1); hpfs_lock_iget(i->i_sb, 1);
parent = iget(i->i_sb, hpfs_inode->i_parent_dir); parent = iget_locked(i->i_sb, hpfs_inode->i_parent_dir);
if (parent) { if (parent) {
hpfs_unlock_iget(i->i_sb);
hpfs_inode->i_dirty = 0; hpfs_inode->i_dirty = 0;
if (parent->i_state & I_NEW) {
hpfs_read_inode(parent);
unlock_new_inode(parent);
}
hpfs_unlock_iget(i->i_sb);
hpfs_lock_inode(parent); hpfs_lock_inode(parent);
hpfs_write_inode_nolock(i); hpfs_write_inode_nolock(i);
hpfs_unlock_inode(parent); hpfs_unlock_inode(parent);
......
...@@ -614,7 +614,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) ...@@ -614,7 +614,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
brelse(bh0); brelse(bh0);
hpfs_lock_iget(s, 1); hpfs_lock_iget(s, 1);
root = iget(s, sbi->sb_root); root = iget_locked(s, sbi->sb_root);
if (!root) {
hpfs_unlock_iget(s);
goto bail0;
}
hpfs_read_inode(root);
unlock_new_inode(root);
hpfs_unlock_iget(s); hpfs_unlock_iget(s);
s->s_root = d_alloc_root(root); s->s_root = d_alloc_root(root);
if (!s->s_root) { if (!s->s_root) {
......
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