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 <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #6441
This commit is contained in:
Ned Bass
2017-08-02 21:16:12 -07:00
committed by Brian Behlendorf
parent 6710381680
commit ecb2b7dc7f
18 changed files with 46 additions and 46 deletions
+7 -7
View File
@@ -2735,12 +2735,12 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
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;
}
@@ -2755,7 +2755,7 @@ zfs_setattr(struct inode *ip, vattr_t *vap, int flags, cred_t *cr)
TIMESPEC_OVERFLOW(&vap->va_atime)) ||
((mask & ATTR_MTIME) &&
TIMESPEC_OVERFLOW(&vap->va_mtime))) {
err = EOVERFLOW;
err = SET_ERROR(EOVERFLOW);
goto out3;
}
}
@@ -2766,7 +2766,7 @@ top:
/* Can this be moved to before the top label? */
if (zfs_is_readonly(zfsvfs)) {
err = EROFS;
err = SET_ERROR(EROFS);
goto out3;
}
@@ -2927,7 +2927,7 @@ top:
if (XVA_ISSET_REQ(xvap, XAT_REPARSE)) {
mutex_exit(&zp->z_lock);
err = EPERM;
err = SET_ERROR(EPERM);
goto out3;
}
@@ -2997,7 +2997,7 @@ top:
zfs_fuid_overquota(zfsvfs, B_FALSE, new_kuid)) {
if (attrzp)
iput(ZTOI(attrzp));
err = EDQUOT;
err = SET_ERROR(EDQUOT);
goto out2;
}
}
@@ -3009,7 +3009,7 @@ top:
zfs_fuid_overquota(zfsvfs, B_TRUE, new_kgid)) {
if (attrzp)
iput(ZTOI(attrzp));
err = EDQUOT;
err = SET_ERROR(EDQUOT);
goto out2;
}
}