* [PATCH] xfs: Remove redundant return error from xfs_difree()
@ 2012-10-25 4:28 Jeff Liu
2012-11-02 21:05 ` Ben Myers
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2012-10-25 4:28 UTC (permalink / raw)
To: xfs
If we can not fetch the related a.g. info when freeing a disk inode, it mostly like a
fatal issue was occurred and with ASSERT(0) is fine, however, return XFS_ERROR(EINVAL)
does not make sense here.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
fs/xfs/xfs_ialloc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index 445bf1a..b7ea965 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -1065,7 +1065,6 @@ xfs_difree(
xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
__func__, agno, mp->m_sb.sb_agcount);
ASSERT(0);
- return XFS_ERROR(EINVAL);
}
agino = XFS_INO_TO_AGINO(mp, inode);
if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) {
@@ -1073,14 +1072,12 @@ xfs_difree(
__func__, (unsigned long long)inode,
(unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
ASSERT(0);
- return XFS_ERROR(EINVAL);
}
agbno = XFS_AGINO_TO_AGBNO(mp, agino);
if (agbno >= mp->m_sb.sb_agblocks) {
xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
__func__, agbno, mp->m_sb.sb_agblocks);
ASSERT(0);
- return XFS_ERROR(EINVAL);
}
/*
* Get the allocation group header.
--
1.7.4.1
_______________________________________________
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: Remove redundant return error from xfs_difree()
2012-10-25 4:28 [PATCH] xfs: Remove redundant return error from xfs_difree() Jeff Liu
@ 2012-11-02 21:05 ` Ben Myers
2012-11-03 4:28 ` Jeff Liu
0 siblings, 1 reply; 3+ messages in thread
From: Ben Myers @ 2012-11-02 21:05 UTC (permalink / raw)
To: Jeff Liu; +Cc: xfs
Hey Jeff,
On Thu, Oct 25, 2012 at 12:28:05PM +0800, Jeff Liu wrote:
> If we can not fetch the related a.g. info when freeing a disk inode, it mostly like a
> fatal issue was occurred and with ASSERT(0) is fine, however, return XFS_ERROR(EINVAL)
> does not make sense here.
>
> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>
> ---
> fs/xfs/xfs_ialloc.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
> index 445bf1a..b7ea965 100644
> --- a/fs/xfs/xfs_ialloc.c
> +++ b/fs/xfs/xfs_ialloc.c
> @@ -1065,7 +1065,6 @@ xfs_difree(
> xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
> __func__, agno, mp->m_sb.sb_agcount);
> ASSERT(0);
> - return XFS_ERROR(EINVAL);
> }
> agino = XFS_INO_TO_AGINO(mp, inode);
> if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) {
> @@ -1073,14 +1072,12 @@ xfs_difree(
> __func__, (unsigned long long)inode,
> (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
> ASSERT(0);
> - return XFS_ERROR(EINVAL);
> }
> agbno = XFS_AGINO_TO_AGBNO(mp, agino);
> if (agbno >= mp->m_sb.sb_agblocks) {
> xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
> __func__, agbno, mp->m_sb.sb_agblocks);
> ASSERT(0);
> - return XFS_ERROR(EINVAL);
> }
> /*
> * Get the allocation group header.
Here the return of EINVAL is serving a useful purpose. The ASSERT is only
activated when xfs debug is configured on, so there is a very real chance that
you might exercise this code.
My read on this is if you pass bad args to xfs_difree it will return EINVAL.
It's just a little defensive coding but it's worth keeping. In this case it
will result in forced shutdown of the filesystem, which is much better than the
[unspecified] baddness that could happen later in xfs_difree if you have passed
in garbage args.
There... I got my FUD in for the day. ;)
Thanks for the patch, but I think we need to pass on this one.
Regards,
Ben
_______________________________________________
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: Remove redundant return error from xfs_difree()
2012-11-02 21:05 ` Ben Myers
@ 2012-11-03 4:28 ` Jeff Liu
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Liu @ 2012-11-03 4:28 UTC (permalink / raw)
To: Ben Myers; +Cc: xfs
Hi Ben,
On 11/03/2012 05:05 AM, Ben Myers wrote:
> Hey Jeff,
>
> On Thu, Oct 25, 2012 at 12:28:05PM +0800, Jeff Liu wrote:
>> If we can not fetch the related a.g. info when freeing a disk inode, it mostly like a
>> fatal issue was occurred and with ASSERT(0) is fine, however, return XFS_ERROR(EINVAL)
>> does not make sense here.
>>
>> Signed-off-by: Jie Liu <jeff.liu@oracle.com>
>>
>> ---
>> fs/xfs/xfs_ialloc.c | 3 ---
>> 1 files changed, 0 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
>> index 445bf1a..b7ea965 100644
>> --- a/fs/xfs/xfs_ialloc.c
>> +++ b/fs/xfs/xfs_ialloc.c
>> @@ -1065,7 +1065,6 @@ xfs_difree(
>> xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
>> __func__, agno, mp->m_sb.sb_agcount);
>> ASSERT(0);
>> - return XFS_ERROR(EINVAL);
>> }
>> agino = XFS_INO_TO_AGINO(mp, inode);
>> if (inode != XFS_AGINO_TO_INO(mp, agno, agino)) {
>> @@ -1073,14 +1072,12 @@ xfs_difree(
>> __func__, (unsigned long long)inode,
>> (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
>> ASSERT(0);
>> - return XFS_ERROR(EINVAL);
>> }
>> agbno = XFS_AGINO_TO_AGBNO(mp, agino);
>> if (agbno >= mp->m_sb.sb_agblocks) {
>> xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
>> __func__, agbno, mp->m_sb.sb_agblocks);
>> ASSERT(0);
>> - return XFS_ERROR(EINVAL);
>> }
>> /*
>> * Get the allocation group header.
>
> Here the return of EINVAL is serving a useful purpose. The ASSERT is only
> activated when xfs debug is configured on, so there is a very real chance that
> you might exercise this code.
Ah, I haven't realized that the ASSERT in XFS is configurable..:(
>
> My read on this is if you pass bad args to xfs_difree it will return EINVAL.
> It's just a little defensive coding but it's worth keeping. In this case it
> will result in forced shutdown of the filesystem, which is much better than the
> [unspecified] baddness that could happen later in xfs_difree if you have passed
> in garbage args.
Definitely.
>
> There... I got my FUD in for the day. ;)
Sorry for my false alarm, and thanks your for your teaching!
Regards,
-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:[~2012-11-03 4:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-25 4:28 [PATCH] xfs: Remove redundant return error from xfs_difree() Jeff Liu
2012-11-02 21:05 ` Ben Myers
2012-11-03 4:28 ` Jeff Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox