arc_stats_t *as = ksp->ks_data;
if (rw == KSTAT_WRITE) {
- return (EACCES);
+ return (SET_ERROR(EACCES));
} else {
arc_kstat_update_state(arc_anon,
&as->arcstat_anon_size,
psize = BPE_GET_PSIZE(bp);
if (lsize > buflen)
- return (ENOSPC);
+ return (SET_ERROR(ENOSPC));
ASSERT3U(lsize, ==, buflen);
if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF) {
* to be called with a larger scratch buffers.
*/
if (size < 512) {
- error = ENOMEM;
+ error = SET_ERROR(ENOMEM);
break;
}
if (dsp->dsa_pending_op != PENDING_NONE) {
if (dump_record(dsp, NULL, 0) != 0)
- return (EINTR);
+ return (SET_ERROR(EINTR));
dsp->dsa_pending_op = PENDING_NONE;
}
decode_embedded_bp_compressed(bp, buf);
if (dump_record(dsp, buf, P2ROUNDUP(drrw->drr_psize, 8)) != 0)
- return (EINTR);
+ return (SET_ERROR(EINTR));
return (0);
}
int err;
if (drrwe->drr_offset + drrwe->drr_length < drrwe->drr_offset)
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
if (drrwe->drr_psize > BPE_PAYLOAD_SIZE)
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
if (drrwe->drr_etype >= NUM_BP_EMBEDDED_TYPES)
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
if (drrwe->drr_compression >= ZIO_COMPRESS_FUNCTIONS)
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
tx = dmu_tx_create(rwa->os);
dsl_pool_need_dirty_delay(tx->tx_pool)) {
tx->tx_wait_dirty = B_TRUE;
DMU_TX_STAT_BUMP(dmu_tx_dirty_delay);
- return (ERESTART);
+ return (SET_ERROR(ERESTART));
}
tx->tx_txg = txg_hold_open(tx->tx_pool, &tx->tx_txgh);
if ((flag & DNODE_MUST_BE_FREE) && !dnode_is_free(db, idx, slots)) {
dbuf_rele(db, FTAG);
- return (ENOSPC);
+ return (SET_ERROR(ENOSPC));
} else if ((flag & DNODE_MUST_BE_ALLOCATED) &&
!dnode_is_allocated(db, idx)) {
dbuf_rele(db, FTAG);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
dnh = &children_dnodes->dnc_children[idx];
mutex_exit(&dn->dn_mtx);
zrl_remove(&dnh->dnh_zrlock);
dbuf_rele(db, FTAG);
- return (type == DMU_OT_NONE ? ENOENT : EEXIST);
+ return (SET_ERROR(type == DMU_OT_NONE ? ENOENT : EEXIST));
}
if (refcount_add(&dn->dn_holds, tag) == 1)
dbuf_add_ref(db, dnh);
SPA_VERSION_STMF_PROP ?
ZAP_OLDMAXVALUELEN : ZAP_MAXVALUELEN)) {
dsl_dataset_rele(ds, FTAG);
- return (E2BIG);
+ return (SET_ERROR(E2BIG));
}
}
}
scn->scn_async_destroying) {
spa->spa_errata =
ZPOOL_ERRATA_ZOL_2094_ASYNC_DESTROY;
- return (EOVERFLOW);
+ return (SET_ERROR(EOVERFLOW));
}
bcopy(zaptmp, &scn->scn_phys,
int err = dsl_scrub_set_pause_resume(scn->scn_dp,
POOL_SCRUB_NORMAL);
if (err == 0)
- return (ECANCELED);
+ return (SET_ERROR(ECANCELED));
return (SET_ERROR(err));
}
{
*ze = zfsdev_get_state(minor, ZST_ZEVENT);
if (*ze == NULL)
- return (EBADF);
+ return (SET_ERROR(EBADF));
return (0);
}
fp = getf(fd);
if (fp == NULL)
- return (EBADF);
+ return (SET_ERROR(EBADF));
error = zfsdev_getminor(fp->f_file, minorp);
if (error == 0)
retry:
dr = vdev_disk_dio_alloc(bio_count);
if (dr == NULL)
- return (ENOMEM);
+ return (SET_ERROR(ENOMEM));
if (zio && !(zio->io_flags & (ZIO_FLAG_IO_RETRY | ZIO_FLAG_TRYHARD)))
bio_set_flags_failfast(bdev, &flags);
BIO_MAX_PAGES));
if (unlikely(dr->dr_bio[i] == NULL)) {
vdev_disk_dio_free(dr);
- return (ENOMEM);
+ return (SET_ERROR(ENOMEM));
}
/* Matching put called by vdev_disk_physio_completion */
q = bdev_get_queue(bdev);
if (!q)
- return (ENXIO);
+ return (SET_ERROR(ENXIO));
bio = bio_alloc(GFP_NOIO, 0);
/* bio_alloc() with __GFP_WAIT never returns NULL */
if (unlikely(bio == NULL))
- return (ENOMEM);
+ return (SET_ERROR(ENOMEM));
bio->bi_end_io = vdev_disk_io_flush_completion;
bio->bi_private = zio;
nvlist_free(label);
abd_free(vp_abd);
/* EFAULT means nvlist_pack ran out of room */
- return (error == EFAULT ? ENAMETOOLONG : EINVAL);
+ return (SET_ERROR(error == EFAULT ? ENAMETOOLONG : EINVAL));
}
/*
* already be freed, so this should be perfectly fine.
*/
if (blkid == 0)
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
dn = dmu_buf_dnode_enter(zap->zap_dbuf);
err = dmu_buf_hold_by_dnode(dn,
}
if (integer_size * num_integers > ZAP_MAXVALUELEN)
- return (E2BIG);
+ return (SET_ERROR(E2BIG));
return (0);
}
numchunks = 1 + ZAP_LEAF_ARRAY_NCHUNKS(zn->zn_key_orig_numints *
zn->zn_key_intlen) + ZAP_LEAF_ARRAY_NCHUNKS(valuelen);
if (numchunks > ZAP_LEAF_NUMCHUNKS(l))
- return (E2BIG);
+ return (SET_ERROR(E2BIG));
if (cd == ZAP_NEED_CD) {
/* find the lowest unused cd */
se = zfsctl_snapshot_find_by_name(old_snapname);
if (se == NULL)
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
zfsctl_snapshot_remove(se);
strfree(se->se_name);
int error = 0;
if (zfsvfs->z_vfs->vfs_mntpoint == NULL)
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
cookie = spl_fstrans_mark();
snapname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP);
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
ZFS_ENTER(zfsvfs);
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
ZFS_ENTER(zfsvfs);
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
dsname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP);
rw_enter(&zfs_snapshot_lock, RW_READER);
if ((se = zfsctl_snapshot_find_by_name(snapname)) == NULL) {
rw_exit(&zfs_snapshot_lock);
- return (ENOENT);
+ return (SET_ERROR(ENOENT));
}
rw_exit(&zfs_snapshot_lock);
struct path spath;
if (ip == NULL)
- return (EISDIR);
+ return (SET_ERROR(EISDIR));
zfsvfs = ITOZSB(ip);
ZFS_ENTER(zfsvfs);
return (PRIV_POLICY(cr, needed_priv, B_FALSE, EPERM, NULL));
return (0);
#else
- return (ENOTSUP);
+ return (SET_ERROR(ENOTSUP));
#endif /* HAVE_MLSLABEL */
}
if (err == 0)
err = dsl_destroy_head(zc->zc_name);
else if (err == ENOENT)
- err = EEXIST;
+ err = SET_ERROR(EEXIST);
}
}
fpd = filp->private_data;
if (fpd == NULL)
- return (EBADF);
+ return (SET_ERROR(EBADF));
mutex_enter(&zfsdev_state_lock);
mutex_exit(&zfsdev_state_lock);
- return (EBADF);
+ return (SET_ERROR(EBADF));
}
/*
error = nvlist_size(zp->z_xattr_cached, &size, NV_ENCODE_XDR);
if ((error == 0) && (size > SA_ATTR_MAX_LEN))
- error = EFBIG;
+ error = SET_ERROR(EFBIG);
if (error)
goto out;
if ((zp->z_pflags & ZFS_IMMUTABLE) &&
((mask & (ATTR_SIZE|ATTR_UID|ATTR_GID|ATTR_MTIME|ATTR_MODE)) ||
((mask & ATTR_XVATTR) && XVA_ISSET_REQ(xvap, XAT_CREATETIME)))) {
- err = EPERM;
+ err = SET_ERROR(EPERM);
goto out3;
}
if ((mask & ATTR_SIZE) && (zp->z_pflags & ZFS_READONLY)) {
- err = EPERM;
+ err = SET_ERROR(EPERM);
goto out3;
}
TIMESPEC_OVERFLOW(&vap->va_atime)) ||
((mask & ATTR_MTIME) &&
TIMESPEC_OVERFLOW(&vap->va_mtime))) {
- err = EOVERFLOW;
+ err = SET_ERROR(EOVERFLOW);
goto out3;
}
}
/* Can this be moved to before the top label? */
if (zfs_is_readonly(zfsvfs)) {
- err = EROFS;
+ err = SET_ERROR(EROFS);
goto out3;
}
if (XVA_ISSET_REQ(xvap, XAT_REPARSE)) {
mutex_exit(&zp->z_lock);
- err = EPERM;
+ err = SET_ERROR(EPERM);
goto out3;
}
zfs_fuid_overquota(zfsvfs, B_FALSE, new_kuid)) {
if (attrzp)
iput(ZTOI(attrzp));
- err = EDQUOT;
+ err = SET_ERROR(EDQUOT);
goto out2;
}
}
zfs_fuid_overquota(zfsvfs, B_TRUE, new_kgid)) {
if (attrzp)
iput(ZTOI(attrzp));
- err = EDQUOT;
+ err = SET_ERROR(EDQUOT);
goto out2;
}
}
* Otherwise the parent must be a directory.
*/
if (!*is_xattrdir && !S_ISDIR(parent_mode))
- return (EINVAL);
+ return (SET_ERROR(EINVAL));
*pobjp = parent;