aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index 61cf68df547e..556018d24cad 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -380,12 +380,11 @@ xfs_qm_scall_trunc_qfiles(
380 xfs_mount_t *mp, 380 xfs_mount_t *mp,
381 uint flags) 381 uint flags)
382{ 382{
383 int error; 383 int error = 0, error2 = 0;
384 xfs_inode_t *qip; 384 xfs_inode_t *qip;
385 385
386 if (!capable(CAP_SYS_ADMIN)) 386 if (!capable(CAP_SYS_ADMIN))
387 return XFS_ERROR(EPERM); 387 return XFS_ERROR(EPERM);
388 error = 0;
389 if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) { 388 if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
390 qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags); 389 qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
391 return XFS_ERROR(EINVAL); 390 return XFS_ERROR(EINVAL);
@@ -393,22 +392,22 @@ xfs_qm_scall_trunc_qfiles(
393 392
394 if ((flags & XFS_DQ_USER) && mp->m_sb.sb_uquotino != NULLFSINO) { 393 if ((flags & XFS_DQ_USER) && mp->m_sb.sb_uquotino != NULLFSINO) {
395 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip, 0); 394 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 0, 0, &qip, 0);
396 if (! error) { 395 if (!error) {
397 (void) xfs_truncate_file(mp, qip); 396 error = xfs_truncate_file(mp, qip);
398 IRELE(qip); 397 IRELE(qip);
399 } 398 }
400 } 399 }
401 400
402 if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) && 401 if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) &&
403 mp->m_sb.sb_gquotino != NULLFSINO) { 402 mp->m_sb.sb_gquotino != NULLFSINO) {
404 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0); 403 error2 = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0);
405 if (! error) { 404 if (!error2) {
406 (void) xfs_truncate_file(mp, qip); 405 error2 = xfs_truncate_file(mp, qip);
407 IRELE(qip); 406 IRELE(qip);
408 } 407 }
409 } 408 }
410 409
411 return (error); 410 return error ? error : error2;
412} 411}
413 412
414 413