aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_ctldir.c
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2017-08-02 21:16:12 -0700
committerBrian Behlendorf <[email protected]>2017-08-02 21:16:12 -0700
commitecb2b7dc7f8f7273c215fb30c984bde08e75b852 (patch)
tree55e26ef1e29163fba495ba517d8133d475169651 /module/zfs/zfs_ctldir.c
parent6710381680b0f551c37627e3a5a4886ccf99983f (diff)
Use SET_ERROR for constant non-zero return codes
Update many return and assignment statements to follow the convention of using the SET_ERROR macro when returning a hard-coded non-zero value from a function. This aids debugging by recording the error codes in the debug log. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Ned Bass <[email protected]> Closes #6441
Diffstat (limited to 'module/zfs/zfs_ctldir.c')
-rw-r--r--module/zfs/zfs_ctldir.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/module/zfs/zfs_ctldir.c b/module/zfs/zfs_ctldir.c
index 3b5fb196f..2b7272d4f 100644
--- a/module/zfs/zfs_ctldir.c
+++ b/module/zfs/zfs_ctldir.c
@@ -308,7 +308,7 @@ zfsctl_snapshot_rename(char *old_snapname, char *new_snapname)
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);
@@ -751,7 +751,7 @@ zfsctl_snapshot_path_objset(zfsvfs_t *zfsvfs, uint64_t objsetid,
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);
@@ -856,7 +856,7 @@ zfsctl_snapdir_rename(struct inode *sdip, char *snm,
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
ZFS_ENTER(zfsvfs);
@@ -933,7 +933,7 @@ zfsctl_snapdir_remove(struct inode *dip, char *name, cred_t *cr, int flags)
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
ZFS_ENTER(zfsvfs);
@@ -982,7 +982,7 @@ zfsctl_snapdir_mkdir(struct inode *dip, char *dirname, vattr_t *vap,
int error;
if (!zfs_admin_snapshot)
- return (EACCES);
+ return (SET_ERROR(EACCES));
dsname = kmem_alloc(ZFS_MAX_DATASET_NAME_LEN, KM_SLEEP);
@@ -1029,7 +1029,7 @@ zfsctl_snapshot_unmount(char *snapname, int flags)
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);
@@ -1070,7 +1070,7 @@ zfsctl_snapshot_mount(struct path *path, int flags)
struct path spath;
if (ip == NULL)
- return (EISDIR);
+ return (SET_ERROR(EISDIR));
zfsvfs = ITOZSB(ip);
ZFS_ENTER(zfsvfs);