* [PATCH] xfs: make quota metadata truncation behavior consistent to user space
@ 2013-11-22 6:04 Jeff Liu
2013-11-22 9:18 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2013-11-22 6:04 UTC (permalink / raw)
To: xfs@oss.sgi.com
From: Jie Liu <jeff.liu@oracle.com>
In xfs_qm_scall_trunc_qfiles(), we ignore the error if failed to remove
the users quota metadata and proceed to remove groups and projects if
they are being there. However, in user space, the remove operation will
break and return if failed to remove any kind of quota.
Also for v5 super block, we can enabled both group and project quota at
the same time, in this case the current error handling will cover the
group error with projects but they might failed due to different reasons.
It seems we'd better the error handling consistent to the user space and
don't trying to remove another kind of quota metadata if the previous
operation is failed.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_qm_syscalls.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 437c919..3daf5ea 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -278,7 +278,7 @@ xfs_qm_scall_trunc_qfiles(
xfs_mount_t *mp,
uint flags)
{
- int error = 0, error2 = 0;
+ int error;
if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
xfs_debug(mp, "%s: flags=%x m_qflags=%x",
@@ -286,14 +286,20 @@ xfs_qm_scall_trunc_qfiles(
return XFS_ERROR(EINVAL);
}
- if (flags & XFS_DQ_USER)
+ if (flags & XFS_DQ_USER) {
error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_uquotino);
- if (flags & XFS_DQ_GROUP)
- error2 = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_gquotino);
+ if (error)
+ return error;
+ }
+ if (flags & XFS_DQ_GROUP) {
+ error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_gquotino);
+ if (error)
+ return error;
+ }
if (flags & XFS_DQ_PROJ)
- error2 = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_pquotino);
+ error = xfs_qm_scall_trunc_qfile(mp, mp->m_sb.sb_pquotino);
- return error ? error : error2;
+ return error;
}
/*
--
1.8.3.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xfs: make quota metadata truncation behavior consistent to user space
2013-11-22 6:04 [PATCH] xfs: make quota metadata truncation behavior consistent to user space Jeff Liu
@ 2013-11-22 9:18 ` Christoph Hellwig
2013-11-22 9:56 ` Jeff Liu
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2013-11-22 9:18 UTC (permalink / raw)
To: Jeff Liu; +Cc: xfs@oss.sgi.com
On Fri, Nov 22, 2013 at 02:04:00PM +0800, Jeff Liu wrote:
> From: Jie Liu <jeff.liu@oracle.com>
>
> In xfs_qm_scall_trunc_qfiles(), we ignore the error if failed to remove
> the users quota metadata and proceed to remove groups and projects if
> they are being there. However, in user space, the remove operation will
> break and return if failed to remove any kind of quota.
> Also for v5 super block, we can enabled both group and project quota at
> the same time, in this case the current error handling will cover the
> group error with projects but they might failed due to different reasons.
>
> It seems we'd better the error handling consistent to the user space and
> don't trying to remove another kind of quota metadata if the previous
> operation is failed.
Looks good. Just curious, did you manage to reproduce an error
truncating the quota files?
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: make quota metadata truncation behavior consistent to user space
2013-11-22 9:18 ` Christoph Hellwig
@ 2013-11-22 9:56 ` Jeff Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2013-11-22 9:56 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs@oss.sgi.com
On 11/22 2013 17:18, Christoph Hellwig wrote:
> On Fri, Nov 22, 2013 at 02:04:00PM +0800, Jeff Liu wrote:
>> From: Jie Liu <jeff.liu@oracle.com>
>>
>> In xfs_qm_scall_trunc_qfiles(), we ignore the error if failed to remove
>> the users quota metadata and proceed to remove groups and projects if
>> they are being there. However, in user space, the remove operation will
>> break and return if failed to remove any kind of quota.
>> Also for v5 super block, we can enabled both group and project quota at
>> the same time, in this case the current error handling will cover the
>> group error with projects but they might failed due to different reasons.
>>
>> It seems we'd better the error handling consistent to the user space and
>> don't trying to remove another kind of quota metadata if the previous
>> operation is failed.
>
> Looks good. Just curious, did you manage to reproduce an error
> truncating the quota files?
Yup, I thought it over how to break it while occasionally glanced over this
function for backporting upstream patches this morning, but can not figure
out a simple method.
Thanks,
-Jeff
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-22 9:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22 6:04 [PATCH] xfs: make quota metadata truncation behavior consistent to user space Jeff Liu
2013-11-22 9:18 ` Christoph Hellwig
2013-11-22 9:56 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox