Skip to content

Commit

Permalink
Fixed missing #ifdef __APPLE__ around change name type in call to zfs…
Browse files Browse the repository at this point in the history
…_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 <panic+445>:	mov    0x8011d0,%eax
0x2a8ab2 <kernel_trap+1530>:	jmp    0x2a8ace <kernel_trap+1558>
0x29e9a8 <lo_alltraps+712>:	mov    %edi,%esp
0x4d614177 <zfs_dirent_lock+95>:	movzbl (%eax),%eax
0x4d6240ca <zfs_create+542>:	mov    %eax,-0x28(%ebp)
0x4d624820 <zfs_vnop_create+259>:	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;
  • Loading branch information
BjoKaSH committed Sep 5, 2012
1 parent 34cbc19 commit e35f948
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions usr/src/uts/common/fs/zfs/zfs_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e35f948

Please sign in to comment.