openpromfs: don't do unlock_new_inode() until the new inode is set up
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -236,6 +236,8 @@ found:
|
|||||||
mutex_unlock(&op_mutex);
|
mutex_unlock(&op_mutex);
|
||||||
if (IS_ERR(inode))
|
if (IS_ERR(inode))
|
||||||
return ERR_CAST(inode);
|
return ERR_CAST(inode);
|
||||||
|
if (inode->i_state & I_NEW) {
|
||||||
|
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||||
ent_oi = OP_I(inode);
|
ent_oi = OP_I(inode);
|
||||||
ent_oi->type = ent_type;
|
ent_oi->type = ent_type;
|
||||||
ent_oi->u = ent_data;
|
ent_oi->u = ent_data;
|
||||||
@@ -258,6 +260,8 @@ found:
|
|||||||
inode->i_size = ent_oi->u.prop->length;
|
inode->i_size = ent_oi->u.prop->length;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
unlock_new_inode(inode);
|
||||||
|
}
|
||||||
|
|
||||||
return d_splice_alias(inode, dentry);
|
return d_splice_alias(inode, dentry);
|
||||||
}
|
}
|
||||||
@@ -345,20 +349,9 @@ static void openprom_free_inode(struct inode *inode)
|
|||||||
|
|
||||||
static struct inode *openprom_iget(struct super_block *sb, ino_t ino)
|
static struct inode *openprom_iget(struct super_block *sb, ino_t ino)
|
||||||
{
|
{
|
||||||
struct inode *inode;
|
struct inode *inode = iget_locked(sb, ino);
|
||||||
|
|
||||||
inode = iget_locked(sb, ino);
|
|
||||||
if (!inode)
|
if (!inode)
|
||||||
return ERR_PTR(-ENOMEM);
|
inode = ERR_PTR(-ENOMEM);
|
||||||
if (inode->i_state & I_NEW) {
|
|
||||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
|
||||||
if (inode->i_ino == OPENPROM_ROOT_INO) {
|
|
||||||
inode->i_op = &openprom_inode_operations;
|
|
||||||
inode->i_fop = &openprom_operations;
|
|
||||||
inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
|
|
||||||
}
|
|
||||||
unlock_new_inode(inode);
|
|
||||||
}
|
|
||||||
return inode;
|
return inode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,9 +387,15 @@ static int openprom_fill_super(struct super_block *s, struct fs_context *fc)
|
|||||||
goto out_no_root;
|
goto out_no_root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
root_inode->i_mtime = root_inode->i_atime =
|
||||||
|
root_inode->i_ctime = current_time(root_inode);
|
||||||
|
root_inode->i_op = &openprom_inode_operations;
|
||||||
|
root_inode->i_fop = &openprom_operations;
|
||||||
|
root_inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
|
||||||
oi = OP_I(root_inode);
|
oi = OP_I(root_inode);
|
||||||
oi->type = op_inode_node;
|
oi->type = op_inode_node;
|
||||||
oi->u.node = of_find_node_by_path("/");
|
oi->u.node = of_find_node_by_path("/");
|
||||||
|
unlock_new_inode(root_inode);
|
||||||
|
|
||||||
s->s_root = d_make_root(root_inode);
|
s->s_root = d_make_root(root_inode);
|
||||||
if (!s->s_root)
|
if (!s->s_root)
|
||||||
|
|||||||
Reference in New Issue
Block a user