mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
ubifs: split allocation of ubifs_info into a separate function
preparation to ubifs sget() race fixes Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
ff78fca2a0
commit
b1c27ab3f9
@ -1971,17 +1971,12 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
static struct ubifs_info *alloc_ubifs_info(struct ubi_volume_desc *ubi)
|
||||
{
|
||||
struct ubi_volume_desc *ubi = sb->s_fs_info;
|
||||
struct ubifs_info *c;
|
||||
struct inode *root;
|
||||
int err;
|
||||
|
||||
c = kzalloc(sizeof(struct ubifs_info), GFP_KERNEL);
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
if (c) {
|
||||
spin_lock_init(&c->cnt_lock);
|
||||
spin_lock_init(&c->cs_lock);
|
||||
spin_lock_init(&c->buds_lock);
|
||||
@ -2014,13 +2009,27 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
INIT_LIST_HEAD(&c->orph_new);
|
||||
c->no_chk_data_crc = 1;
|
||||
|
||||
c->vfs_sb = sb;
|
||||
c->highest_inum = UBIFS_FIRST_INO;
|
||||
c->lhead_lnum = c->ltail_lnum = UBIFS_LOG_LNUM;
|
||||
|
||||
ubi_get_volume_info(ubi, &c->vi);
|
||||
ubi_get_device_info(c->vi.ubi_num, &c->di);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
{
|
||||
struct ubi_volume_desc *ubi = sb->s_fs_info;
|
||||
struct ubifs_info *c;
|
||||
struct inode *root;
|
||||
int err;
|
||||
|
||||
c = alloc_ubifs_info(ubi);
|
||||
if (!c)
|
||||
return -ENOMEM;
|
||||
|
||||
c->vfs_sb = sb;
|
||||
/* Re-open the UBI device in read-write mode */
|
||||
c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READWRITE);
|
||||
if (IS_ERR(c->ubi)) {
|
||||
|
Loading…
Reference in New Issue
Block a user