static int zfs_replay_link(zfsvfs_t *zfsvfs, lr_link_t *lr, boolean_t byteswap) { char *name = (char *)(lr + 1); /* name follows lr_link_t */ znode_t *dzp, *zp; int error; int vflg = 0; if (byteswap) byteswap_uint64_array(lr, sizeof (*lr)); if ((error = zfs_zget(zfsvfs, lr->lr_doid, &dzp)) != 0) return (error); if ((error = zfs_zget(zfsvfs, lr->lr_link_obj, &zp)) != 0) { iput(ZTOI(dzp)); return (error); } if (lr->lr_common.lrc_txtype & TX_CI) vflg |= FIGNORECASE; error = zfs_link(ZTOI(dzp), ZTOI(zp), name, kcred, vflg); iput(ZTOI(zp)); iput(ZTOI(dzp)); return (error); }
static int zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { cred_t *cr = CRED(); struct inode *ip = old_dentry->d_inode; int error; if (ip->i_nlink >= ZFS_LINK_MAX) return -EMLINK; crhold(cr); ip->i_ctime = CURRENT_TIME_SEC; igrab(ip); /* Use ihold() if available */ error = -zfs_link(dir, ip, dname(dentry), cr); if (error) { iput(ip); goto out; } d_instantiate(dentry, ip); out: crfree(cr); ASSERT3S(error, <=, 0); return (error); }
static int zpl_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { cred_t *cr = CRED(); struct inode *ip = old_dentry->d_inode; int error; fstrans_cookie_t cookie; if (ip->i_nlink >= ZFS_LINK_MAX) return (-EMLINK); crhold(cr); ip->i_ctime = CURRENT_TIME_SEC; igrab(ip); /* Use ihold() if available */ cookie = spl_fstrans_mark(); error = -zfs_link(dir, ip, dname(dentry), cr); if (error) { VN_RELE(ip); goto out; } d_instantiate(dentry, ip); out: spl_fstrans_unmark(cookie); crfree(cr); ASSERT3S(error, <=, 0); return (error); }