gmzang / maczfs

Automatically exported from code.google.com/p/maczfs
Other
0 stars 0 forks source link

Kernel panic when ejecting a ZFS pool #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using MacZFS-72, if I eject a disk (either with Finder, or by using <code>zpool 
export -f</code> 
then I get a kernel panic. 

This also occurs at reboot (when a kernel panic is involved).

Original issue reported on code.google.com by alex.ble...@gmail.com on 6 Mar 2010 at 1:30

GoogleCodeExporter commented 8 years ago

Original comment by alex.ble...@gmail.com on 6 Mar 2010 at 1:31

GoogleCodeExporter commented 8 years ago
When compiled under the 'Debug' rather than 'Release', and without the 
ZFS_DEBUG defined, I don't see a 
panic when exporting pools. I do get a problem when unloading the ZFS kernel 
extension though, which would 
be problematic. So there's clearly some kind of stability issue here.

Original comment by alex.ble...@gmail.com on 7 Mar 2010 at 9:48

GoogleCodeExporter commented 8 years ago
The problem is that we're using the mt_cache to free up the mp, but I think by 
then we've already nuked it.

The call (indirectly) ends up coming from here:

http://github.com/alblue/mac-zfs/blob/maczfs_72/usr/src/uts/common/os/kmem.c#L11
33
1133        kmem_cache_free(cp->cache_magtype->mt_cache, mp);

At that point, cp->cache_magtype->mt_cache is null. we thus try and access its 
properties, and then fail with 
the panic.

It's possibly coming from here:

http://github.com/alblue/mac-zfs/blob/maczfs_72/usr/src/uts/common/os/kmem.c#L29
11

2911            mtp->mt_cache = NULL;

In any case, by the time we get to the end of the routine, we don't have an 
mt_cache any more, so we panic.

Original comment by alex.ble...@gmail.com on 7 Mar 2010 at 11:31

GoogleCodeExporter commented 8 years ago
OK, verified this change with both Release and Debug builds. I no longer see 
this specific issue. 

Original comment by alex.ble...@gmail.com on 8 Mar 2010 at 12:08

GoogleCodeExporter commented 8 years ago
Fixed at 
http://github.com/alblue/mac-zfs/commit/090e1ba81cfbbc9aace0cbfb31dfc14258abfa19

Original comment by alex.ble...@gmail.com on 8 Mar 2010 at 1:22