mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Linux 3.1 compat, kern_path_parent()
Prior to Linux 3.1 the kern_path_parent symbol was exported for use by kernel modules. As of Linux 3.1 it is now longer easily available. To handle this case the spl will now dynamically look up address of the missing symbol at module load time. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #52
This commit is contained in:
@@ -561,7 +561,7 @@ __init spl_init(void)
|
||||
if ((rc = spl_taskq_init()))
|
||||
SGOTO(out4, rc);
|
||||
|
||||
if ((rc = vn_init()))
|
||||
if ((rc = spl_vn_init()))
|
||||
SGOTO(out5, rc);
|
||||
|
||||
if ((rc = proc_init()))
|
||||
@@ -594,6 +594,9 @@ __init spl_init(void)
|
||||
if ((rc = spl_kmem_init_kallsyms_lookup()))
|
||||
SGOTO(out10, rc);
|
||||
|
||||
if ((rc = spl_vn_init_kallsyms_lookup()))
|
||||
SGOTO(out10, rc);
|
||||
|
||||
printk(KERN_NOTICE "SPL: Loaded module v%s%s, using hostid 0x%08x\n",
|
||||
SPL_META_VERSION, SPL_DEBUG_STR, (unsigned int) spl_hostid);
|
||||
SRETURN(rc);
|
||||
@@ -606,7 +609,7 @@ out8:
|
||||
out7:
|
||||
proc_fini();
|
||||
out6:
|
||||
vn_fini();
|
||||
spl_vn_fini();
|
||||
out5:
|
||||
spl_taskq_fini();
|
||||
out4:
|
||||
@@ -634,7 +637,7 @@ spl_fini(void)
|
||||
tsd_fini();
|
||||
kstat_fini();
|
||||
proc_fini();
|
||||
vn_fini();
|
||||
spl_vn_fini();
|
||||
spl_taskq_fini();
|
||||
spl_rw_fini();
|
||||
spl_mutex_fini();
|
||||
|
||||
+25
-2
@@ -42,6 +42,13 @@ static spl_kmem_cache_t *vn_file_cache;
|
||||
static DEFINE_SPINLOCK(vn_file_lock);
|
||||
static LIST_HEAD(vn_file_list);
|
||||
|
||||
#ifdef HAVE_KERN_PATH_PARENT_HEADER
|
||||
#ifndef HAVE_KERN_PATH_PARENT_SYMBOL
|
||||
kern_path_parent_t kern_path_parent_fn = SYMBOL_POISON;
|
||||
EXPORT_SYMBOL(kern_path_parent_fn);
|
||||
#endif /* HAVE_KERN_PATH_PARENT_SYMBOL */
|
||||
#endif /* HAVE_KERN_PATH_PARENT_HEADER */
|
||||
|
||||
vtype_t
|
||||
vn_mode_to_vtype(mode_t mode)
|
||||
{
|
||||
@@ -789,8 +796,24 @@ vn_file_cache_destructor(void *buf, void *cdrarg)
|
||||
mutex_destroy(&fp->f_lock);
|
||||
} /* vn_file_cache_destructor() */
|
||||
|
||||
int spl_vn_init_kallsyms_lookup(void)
|
||||
{
|
||||
#ifdef HAVE_KERN_PATH_PARENT_HEADER
|
||||
#ifndef HAVE_KERN_PATH_PARENT_SYMBOL
|
||||
kern_path_parent_fn = (kern_path_parent_t)
|
||||
spl_kallsyms_lookup_name("kern_path_parent");
|
||||
if (!kern_path_parent_fn) {
|
||||
printk(KERN_ERR "Error: Unknown symbol kern_path_parent\n");
|
||||
return -EFAULT;
|
||||
}
|
||||
#endif /* HAVE_KERN_PATH_PARENT_SYMBOL */
|
||||
#endif /* HAVE_KERN_PATH_PARENT_HEADER */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
vn_init(void)
|
||||
spl_vn_init(void)
|
||||
{
|
||||
SENTRY;
|
||||
vn_cache = kmem_cache_create("spl_vn_cache",
|
||||
@@ -808,7 +831,7 @@ vn_init(void)
|
||||
} /* vn_init() */
|
||||
|
||||
void
|
||||
vn_fini(void)
|
||||
spl_vn_fini(void)
|
||||
{
|
||||
file_t *fp, *next_fp;
|
||||
int leaked = 0;
|
||||
|
||||
Reference in New Issue
Block a user