Commit 30687e0a authored by Al Viro's avatar Al Viro

hpfs: make freeing sbi and codetables rcu-delayed

makes ->d_hash() and ->d_compare() safety in RCU mode independent
from vfsmount_lock
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e2fec7c3
...@@ -80,6 +80,7 @@ struct hpfs_sb_info { ...@@ -80,6 +80,7 @@ struct hpfs_sb_info {
unsigned sb_c_bitmap; /* current bitmap */ unsigned sb_c_bitmap; /* current bitmap */
unsigned sb_max_fwd_alloc; /* max forwad allocation */ unsigned sb_max_fwd_alloc; /* max forwad allocation */
int sb_timeshift; int sb_timeshift;
struct rcu_head rcu;
}; };
/* Four 512-byte buffers and the 2k block obtained by concatenating them */ /* Four 512-byte buffers and the 2k block obtained by concatenating them */
......
...@@ -101,18 +101,24 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, ...@@ -101,18 +101,24 @@ int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2,
return 0; return 0;
} }
static void hpfs_put_super(struct super_block *s) static void free_sbi(struct hpfs_sb_info *sbi)
{ {
struct hpfs_sb_info *sbi = hpfs_sb(s); kfree(sbi->sb_cp_table);
kfree(sbi->sb_bmp_dir);
kfree(sbi);
}
static void lazy_free_sbi(struct rcu_head *rcu)
{
free_sbi(container_of(rcu, struct hpfs_sb_info, rcu));
}
static void hpfs_put_super(struct super_block *s)
{
hpfs_lock(s); hpfs_lock(s);
unmark_dirty(s); unmark_dirty(s);
hpfs_unlock(s); hpfs_unlock(s);
call_rcu(&hpfs_sb(s)->rcu, lazy_free_sbi);
kfree(sbi->sb_cp_table);
kfree(sbi->sb_bmp_dir);
s->s_fs_info = NULL;
kfree(sbi);
} }
unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno)
...@@ -485,9 +491,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) ...@@ -485,9 +491,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
} }
s->s_fs_info = sbi; s->s_fs_info = sbi;
sbi->sb_bmp_dir = NULL;
sbi->sb_cp_table = NULL;
mutex_init(&sbi->hpfs_mutex); mutex_init(&sbi->hpfs_mutex);
hpfs_lock(s); hpfs_lock(s);
...@@ -679,10 +682,7 @@ bail2: brelse(bh0); ...@@ -679,10 +682,7 @@ bail2: brelse(bh0);
bail1: bail1:
bail0: bail0:
hpfs_unlock(s); hpfs_unlock(s);
kfree(sbi->sb_bmp_dir); free_sbi(sbi);
kfree(sbi->sb_cp_table);
s->s_fs_info = NULL;
kfree(sbi);
return -EINVAL; return -EINVAL;
} }
......
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