mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 20:54:10 +08:00
shmem: put_super must percpu_counter_destroy
list_add() corruption messages reported from shmem_fill_super()'s recently introduced percpu_counter_init(): shmem_put_super() needs to remember to percpu_counter_destroy(). And also check error from percpu_counter_init(). Reported-bisected-and-tested-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp> Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
19147d0eb1
commit
602586a83b
@ -2325,7 +2325,10 @@ static int shmem_show_options(struct seq_file *seq, struct vfsmount *vfs)
|
|||||||
|
|
||||||
static void shmem_put_super(struct super_block *sb)
|
static void shmem_put_super(struct super_block *sb)
|
||||||
{
|
{
|
||||||
kfree(sb->s_fs_info);
|
struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
|
||||||
|
|
||||||
|
percpu_counter_destroy(&sbinfo->used_blocks);
|
||||||
|
kfree(sbinfo);
|
||||||
sb->s_fs_info = NULL;
|
sb->s_fs_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2367,7 +2370,8 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
spin_lock_init(&sbinfo->stat_lock);
|
spin_lock_init(&sbinfo->stat_lock);
|
||||||
percpu_counter_init(&sbinfo->used_blocks, 0);
|
if (percpu_counter_init(&sbinfo->used_blocks, 0))
|
||||||
|
goto failed;
|
||||||
sbinfo->free_inodes = sbinfo->max_inodes;
|
sbinfo->free_inodes = sbinfo->max_inodes;
|
||||||
|
|
||||||
sb->s_maxbytes = SHMEM_MAX_BYTES;
|
sb->s_maxbytes = SHMEM_MAX_BYTES;
|
||||||
|
Loading…
Reference in New Issue
Block a user