Skip to content

Commit

Permalink
logfs: initialize superblock entries earlier
Browse files Browse the repository at this point in the history
In particular, s_freeing_list needs to be initialized early, since it is
used on some of the error paths when mounts fail.  The mapping inode,
for example, would be initialized and then free'd on an error path
before s_freeing_list was initialized, but the inode drop operation
needs the s_freeing_list to be set up.

Normally you'd never see this, because not only is logfs fairly rare,
but a successful mount will never have any issues.

Reported-by: werner <w.landgraf@ru.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
torvalds committed May 3, 2011
1 parent 609cfda commit cce2c56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/logfs/super.c
Expand Up @@ -480,10 +480,6 @@ static int logfs_read_sb(struct super_block *sb, int read_only)
!read_only)
return -EIO;

mutex_init(&super->s_dirop_mutex);
mutex_init(&super->s_object_alias_mutex);
INIT_LIST_HEAD(&super->s_freeing_list);

ret = logfs_init_rw(sb);
if (ret)
return ret;
Expand Down Expand Up @@ -601,6 +597,10 @@ static struct dentry *logfs_mount(struct file_system_type *type, int flags,
if (!super)
return ERR_PTR(-ENOMEM);

mutex_init(&super->s_dirop_mutex);
mutex_init(&super->s_object_alias_mutex);
INIT_LIST_HEAD(&super->s_freeing_list);

if (!devname)
err = logfs_get_sb_bdev(super, type, devname);
else if (strncmp(devname, "mtd", 3))
Expand Down

0 comments on commit cce2c56

Please sign in to comment.