diff options
author | David Chinner <dgc@sgi.com> | 2008-04-09 22:20:51 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-04-17 21:57:36 -0400 |
commit | 88ab02085363b7c45935d66ab3e969b4fec9a20c (patch) | |
tree | 933391b62fb0712c87feb182ded9219079f46167 /fs/xfs/quota | |
parent | cb6edc26c386d2268dcf61bcdec02b6fb50b6ba2 (diff) |
[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: David Chinner <dgc@sgi.com>
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/quota')
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 15 |
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 | ||