*/
static znode_t *
zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz,
- dmu_object_type_t obj_type, uint64_t obj, sa_handle_t *hdl)
+ dmu_object_type_t obj_type, uint64_t obj, sa_handle_t *hdl,
+ struct dentry *dentry)
{
znode_t *zp;
struct inode *ip;
if (insert_inode_locked(ip))
goto error;
+ if (dentry)
+ d_instantiate(dentry, ip);
+
mutex_enter(&zsb->z_znodes_lock);
list_insert_tail(&zsb->z_all_znodes, zp);
membar_producer();
VERIFY(sa_replace_all_by_template(sa_hdl, sa_attrs, cnt, tx) == 0);
if (!(flag & IS_ROOT_NODE)) {
- *zpp = zfs_znode_alloc(zsb, db, 0, obj_type, obj, sa_hdl);
+ *zpp = zfs_znode_alloc(zsb, db, 0, obj_type, obj, sa_hdl,
+ vap->va_dentry);
ASSERT(*zpp != NULL);
ASSERT(dzp != NULL);
err = zpl_xattr_security_init(ZTOI(*zpp), ZTOI(dzp));
* bonus buffer.
*/
zp = zfs_znode_alloc(zsb, db, doi.doi_data_block_size,
- doi.doi_bonus_type, obj_num, NULL);
+ doi.doi_bonus_type, obj_num, NULL, NULL);
if (zp == NULL) {
err = ENOENT;
} else {
vap->va_mask = ATTR_MODE;
vap->va_uid = crgetfsuid(cr);
vap->va_gid = crgetfsgid(cr);
+ vap->va_dentry = dentry;
error = -zfs_create(dir, (char *)dentry->d_name.name,
vap, 0, mode, &ip, cr, 0, NULL);
- if (error)
- goto out;
-
- d_instantiate(dentry, ip);
-out:
kmem_free(vap, sizeof(vattr_t));
crfree(cr);
ASSERT3S(error, <=, 0);
vap->va_rdev = rdev;
vap->va_uid = crgetfsuid(cr);
vap->va_gid = crgetfsgid(cr);
+ vap->va_dentry = dentry;
error = -zfs_create(dir, (char *)dentry->d_name.name,
vap, 0, mode, &ip, cr, 0, NULL);
- if (error)
- goto out;
-
- d_instantiate(dentry, ip);
-out:
kmem_free(vap, sizeof(vattr_t));
crfree(cr);
ASSERT3S(error, <=, 0);
vap->va_mask = ATTR_MODE;
vap->va_uid = crgetfsuid(cr);
vap->va_gid = crgetfsgid(cr);
+ vap->va_dentry = dentry;
error = -zfs_mkdir(dir, dname(dentry), vap, &ip, cr, 0, NULL);
- if (error)
- goto out;
-
- d_instantiate(dentry, ip);
-out:
kmem_free(vap, sizeof(vattr_t));
crfree(cr);
ASSERT3S(error, <=, 0);
vap->va_mask = ATTR_MODE;
vap->va_uid = crgetfsuid(cr);
vap->va_gid = crgetfsgid(cr);
+ vap->va_dentry = dentry;
error = -zfs_symlink(dir, dname(dentry), vap, (char *)name, &ip, cr, 0);
- if (error)
- goto out;
-
- d_instantiate(dentry, ip);
-out:
kmem_free(vap, sizeof(vattr_t));
crfree(cr);
ASSERT3S(error, <=, 0);