Skip to content

Commit af072cf

Browse files
author
Al Viro
committed
hfsplus: switch to rcu-delayed unloading of nls and freeing ->s_fs_info
->d_hash() and ->d_compare() use those, so we need to delay freeing them. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent a13d1a4 commit af072cf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

fs/hfsplus/hfsplus_fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ struct hfsplus_sb_info {
190190
int work_queued; /* non-zero delayed work is queued */
191191
struct delayed_work sync_work; /* FS sync delayed work */
192192
spinlock_t work_lock; /* protects sync_work and work_queued */
193+
struct rcu_head rcu;
193194
};
194195

195196
#define HFSPLUS_SB_WRITEBACKUP 0

fs/hfsplus/super.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,14 @@ void hfsplus_mark_mdb_dirty(struct super_block *sb)
277277
spin_unlock(&sbi->work_lock);
278278
}
279279

280+
static void delayed_free(struct rcu_head *p)
281+
{
282+
struct hfsplus_sb_info *sbi = container_of(p, struct hfsplus_sb_info, rcu);
283+
284+
unload_nls(sbi->nls);
285+
kfree(sbi);
286+
}
287+
280288
static void hfsplus_put_super(struct super_block *sb)
281289
{
282290
struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
@@ -302,9 +310,7 @@ static void hfsplus_put_super(struct super_block *sb)
302310
hfs_btree_close(sbi->ext_tree);
303311
kfree(sbi->s_vhdr_buf);
304312
kfree(sbi->s_backup_vhdr_buf);
305-
unload_nls(sbi->nls);
306-
kfree(sb->s_fs_info);
307-
sb->s_fs_info = NULL;
313+
call_rcu(&sbi->rcu, delayed_free);
308314
}
309315

310316
static int hfsplus_statfs(struct dentry *dentry, struct kstatfs *buf)

0 commit comments

Comments
 (0)