Skip to content

Commit

Permalink
ncpfs: rcu-delay unload_nls() and freeing ncp_server
Browse files Browse the repository at this point in the history
makes ->d_hash() and ->d_compare() safety in RCU mode independent
from vfsmount_lock.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Oct 25, 2013
1 parent cac45b0 commit 1dcddd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions fs/ncpfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,17 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
return error;
}

static void delayed_free(struct rcu_head *p)
{
struct ncp_server *server = container_of(p, struct ncp_server, rcu);
#ifdef CONFIG_NCPFS_NLS
/* unload the NLS charsets */
unload_nls(server->nls_vol);
unload_nls(server->nls_io);
#endif /* CONFIG_NCPFS_NLS */
kfree(server);
}

static void ncp_put_super(struct super_block *sb)
{
struct ncp_server *server = NCP_SBP(sb);
Expand All @@ -792,11 +803,6 @@ static void ncp_put_super(struct super_block *sb)

ncp_stop_tasks(server);

#ifdef CONFIG_NCPFS_NLS
/* unload the NLS charsets */
unload_nls(server->nls_vol);
unload_nls(server->nls_io);
#endif /* CONFIG_NCPFS_NLS */
mutex_destroy(&server->rcv.creq_mutex);
mutex_destroy(&server->root_setup_lock);
mutex_destroy(&server->mutex);
Expand All @@ -813,8 +819,7 @@ static void ncp_put_super(struct super_block *sb)
vfree(server->rxbuf);
vfree(server->txbuf);
vfree(server->packet);
sb->s_fs_info = NULL;
kfree(server);
call_rcu(&server->rcu, delayed_free);
}

static int ncp_statfs(struct dentry *dentry, struct kstatfs *buf)
Expand Down
2 changes: 1 addition & 1 deletion fs/ncpfs/ncp_fs_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct ncp_mount_data_kernel {
};

struct ncp_server {

struct rcu_head rcu;
struct ncp_mount_data_kernel m; /* Nearly all of the mount data is of
interest for us later, so we store
it completely. */
Expand Down

0 comments on commit 1dcddd4

Please sign in to comment.