usr/src/uts/common/fs/zfs/zfs_replay.c
author Neil Perrin <Neil.Perrin@Sun.COM>
Thu, 15 Oct 2009 11:39:49 -0600
changeset 10800 469478b180d9
parent 10793 34709091de6d
child 10922 e2081f502306
permissions -rw-r--r--
6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached 6793430 zdb -ivvvv assertion failure: bp->blk_cksum.zc_word[2] == dmu_objset_id(zilog->zl_os)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     1
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     2
 * CDDL HEADER START
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     3
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1816
8c14b56c8515 6408482 64-bit system can't read some 32-bit dev_ts created on zfs
marks
parents: 789
diff changeset
     5
 * Common Development and Distribution License (the "License").
8c14b56c8515 6408482 64-bit system can't read some 32-bit dev_ts created on zfs
marks
parents: 789
diff changeset
     6
 * You may not use this file except in compliance with the License.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     7
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    11
 * and limitations under the License.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    12
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    18
 *
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    19
 * CDDL HEADER END
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    20
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    21
/*
10793
34709091de6d 6886081 Solaris needs reparse point support (PSARC 2009/387)
Dai Ngo <dai.ngo@sun.com>
parents: 6514
diff changeset
    22
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    23
 * Use is subject to license terms.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    24
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    25
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    26
#include <sys/types.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    27
#include <sys/param.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    28
#include <sys/systm.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    29
#include <sys/sysmacros.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    30
#include <sys/cmn_err.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    31
#include <sys/kmem.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    32
#include <sys/thread.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    33
#include <sys/file.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    34
#include <sys/fcntl.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    35
#include <sys/vfs.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    36
#include <sys/fs/zfs.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    37
#include <sys/zfs_znode.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    38
#include <sys/zfs_dir.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    39
#include <sys/zfs_acl.h>
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    40
#include <sys/zfs_fuid.h>
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    41
#include <sys/spa.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    42
#include <sys/zil.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    43
#include <sys/byteorder.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    44
#include <sys/stat.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    45
#include <sys/mode.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    46
#include <sys/acl.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    47
#include <sys/atomic.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    48
#include <sys/cred.h>
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    49
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    50
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    51
 * Functions to replay ZFS intent log (ZIL) records
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    52
 * The functions are called through a function vector (zfs_replay_vector)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    53
 * which is indexed by the transaction type.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    54
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    55
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    56
static void
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    57
zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    58
	uint64_t uid, uint64_t gid, uint64_t rdev, uint64_t nodeid)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    59
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    60
	bzero(vap, sizeof (*vap));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    61
	vap->va_mask = (uint_t)mask;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    62
	vap->va_type = IFTOVT(mode);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    63
	vap->va_mode = mode & MODEMASK;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    64
	vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    65
	vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid;
1816
8c14b56c8515 6408482 64-bit system can't read some 32-bit dev_ts created on zfs
marks
parents: 789
diff changeset
    66
	vap->va_rdev = zfs_cmpldev(rdev);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    67
	vap->va_nodeid = nodeid;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    68
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    69
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    70
/* ARGSUSED */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    71
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    72
zfs_replay_error(zfsvfs_t *zfsvfs, lr_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    73
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    74
	return (ENOTSUP);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    75
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
    76
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    77
static void
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    78
zfs_replay_xvattr(lr_attr_t *lrattr, xvattr_t *xvap)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    79
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    80
	xoptattr_t *xoap = NULL;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    81
	uint64_t *attrs;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    82
	uint64_t *crtime;
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    83
	uint32_t *bitmap;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    84
	void *scanstamp;
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    85
	int i;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    86
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    87
	xvap->xva_vattr.va_mask |= AT_XVATTR;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    88
	if ((xoap = xva_getxoptattr(xvap)) == NULL) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    89
		xvap->xva_vattr.va_mask &= ~AT_XVATTR; /* shouldn't happen */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    90
		return;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    91
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    92
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    93
	ASSERT(lrattr->lr_attr_masksize == xvap->xva_mapsize);
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    94
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    95
	bitmap = &lrattr->lr_attr_bitmap;
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    96
	for (i = 0; i != lrattr->lr_attr_masksize; i++, bitmap++)
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    97
		xvap->xva_reqattrmap[i] = *bitmap;
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
    98
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
    99
	attrs = (uint64_t *)(lrattr + lrattr->lr_attr_masksize - 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   100
	crtime = attrs + 1;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   101
	scanstamp = (caddr_t)(crtime + 2);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   102
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   103
	if (XVA_ISSET_REQ(xvap, XAT_HIDDEN))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   104
		xoap->xoa_hidden = ((*attrs & XAT0_HIDDEN) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   105
	if (XVA_ISSET_REQ(xvap, XAT_SYSTEM))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   106
		xoap->xoa_system = ((*attrs & XAT0_SYSTEM) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   107
	if (XVA_ISSET_REQ(xvap, XAT_ARCHIVE))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   108
		xoap->xoa_archive = ((*attrs & XAT0_ARCHIVE) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   109
	if (XVA_ISSET_REQ(xvap, XAT_READONLY))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   110
		xoap->xoa_readonly = ((*attrs & XAT0_READONLY) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   111
	if (XVA_ISSET_REQ(xvap, XAT_IMMUTABLE))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   112
		xoap->xoa_immutable = ((*attrs & XAT0_IMMUTABLE) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   113
	if (XVA_ISSET_REQ(xvap, XAT_NOUNLINK))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   114
		xoap->xoa_nounlink = ((*attrs & XAT0_NOUNLINK) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   115
	if (XVA_ISSET_REQ(xvap, XAT_APPENDONLY))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   116
		xoap->xoa_appendonly = ((*attrs & XAT0_APPENDONLY) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   117
	if (XVA_ISSET_REQ(xvap, XAT_NODUMP))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   118
		xoap->xoa_nodump = ((*attrs & XAT0_NODUMP) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   119
	if (XVA_ISSET_REQ(xvap, XAT_OPAQUE))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   120
		xoap->xoa_opaque = ((*attrs & XAT0_OPAQUE) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   121
	if (XVA_ISSET_REQ(xvap, XAT_AV_MODIFIED))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   122
		xoap->xoa_av_modified = ((*attrs & XAT0_AV_MODIFIED) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   123
	if (XVA_ISSET_REQ(xvap, XAT_AV_QUARANTINED))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   124
		xoap->xoa_av_quarantined =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   125
		    ((*attrs & XAT0_AV_QUARANTINED) != 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   126
	if (XVA_ISSET_REQ(xvap, XAT_CREATETIME))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   127
		ZFS_TIME_DECODE(&xoap->xoa_createtime, crtime);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   128
	if (XVA_ISSET_REQ(xvap, XAT_AV_SCANSTAMP))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   129
		bcopy(scanstamp, xoap->xoa_av_scanstamp, AV_SCANSTAMP_SZ);
10793
34709091de6d 6886081 Solaris needs reparse point support (PSARC 2009/387)
Dai Ngo <dai.ngo@sun.com>
parents: 6514
diff changeset
   130
	if (XVA_ISSET_REQ(xvap, XAT_REPARSE))
34709091de6d 6886081 Solaris needs reparse point support (PSARC 2009/387)
Dai Ngo <dai.ngo@sun.com>
parents: 6514
diff changeset
   131
		xoap->xoa_reparse = ((*attrs & XAT0_REPARSE) != 0);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   132
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   133
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   134
static int
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   135
zfs_replay_domain_cnt(uint64_t uid, uint64_t gid)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   136
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   137
	uint64_t uid_idx;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   138
	uint64_t gid_idx;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   139
	int domcnt = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   140
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   141
	uid_idx = FUID_INDEX(uid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   142
	gid_idx = FUID_INDEX(gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   143
	if (uid_idx)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   144
		domcnt++;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   145
	if (gid_idx > 0 && gid_idx != uid_idx)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   146
		domcnt++;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   147
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   148
	return (domcnt);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   149
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   150
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   151
static void *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   152
zfs_replay_fuid_domain_common(zfs_fuid_info_t *fuid_infop, void *start,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   153
    int domcnt)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   154
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   155
	int i;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   156
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   157
	for (i = 0; i != domcnt; i++) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   158
		fuid_infop->z_domain_table[i] = start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   159
		start = (caddr_t)start + strlen(start) + 1;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   160
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   161
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   162
	return (start);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   163
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   164
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   165
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   166
 * Set the uid/gid in the fuid_info structure.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   167
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   168
static void
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   169
zfs_replay_fuid_ugid(zfs_fuid_info_t *fuid_infop, uint64_t uid, uint64_t gid)
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   170
{
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   171
	/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   172
	 * If owner or group are log specific FUIDs then slurp up
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   173
	 * domain information and build zfs_fuid_info_t
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   174
	 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   175
	if (IS_EPHEMERAL(uid))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   176
		fuid_infop->z_fuid_owner = uid;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   177
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   178
	if (IS_EPHEMERAL(gid))
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   179
		fuid_infop->z_fuid_group = gid;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   180
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   181
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   182
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   183
 * Load fuid domains into fuid_info_t
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   184
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   185
static zfs_fuid_info_t *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   186
zfs_replay_fuid_domain(void *buf, void **end, uint64_t uid, uint64_t gid)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   187
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   188
	int domcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   189
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   190
	zfs_fuid_info_t *fuid_infop;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   191
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   192
	fuid_infop = zfs_fuid_info_alloc();
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   193
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   194
	domcnt = zfs_replay_domain_cnt(uid, gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   195
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   196
	if (domcnt == 0)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   197
		return (fuid_infop);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   198
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   199
	fuid_infop->z_domain_table =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   200
	    kmem_zalloc(domcnt * sizeof (char **), KM_SLEEP);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   201
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   202
	zfs_replay_fuid_ugid(fuid_infop, uid, gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   203
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   204
	fuid_infop->z_domain_cnt = domcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   205
	*end = zfs_replay_fuid_domain_common(fuid_infop, buf, domcnt);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   206
	return (fuid_infop);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   207
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   208
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   209
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   210
 * load zfs_fuid_t's and fuid_domains into fuid_info_t
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   211
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   212
static zfs_fuid_info_t *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   213
zfs_replay_fuids(void *start, void **end, int idcnt, int domcnt, uint64_t uid,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   214
    uint64_t gid)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   215
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   216
	uint64_t *log_fuid = (uint64_t *)start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   217
	zfs_fuid_info_t *fuid_infop;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   218
	int i;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   219
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   220
	fuid_infop = zfs_fuid_info_alloc();
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   221
	fuid_infop->z_domain_cnt = domcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   222
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   223
	fuid_infop->z_domain_table =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   224
	    kmem_zalloc(domcnt * sizeof (char **), KM_SLEEP);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   225
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   226
	for (i = 0; i != idcnt; i++) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   227
		zfs_fuid_t *zfuid;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   228
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   229
		zfuid = kmem_alloc(sizeof (zfs_fuid_t), KM_SLEEP);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   230
		zfuid->z_logfuid = *log_fuid;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   231
		zfuid->z_id = -1;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   232
		zfuid->z_domidx = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   233
		list_insert_tail(&fuid_infop->z_fuids, zfuid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   234
		log_fuid++;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   235
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   236
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   237
	zfs_replay_fuid_ugid(fuid_infop, uid, gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   238
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   239
	*end = zfs_replay_fuid_domain_common(fuid_infop, log_fuid, domcnt);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   240
	return (fuid_infop);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   241
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   242
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   243
static void
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   244
zfs_replay_swap_attrs(lr_attr_t *lrattr)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   245
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   246
	/* swap the lr_attr structure */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   247
	byteswap_uint32_array(lrattr, sizeof (*lrattr));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   248
	/* swap the bitmap */
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   249
	byteswap_uint32_array(lrattr + 1, (lrattr->lr_attr_masksize - 1) *
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   250
	    sizeof (uint32_t));
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   251
	/* swap the attributes, create time + 64 bit word for attributes */
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   252
	byteswap_uint64_array((caddr_t)(lrattr + 1) + (sizeof (uint32_t) *
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   253
	    (lrattr->lr_attr_masksize - 1)), 3 * sizeof (uint64_t));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   254
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   255
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   256
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   257
 * Replay file create with optional ACL, xvattr information as well
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   258
 * as option FUID information.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   259
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   260
static int
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   261
zfs_replay_create_acl(zfsvfs_t *zfsvfs,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   262
    lr_acl_create_t *lracl, boolean_t byteswap)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   263
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   264
	char *name = NULL;		/* location determined later */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   265
	lr_create_t *lr = (lr_create_t *)lracl;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   266
	znode_t *dzp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   267
	vnode_t *vp = NULL;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   268
	xvattr_t xva;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   269
	int vflg = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   270
	vsecattr_t vsec = { 0 };
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   271
	lr_attr_t *lrattr;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   272
	void *aclstart;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   273
	void *fuidstart;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   274
	size_t xvatlen = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   275
	uint64_t txtype;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   276
	int error;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   277
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   278
	if (byteswap) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   279
		byteswap_uint64_array(lracl, sizeof (*lracl));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   280
		txtype = (int)lr->lr_common.lrc_txtype;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   281
		if (txtype == TX_CREATE_ACL_ATTR ||
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   282
		    txtype == TX_MKDIR_ACL_ATTR) {
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   283
			lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   284
			zfs_replay_swap_attrs(lrattr);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   285
			xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   286
		}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   287
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   288
		aclstart = (caddr_t)(lracl + 1) + xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   289
		zfs_ace_byteswap(aclstart, lracl->lr_acl_bytes, B_FALSE);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   290
		/* swap fuids */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   291
		if (lracl->lr_fuidcnt) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   292
			byteswap_uint64_array((caddr_t)aclstart +
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   293
			    ZIL_ACE_LENGTH(lracl->lr_acl_bytes),
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   294
			    lracl->lr_fuidcnt * sizeof (uint64_t));
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   295
		}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   296
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   297
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   298
	if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   299
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   300
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   301
	xva_init(&xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   302
	zfs_init_vattr(&xva.xva_vattr, AT_TYPE | AT_MODE | AT_UID | AT_GID,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   303
	    lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, lr->lr_foid);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   304
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   305
	/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   306
	 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   307
	 * eventually end up in zfs_mknode(), which assigns the object's
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   308
	 * creation time and generation number.  The generic VOP_CREATE()
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   309
	 * doesn't have either concept, so we smuggle the values inside
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   310
	 * the vattr's otherwise unused va_ctime and va_nblocks fields.
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   311
	 */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   312
	ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   313
	xva.xva_vattr.va_nblocks = lr->lr_gen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   314
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   315
	error = dmu_object_info(zfsvfs->z_os, lr->lr_foid, NULL);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   316
	if (error != ENOENT)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   317
		goto bail;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   318
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   319
	if (lr->lr_common.lrc_txtype & TX_CI)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   320
		vflg |= FIGNORECASE;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   321
	switch ((int)lr->lr_common.lrc_txtype) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   322
	case TX_CREATE_ACL:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   323
		aclstart = (caddr_t)(lracl + 1);
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   324
		fuidstart = (caddr_t)aclstart +
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   325
		    ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   326
		zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   327
		    (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   328
		    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   329
		/*FALLTHROUGH*/
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   330
	case TX_CREATE_ACL_ATTR:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   331
		if (name == NULL) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   332
			lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   333
			xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   334
			xva.xva_vattr.va_mask |= AT_XVATTR;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   335
			zfs_replay_xvattr(lrattr, &xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   336
		}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   337
		vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   338
		vsec.vsa_aclentp = (caddr_t)(lracl + 1) + xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   339
		vsec.vsa_aclcnt = lracl->lr_aclcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   340
		vsec.vsa_aclentsz = lracl->lr_acl_bytes;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   341
		vsec.vsa_aclflags = lracl->lr_acl_flags;
5833
1a2bbcec3b3f 6649841 zfs_replay_create_acl() has improper indentation
marks
parents: 5435
diff changeset
   342
		if (zfsvfs->z_fuid_replay == NULL) {
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   343
			fuidstart = (caddr_t)(lracl + 1) + xvatlen +
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   344
			    ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   345
			zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   346
			    zfs_replay_fuids(fuidstart,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   347
			    (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   348
			    lr->lr_uid, lr->lr_gid);
5833
1a2bbcec3b3f 6649841 zfs_replay_create_acl() has improper indentation
marks
parents: 5435
diff changeset
   349
		}
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   350
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   351
		error = VOP_CREATE(ZTOV(dzp), name, &xva.xva_vattr,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   352
		    0, 0, &vp, kcred, vflg, NULL, &vsec);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   353
		break;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   354
	case TX_MKDIR_ACL:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   355
		aclstart = (caddr_t)(lracl + 1);
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   356
		fuidstart = (caddr_t)aclstart +
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   357
		    ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   358
		zfsvfs->z_fuid_replay = zfs_replay_fuids(fuidstart,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   359
		    (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   360
		    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   361
		/*FALLTHROUGH*/
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   362
	case TX_MKDIR_ACL_ATTR:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   363
		if (name == NULL) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   364
			lrattr = (lr_attr_t *)(caddr_t)(lracl + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   365
			xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   366
			zfs_replay_xvattr(lrattr, &xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   367
		}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   368
		vsec.vsa_mask = VSA_ACE | VSA_ACE_ACLFLAGS;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   369
		vsec.vsa_aclentp = (caddr_t)(lracl + 1) + xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   370
		vsec.vsa_aclcnt = lracl->lr_aclcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   371
		vsec.vsa_aclentsz = lracl->lr_acl_bytes;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   372
		vsec.vsa_aclflags = lracl->lr_acl_flags;
5833
1a2bbcec3b3f 6649841 zfs_replay_create_acl() has improper indentation
marks
parents: 5435
diff changeset
   373
		if (zfsvfs->z_fuid_replay == NULL) {
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   374
			fuidstart = (caddr_t)(lracl + 1) + xvatlen +
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   375
			    ZIL_ACE_LENGTH(lracl->lr_acl_bytes);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   376
			zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   377
			    zfs_replay_fuids(fuidstart,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   378
			    (void *)&name, lracl->lr_fuidcnt, lracl->lr_domcnt,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   379
			    lr->lr_uid, lr->lr_gid);
5833
1a2bbcec3b3f 6649841 zfs_replay_create_acl() has improper indentation
marks
parents: 5435
diff changeset
   380
		}
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   381
		error = VOP_MKDIR(ZTOV(dzp), name, &xva.xva_vattr,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   382
		    &vp, kcred, NULL, vflg, &vsec);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   383
		break;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   384
	default:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   385
		error = ENOTSUP;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   386
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   387
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   388
bail:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   389
	if (error == 0 && vp != NULL)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   390
		VN_RELE(vp);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   391
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   392
	VN_RELE(ZTOV(dzp));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   393
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   394
	zfs_fuid_info_free(zfsvfs->z_fuid_replay);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   395
	zfsvfs->z_fuid_replay = NULL;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   396
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   397
	return (error);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   398
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   399
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   400
static int
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   401
zfs_replay_create(zfsvfs_t *zfsvfs, lr_create_t *lr, boolean_t byteswap)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   402
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   403
	char *name = NULL;		/* location determined later */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   404
	char *link;			/* symlink content follows name */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   405
	znode_t *dzp;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   406
	vnode_t *vp = NULL;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   407
	xvattr_t xva;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   408
	int vflg = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   409
	size_t lrsize = sizeof (lr_create_t);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   410
	lr_attr_t *lrattr;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   411
	void *start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   412
	size_t xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   413
	uint64_t txtype;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   414
	int error;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   415
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   416
	if (byteswap) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   417
		byteswap_uint64_array(lr, sizeof (*lr));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   418
		txtype = (int)lr->lr_common.lrc_txtype;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   419
		if (txtype == TX_CREATE_ATTR || txtype == TX_MKDIR_ATTR)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   420
			zfs_replay_swap_attrs((lr_attr_t *)(lr + 1));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   421
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   422
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   423
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   424
	if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   425
		return (error);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   426
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   427
	xva_init(&xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   428
	zfs_init_vattr(&xva.xva_vattr, AT_TYPE | AT_MODE | AT_UID | AT_GID,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   429
	    lr->lr_mode, lr->lr_uid, lr->lr_gid, lr->lr_rdev, lr->lr_foid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   430
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   431
	/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   432
	 * All forms of zfs create (create, mkdir, mkxattrdir, symlink)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   433
	 * eventually end up in zfs_mknode(), which assigns the object's
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   434
	 * creation time and generation number.  The generic VOP_CREATE()
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   435
	 * doesn't have either concept, so we smuggle the values inside
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   436
	 * the vattr's otherwise unused va_ctime and va_nblocks fields.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   437
	 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   438
	ZFS_TIME_DECODE(&xva.xva_vattr.va_ctime, lr->lr_crtime);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   439
	xva.xva_vattr.va_nblocks = lr->lr_gen;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   440
4480
0976678e58c5 6544140 assertion failed: err == 0 (0x11 == 0x0), file: ../../common/fs/zfs/zfs_znode.c, line: 555
gw25295
parents: 2638
diff changeset
   441
	error = dmu_object_info(zfsvfs->z_os, lr->lr_foid, NULL);
0976678e58c5 6544140 assertion failed: err == 0 (0x11 == 0x0), file: ../../common/fs/zfs/zfs_znode.c, line: 555
gw25295
parents: 2638
diff changeset
   442
	if (error != ENOENT)
0976678e58c5 6544140 assertion failed: err == 0 (0x11 == 0x0), file: ../../common/fs/zfs/zfs_znode.c, line: 555
gw25295
parents: 2638
diff changeset
   443
		goto out;
0976678e58c5 6544140 assertion failed: err == 0 (0x11 == 0x0), file: ../../common/fs/zfs/zfs_znode.c, line: 555
gw25295
parents: 2638
diff changeset
   444
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   445
	if (lr->lr_common.lrc_txtype & TX_CI)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   446
		vflg |= FIGNORECASE;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   447
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   448
	/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   449
	 * Symlinks don't have fuid info, and CIFS never creates
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   450
	 * symlinks.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   451
	 *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   452
	 * The _ATTR versions will grab the fuid info in their subcases.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   453
	 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   454
	if ((int)lr->lr_common.lrc_txtype != TX_SYMLINK &&
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   455
	    (int)lr->lr_common.lrc_txtype != TX_MKDIR_ATTR &&
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   456
	    (int)lr->lr_common.lrc_txtype != TX_CREATE_ATTR) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   457
		start = (lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   458
		zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   459
		    zfs_replay_fuid_domain(start, &start,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   460
		    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   461
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   462
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   463
	switch ((int)lr->lr_common.lrc_txtype) {
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   464
	case TX_CREATE_ATTR:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   465
		lrattr = (lr_attr_t *)(caddr_t)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   466
		xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   467
		zfs_replay_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), &xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   468
		start = (caddr_t)(lr + 1) + xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   469
		zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   470
		    zfs_replay_fuid_domain(start, &start,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   471
		    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   472
		name = (char *)start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   473
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   474
		/*FALLTHROUGH*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   475
	case TX_CREATE:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   476
		if (name == NULL)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   477
			name = (char *)start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   478
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   479
		error = VOP_CREATE(ZTOV(dzp), name, &xva.xva_vattr,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   480
		    0, 0, &vp, kcred, vflg, NULL, NULL);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   481
		break;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   482
	case TX_MKDIR_ATTR:
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   483
		lrattr = (lr_attr_t *)(caddr_t)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   484
		xvatlen = ZIL_XVAT_SIZE(lrattr->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   485
		zfs_replay_xvattr((lr_attr_t *)((caddr_t)lr + lrsize), &xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   486
		start = (caddr_t)(lr + 1) + xvatlen;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   487
		zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   488
		    zfs_replay_fuid_domain(start, &start,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   489
		    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   490
		name = (char *)start;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   491
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   492
		/*FALLTHROUGH*/
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   493
	case TX_MKDIR:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   494
		if (name == NULL)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   495
			name = (char *)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   496
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   497
		error = VOP_MKDIR(ZTOV(dzp), name, &xva.xva_vattr,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   498
		    &vp, kcred, NULL, vflg, NULL);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   499
		break;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   500
	case TX_MKXATTR:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   501
		name = (char *)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   502
		error = zfs_make_xattrdir(dzp, &xva.xva_vattr, &vp, kcred);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   503
		break;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   504
	case TX_SYMLINK:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   505
		name = (char *)(lr + 1);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   506
		link = name + strlen(name) + 1;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   507
		error = VOP_SYMLINK(ZTOV(dzp), name, &xva.xva_vattr,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   508
		    link, kcred, NULL, vflg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   509
		break;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   510
	default:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   511
		error = ENOTSUP;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   512
	}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   513
4480
0976678e58c5 6544140 assertion failed: err == 0 (0x11 == 0x0), file: ../../common/fs/zfs/zfs_znode.c, line: 555
gw25295
parents: 2638
diff changeset
   514
out:
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   515
	if (error == 0 && vp != NULL)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   516
		VN_RELE(vp);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   517
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   518
	VN_RELE(ZTOV(dzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   519
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   520
	if (zfsvfs->z_fuid_replay)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   521
		zfs_fuid_info_free(zfsvfs->z_fuid_replay);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   522
	zfsvfs->z_fuid_replay = NULL;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   523
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   524
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   525
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   526
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   527
zfs_replay_remove(zfsvfs_t *zfsvfs, lr_remove_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   528
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   529
	char *name = (char *)(lr + 1);	/* name follows lr_remove_t */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   530
	znode_t *dzp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   531
	int error;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   532
	int vflg = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   533
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   534
	if (byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   535
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   536
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   537
	if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   538
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   539
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   540
	if (lr->lr_common.lrc_txtype & TX_CI)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   541
		vflg |= FIGNORECASE;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   542
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   543
	switch ((int)lr->lr_common.lrc_txtype) {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   544
	case TX_REMOVE:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   545
		error = VOP_REMOVE(ZTOV(dzp), name, kcred, NULL, vflg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   546
		break;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   547
	case TX_RMDIR:
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   548
		error = VOP_RMDIR(ZTOV(dzp), name, NULL, kcred, NULL, vflg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   549
		break;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   550
	default:
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   551
		error = ENOTSUP;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   552
	}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   553
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   554
	VN_RELE(ZTOV(dzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   555
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   556
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   557
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   558
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   559
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   560
zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   561
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   562
	char *name = (char *)(lr + 1);	/* name follows lr_link_t */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   563
	znode_t *dzp, *zp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   564
	int error;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   565
	int vflg = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   566
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   567
	if (byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   568
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   569
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   570
	if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   571
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   572
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   573
	if ((error = zfs_zget(zfsvfs, lr->lr_link_obj, &zp)) != 0) {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   574
		VN_RELE(ZTOV(dzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   575
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   576
	}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   577
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   578
	if (lr->lr_common.lrc_txtype & TX_CI)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   579
		vflg |= FIGNORECASE;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   580
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   581
	error = VOP_LINK(ZTOV(dzp), ZTOV(zp), name, kcred, NULL, vflg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   582
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   583
	VN_RELE(ZTOV(zp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   584
	VN_RELE(ZTOV(dzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   585
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   586
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   587
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   588
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   589
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   590
zfs_replay_rename(zfsvfs_t *zfsvfs, lr_rename_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   591
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   592
	char *sname = (char *)(lr + 1);	/* sname and tname follow lr_rename_t */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   593
	char *tname = sname + strlen(sname) + 1;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   594
	znode_t *sdzp, *tdzp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   595
	int error;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   596
	int vflg = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   597
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   598
	if (byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   599
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   600
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   601
	if ((error = zfs_zget(zfsvfs, lr->lr_sdoid, &sdzp)) != 0)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   602
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   603
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   604
	if ((error = zfs_zget(zfsvfs, lr->lr_tdoid, &tdzp)) != 0) {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   605
		VN_RELE(ZTOV(sdzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   606
		return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   607
	}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   608
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   609
	if (lr->lr_common.lrc_txtype & TX_CI)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   610
		vflg |= FIGNORECASE;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   611
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   612
	error = VOP_RENAME(ZTOV(sdzp), sname, ZTOV(tdzp), tname, kcred,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   613
	    NULL, vflg);
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   614
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   615
	VN_RELE(ZTOV(tdzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   616
	VN_RELE(ZTOV(sdzp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   617
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   618
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   619
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   620
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   621
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   622
zfs_replay_write(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   623
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   624
	char *data = (char *)(lr + 1);	/* data follows lr_write_t */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   625
	znode_t	*zp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   626
	int error;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   627
	ssize_t resid;
10800
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   628
	uint64_t orig_eof, eod;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   629
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   630
	if (byteswap)
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   631
		byteswap_uint64_array(lr, sizeof (*lr));
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   632
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   633
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   634
		/*
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   635
		 * As we can log writes out of order, it's possible the
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   636
		 * file has been removed. In this case just drop the write
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   637
		 * and return success.
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   638
		 */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   639
		if (error == ENOENT)
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   640
			error = 0;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   641
		return (error);
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   642
	}
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   643
	orig_eof = zp->z_phys->zp_size;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   644
	eod = lr->lr_offset + lr->lr_length; /* end of data for this write */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   645
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   646
	/* If it's a dmu_sync() block get the data and write the whole block */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   647
	if (lr->lr_common.lrc_reclen == sizeof (lr_write_t))
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   648
		zil_get_replay_data(zfsvfs->z_log, lr);
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   649
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   650
	error = vn_rdwr(UIO_WRITE, ZTOV(zp), data, lr->lr_length,
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   651
	    lr->lr_offset, UIO_SYSSPACE, 0, RLIM64_INFINITY, kcred, &resid);
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   652
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   653
	/*
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   654
	 * This may be a write from a dmu_sync() for a whole block,
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   655
	 * and may extend beyond the current end of the file.
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   656
	 * We can't just replay what was written for this TX_WRITE as
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   657
	 * a future TX_WRITE2 may extend the eof and the data for that
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   658
	 * write needs to be there. So we write the whole block and
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   659
	 * reduce the eof.
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   660
	 */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   661
	if (orig_eof < zp->z_phys->zp_size) /* file length grew ? */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   662
		zp->z_phys->zp_size = eod;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   663
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   664
	VN_RELE(ZTOV(zp));
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   665
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   666
	return (error);
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   667
}
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   668
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   669
/*
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   670
 * TX_WRITE2 are only generated when dmu_sync() returns EALREADY
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   671
 * meaning the pool block is already being synced. So now that we always write
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   672
 * out full blocks, all we have to do is expand the eof if
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   673
 * the file is grown.
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   674
 */
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   675
static int
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   676
zfs_replay_write2(zfsvfs_t *zfsvfs, lr_write_t *lr, boolean_t byteswap)
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   677
{
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   678
	znode_t	*zp;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   679
	int error;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   680
	uint64_t end;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   681
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   682
	if (byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   683
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   684
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   685
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   686
		/*
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   687
		 * As we can log writes out of order, it's possible the
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   688
		 * file has been removed. In this case just drop the write
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   689
		 * and return success.
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   690
		 */
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   691
		if (error == ENOENT)
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   692
			error = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   693
		return (error);
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   694
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   695
10800
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   696
	end = lr->lr_offset + lr->lr_length;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   697
	if (end > zp->z_phys->zp_size) {
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   698
		ASSERT3U(end - zp->z_phys->zp_size, <, zp->z_blksz);
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   699
		zp->z_phys->zp_size = end;
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   700
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   701
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   702
	VN_RELE(ZTOV(zp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   703
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   704
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   705
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   706
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   707
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   708
zfs_replay_truncate(zfsvfs_t *zfsvfs, lr_truncate_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   709
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   710
	znode_t *zp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   711
	flock64_t fl;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   712
	int error;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   713
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   714
	if (byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   715
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   716
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   717
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   718
		/*
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   719
		 * As we can log truncates out of order, it's possible the
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   720
		 * file has been removed. In this case just drop the truncate
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   721
		 * and return success.
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   722
		 */
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   723
		if (error == ENOENT)
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   724
			error = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   725
		return (error);
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   726
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   727
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   728
	bzero(&fl, sizeof (fl));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   729
	fl.l_type = F_WRLCK;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   730
	fl.l_whence = 0;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   731
	fl.l_start = lr->lr_offset;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   732
	fl.l_len = lr->lr_length;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   733
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   734
	error = VOP_SPACE(ZTOV(zp), F_FREESP, &fl, FWRITE | FOFFMAX,
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   735
	    lr->lr_offset, kcred, NULL);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   736
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   737
	VN_RELE(ZTOV(zp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   738
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   739
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   740
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   741
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   742
static int
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   743
zfs_replay_setattr(zfsvfs_t *zfsvfs, lr_setattr_t *lr, boolean_t byteswap)
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   744
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   745
	znode_t *zp;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   746
	xvattr_t xva;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   747
	vattr_t *vap = &xva.xva_vattr;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   748
	int error;
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   749
	void *start;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   750
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   751
	xva_init(&xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   752
	if (byteswap) {
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   753
		byteswap_uint64_array(lr, sizeof (*lr));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   754
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   755
		if ((lr->lr_mask & AT_XVATTR) &&
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   756
		    zfsvfs->z_version >= ZPL_VERSION_INITIAL)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   757
			zfs_replay_swap_attrs((lr_attr_t *)(lr + 1));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   758
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   759
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   760
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   761
		/*
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   762
		 * As we can log setattrs out of order, it's possible the
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   763
		 * file has been removed. In this case just drop the setattr
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   764
		 * and return success.
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   765
		 */
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   766
		if (error == ENOENT)
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   767
			error = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   768
		return (error);
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   769
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   770
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   771
	zfs_init_vattr(vap, lr->lr_mask, lr->lr_mode,
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   772
	    lr->lr_uid, lr->lr_gid, 0, lr->lr_foid);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   773
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   774
	vap->va_size = lr->lr_size;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   775
	ZFS_TIME_DECODE(&vap->va_atime, lr->lr_atime);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   776
	ZFS_TIME_DECODE(&vap->va_mtime, lr->lr_mtime);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   777
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   778
	/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   779
	 * Fill in xvattr_t portions if necessary.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   780
	 */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   781
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   782
	start = (lr_setattr_t *)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   783
	if (vap->va_mask & AT_XVATTR) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   784
		zfs_replay_xvattr((lr_attr_t *)start, &xva);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   785
		start = (caddr_t)start +
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   786
		    ZIL_XVAT_SIZE(((lr_attr_t *)start)->lr_attr_masksize);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   787
	} else
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   788
		xva.xva_vattr.va_mask &= ~AT_XVATTR;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   789
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   790
	zfsvfs->z_fuid_replay = zfs_replay_fuid_domain(start, &start,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   791
	    lr->lr_uid, lr->lr_gid);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   792
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   793
	error = VOP_SETATTR(ZTOV(zp), vap, 0, kcred, NULL);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   794
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   795
	zfs_fuid_info_free(zfsvfs->z_fuid_replay);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   796
	zfsvfs->z_fuid_replay = NULL;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   797
	VN_RELE(ZTOV(zp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   798
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   799
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   800
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   801
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   802
static int
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   803
zfs_replay_acl_v0(zfsvfs_t *zfsvfs, lr_acl_v0_t *lr, boolean_t byteswap)
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   804
{
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   805
	ace_t *ace = (ace_t *)(lr + 1);	/* ace array follows lr_acl_t */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   806
	vsecattr_t vsa;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   807
	znode_t *zp;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   808
	int error;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   809
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   810
	if (byteswap) {
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   811
		byteswap_uint64_array(lr, sizeof (*lr));
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   812
		zfs_oldace_byteswap(ace, lr->lr_aclcnt);
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   813
	}
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   814
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   815
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   816
		/*
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   817
		 * As we can log acls out of order, it's possible the
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   818
		 * file has been removed. In this case just drop the acl
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   819
		 * and return success.
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   820
		 */
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   821
		if (error == ENOENT)
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   822
			error = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   823
		return (error);
2638
4f583dfeae92 6413510 zfs: writing to ZFS filesystem slows down fsync() on other files in the same FS
perrin
parents: 1816
diff changeset
   824
	}
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   825
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   826
	bzero(&vsa, sizeof (vsa));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   827
	vsa.vsa_mask = VSA_ACE | VSA_ACECNT;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   828
	vsa.vsa_aclcnt = lr->lr_aclcnt;
6514
852c82a1989c 6689561 zfs_replay_acl_v0() doesn't completely initialize vsecattr
marks
parents: 5833
diff changeset
   829
	vsa.vsa_aclentsz = sizeof (ace_t) * vsa.vsa_aclcnt;
852c82a1989c 6689561 zfs_replay_acl_v0() doesn't completely initialize vsecattr
marks
parents: 5833
diff changeset
   830
	vsa.vsa_aclflags = 0;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   831
	vsa.vsa_aclentp = ace;
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   832
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   833
	error = VOP_SETSECATTR(ZTOV(zp), &vsa, 0, kcred, NULL);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   834
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   835
	VN_RELE(ZTOV(zp));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   836
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   837
	return (error);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   838
}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   839
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   840
/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   841
 * Replaying ACLs is complicated by FUID support.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   842
 * The log record may contain some optional data
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   843
 * to be used for replaying FUID's.  These pieces
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   844
 * are the actual FUIDs that were created initially.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   845
 * The FUID table index may no longer be valid and
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   846
 * during zfs_create() a new index may be assigned.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   847
 * Because of this the log will contain the original
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   848
 * doman+rid in order to create a new FUID.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   849
 *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   850
 * The individual ACEs may contain an ephemeral uid/gid which is no
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   851
 * longer valid and will need to be replaced with an actual FUID.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   852
 *
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   853
 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   854
static int
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   855
zfs_replay_acl(zfsvfs_t *zfsvfs, lr_acl_t *lr, boolean_t byteswap)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   856
{
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   857
	ace_t *ace = (ace_t *)(lr + 1);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   858
	vsecattr_t vsa;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   859
	znode_t *zp;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   860
	int error;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   861
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   862
	if (byteswap) {
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   863
		byteswap_uint64_array(lr, sizeof (*lr));
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   864
		zfs_ace_byteswap(ace, lr->lr_acl_bytes, B_FALSE);
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   865
		if (lr->lr_fuidcnt) {
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   866
			byteswap_uint64_array((caddr_t)ace +
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   867
			    ZIL_ACE_LENGTH(lr->lr_acl_bytes),
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   868
			    lr->lr_fuidcnt * sizeof (uint64_t));
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   869
		}
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   870
	}
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   871
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   872
	if ((error = zfs_zget(zfsvfs, lr->lr_foid, &zp)) != 0) {
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   873
		/*
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   874
		 * As we can log acls out of order, it's possible the
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   875
		 * file has been removed. In this case just drop the acl
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   876
		 * and return success.
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   877
		 */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   878
		if (error == ENOENT)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   879
			error = 0;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   880
		return (error);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   881
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   882
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   883
	bzero(&vsa, sizeof (vsa));
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   884
	vsa.vsa_mask = VSA_ACE | VSA_ACECNT | VSA_ACE_ACLFLAGS;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   885
	vsa.vsa_aclcnt = lr->lr_aclcnt;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   886
	vsa.vsa_aclentp = ace;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   887
	vsa.vsa_aclentsz = lr->lr_acl_bytes;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   888
	vsa.vsa_aclflags = lr->lr_acl_flags;
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   889
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   890
	if (lr->lr_fuidcnt) {
5435
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   891
		void *fuidstart = (caddr_t)ace +
1be0be66916d 6624956 zfs_log_fuid_ids can cause panic on sparc
marks
parents: 5331
diff changeset
   892
		    ZIL_ACE_LENGTH(lr->lr_acl_bytes);
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   893
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   894
		zfsvfs->z_fuid_replay =
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   895
		    zfs_replay_fuids(fuidstart, &fuidstart,
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   896
		    lr->lr_fuidcnt, lr->lr_domcnt, 0, 0);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   897
	}
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   898
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   899
	error = VOP_SETSECATTR(ZTOV(zp), &vsa, 0, kcred, NULL);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   900
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   901
	if (zfsvfs->z_fuid_replay)
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   902
		zfs_fuid_info_free(zfsvfs->z_fuid_replay);
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   903
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   904
	zfsvfs->z_fuid_replay = NULL;
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   905
	VN_RELE(ZTOV(zp));
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   906
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   907
	return (error);
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   908
}
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   909
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   910
/*
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   911
 * Callback vectors for replaying records
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   912
 */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   913
zil_replay_func_t *zfs_replay_vector[TX_MAX_TYPE] = {
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   914
	zfs_replay_error,	/* 0 no such transaction type */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   915
	zfs_replay_create,	/* TX_CREATE */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   916
	zfs_replay_create,	/* TX_MKDIR */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   917
	zfs_replay_create,	/* TX_MKXATTR */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   918
	zfs_replay_create,	/* TX_SYMLINK */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   919
	zfs_replay_remove,	/* TX_REMOVE */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   920
	zfs_replay_remove,	/* TX_RMDIR */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   921
	zfs_replay_link,	/* TX_LINK */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   922
	zfs_replay_rename,	/* TX_RENAME */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   923
	zfs_replay_write,	/* TX_WRITE */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   924
	zfs_replay_truncate,	/* TX_TRUNCATE */
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   925
	zfs_replay_setattr,	/* TX_SETATTR */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   926
	zfs_replay_acl_v0,	/* TX_ACL_V0 */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   927
	zfs_replay_acl,		/* TX_ACL */
5331
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   928
	zfs_replay_create_acl,	/* TX_CREATE_ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   929
	zfs_replay_create,	/* TX_CREATE_ATTR */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   930
	zfs_replay_create_acl,	/* TX_CREATE_ACL_ATTR */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   931
	zfs_replay_create_acl,	/* TX_MKDIR_ACL */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   932
	zfs_replay_create,	/* TX_MKDIR_ATTR */
3047ad28a67b PSARC/2007/218 caller_context_t in all VOPs
amw
parents: 4480
diff changeset
   933
	zfs_replay_create_acl,	/* TX_MKDIR_ACL_ATTR */
10800
469478b180d9 6880764 fsync on zfs is broken if writes are greater than 32kb on a hard crash and no log attached
Neil Perrin <Neil.Perrin@Sun.COM>
parents: 10793
diff changeset
   934
	zfs_replay_write2,	/* TX_WRITE2 */
789
b348f31ed315 PSARC 2002/240 ZFS
ahrens
parents:
diff changeset
   935
};