diff options
author | Brian Behlendorf <[email protected]> | 2011-03-29 23:04:39 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-04-07 09:51:57 -0700 |
commit | c85b224fafacafa49817101f26f0a9760a8d05d1 (patch) | |
tree | 4e08918675d6590cd332e51162c9ecccb9794091 /module/zfs/zfs_znode.c | |
parent | d433c206515e567c52ce09589033405a0ae3716e (diff) |
Call d_instantiate before unlocking inode
Under Linux a dentry referencing an inode must be instantiated before
the inode is unlocked. To accomplish this without overly modifing
the core ZFS code the dentry it passed via the vattr_t. There are
cases such as replay when a dentry is not available. In which case
it is obviously not initialized at inode creation time, if a dentry
is needed it will be spliced as when required via d_lookup().
Diffstat (limited to 'module/zfs/zfs_znode.c')
-rw-r--r-- | module/zfs/zfs_znode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index 1fe88499b..f9ea2a0eb 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -322,7 +322,8 @@ zfs_inode_set_ops(zfs_sb_t *zsb, struct inode *ip) */ 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; @@ -379,6 +380,9 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz, 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(); @@ -675,7 +679,8 @@ zfs_mknode(znode_t *dzp, vattr_t *vap, dmu_tx_t *tx, cred_t *cr, 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)); @@ -866,7 +871,7 @@ zfs_zget(zfs_sb_t *zsb, uint64_t obj_num, znode_t **zpp) * 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 { |