Commit 88ab0208 authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy

[XFS] Propagate quota file truncation errors.

Truncating the quota files can silently fail. Ensure that truncation
errors are propagated to the callers.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30791a
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarNiv Sardi <xaiki@sgi.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent cb6edc26
...@@ -380,12 +380,11 @@ xfs_qm_scall_trunc_qfiles( ...@@ -380,12 +380,11 @@ xfs_qm_scall_trunc_qfiles(
xfs_mount_t *mp, xfs_mount_t *mp,
uint flags) uint flags)
{ {
int error; int error = 0, error2 = 0;
xfs_inode_t *qip; xfs_inode_t *qip;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return XFS_ERROR(EPERM); return XFS_ERROR(EPERM);
error = 0;
if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) { if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags); qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
...@@ -393,22 +392,22 @@ xfs_qm_scall_trunc_qfiles( ...@@ -393,22 +392,22 @@ xfs_qm_scall_trunc_qfiles(
if ((flags & XFS_DQ_USER) && mp->m_sb.sb_uquotino != NULLFSINO) { if ((flags & XFS_DQ_USER) && mp->m_sb.sb_uquotino != NULLFSINO) {
error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip, 0); error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip, 0);
if (! error) { if (!error) {
(void) xfs_truncate_file(mp, qip); error = xfs_truncate_file(mp, qip);
IRELE(qip); IRELE(qip);
} }
} }
if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) && if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) &&
mp->m_sb.sb_gquotino != NULLFSINO) { mp->m_sb.sb_gquotino != NULLFSINO) {
error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0); error2 = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0);
if (! error) { if (!error2) {
(void) xfs_truncate_file(mp, qip); error2 = xfs_truncate_file(mp, qip);
IRELE(qip); IRELE(qip);
} }
} }
return (error); return error ? error : error2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment