From e35f948f848ad30e23d60caa599fc1673f27539c Mon Sep 17 00:00:00 2001 From: BjoKaSH Date: Wed, 5 Sep 2012 13:28:51 +0200 Subject: [PATCH] Fixed missing #ifdef __APPLE__ around change name type in call to zfs_dirent_lock(). The call to zfs_dirent_lock() in zfs_create() was missing an replacing the "char *name" parameter with Apples"componentname_t *cnp". This triggered a kerel panic on file create. panic trace: 0x21b455 : mov 0x8011d0,%eax 0x2a8ab2 : jmp 0x2a8ace 0x29e9a8 : mov %edi,%esp 0x4d614177 : movzbl (%eax),%eax 0x4d6240ca : mov %eax,-0x28(%ebp) 0x4d624820 : leave 0x4d614177 is in zfs_dirent_lock (/Users/bj/new-mac-zfs-bjoka/usr/src/uts/common/fs/zfs/zfs_dir.c:197). 192 ASSERT(name[cnp->cn_namelen] == '\0'); 193 #endif 194 /* 195 * Verify that we are not trying to lock '.', '..', or '.zfs' 196 */ 197 if (name[0] == '.' && 198 (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')) || 199 zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0) 200 return (EEXIST); 201 0x4d6240ca is in zfs_create (/Users/bj/new-mac-zfs-bjoka/usr/src/uts/common/fs/zfs/zfs_vnops.c:1674). 1669 #ifndef __APPLE__ 1670 if (flag & FIGNORECASE) 1671 zflg |= ZCILOOK; 1672 #endif 1673 1674 error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, 1675 NULL, NULL); 1676 if (error) { 1677 if (strcmp(name, "..") == 0) 1678 error = EISDIR; --- usr/src/uts/common/fs/zfs/zfs_vnops.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c index 5fd2f920..f9ab4720 100644 --- a/usr/src/uts/common/fs/zfs/zfs_vnops.c +++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c @@ -1671,8 +1671,13 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, vcexcl_t excl, zflg |= ZCILOOK; #endif +#ifdef __APPLE__ + error = zfs_dirent_lock(&dl, dzp, ct->componentname, &zp, zflg, + NULL, NULL); +#else error = zfs_dirent_lock(&dl, dzp, name, &zp, zflg, NULL, NULL); +#endif if (error) { if (strcmp(name, "..") == 0) error = EISDIR;