* [PATCH] xfstests: fix modulo-by-zero error in fsx
@ 2011-07-19 3:49 Dave Chinner
2011-07-19 17:10 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dave Chinner @ 2011-07-19 3:49 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
The recent fsx fixes has a logic error in the offset trimming code.
If a read is done when the file size is zero, then the logic error
causes a offset % 0 opertaion to occur. This causes fsx to get a
SIGFPE and die.
This was not discovered during my testing because I was using a
random seed that didn't trip this condition. Changing the seed to
that which test 091 uses (the default of 1) causes such an operation
to occur....
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
ltp/fsx.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 771bcdc..d53c498 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -987,14 +987,14 @@ docloseopen(void)
}
}
-#define TRIM_OFF_LEN(off, len, size, zero_offset) \
-do { \
- if (!zero_offset || file_size) \
- offset %= size; \
- else \
- offset = 0; \
- if (offset + len > size) \
- len = size - offset; \
+#define TRIM_OFF_LEN(off, len, size, allow_zero_file_size) \
+do { \
+ if (allow_zero_file_size || file_size) \
+ offset %= size; \
+ else \
+ offset = 0; \
+ if (offset + len > size) \
+ len = size - offset; \
} while (0)
void
--
1.7.5.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xfstests: fix modulo-by-zero error in fsx
2011-07-19 3:49 [PATCH] xfstests: fix modulo-by-zero error in fsx Dave Chinner
@ 2011-07-19 17:10 ` Christoph Hellwig
2011-07-20 23:04 ` Alex Elder
2011-07-24 12:41 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2011-07-19 17:10 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Tue, Jul 19, 2011 at 01:49:13PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The recent fsx fixes has a logic error in the offset trimming code.
> If a read is done when the file size is zero, then the logic error
> causes a offset % 0 opertaion to occur. This causes fsx to get a
> SIGFPE and die.
>
> This was not discovered during my testing because I was using a
> random seed that didn't trip this condition. Changing the seed to
> that which test 091 uses (the default of 1) causes such an operation
> to occur....
Looks good,
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] 5+ messages in thread
* Re: [PATCH] xfstests: fix modulo-by-zero error in fsx
2011-07-19 3:49 [PATCH] xfstests: fix modulo-by-zero error in fsx Dave Chinner
2011-07-19 17:10 ` Christoph Hellwig
@ 2011-07-20 23:04 ` Alex Elder
2011-07-20 23:13 ` Dave Chinner
2011-07-24 12:41 ` Christoph Hellwig
2 siblings, 1 reply; 5+ messages in thread
From: Alex Elder @ 2011-07-20 23:04 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Tue, 2011-07-19 at 13:49 +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> The recent fsx fixes has a logic error in the offset trimming code.
> If a read is done when the file size is zero, then the logic error
> causes a offset % 0 opertaion to occur. This causes fsx to get a
> SIGFPE and die.
>
> This was not discovered during my testing because I was using a
> random seed that didn't trip this condition. Changing the seed to
> that which test 091 uses (the default of 1) causes such an operation
> to occur....
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
I realize you already committed this, but I'm finally
getting around to reviewing it.
I started composing this message, explaining how you
should have done something differently. But at this
point it'll be more constructive to just send a patch
against what you have already committed. So that will
be coming shortly...
-Alex
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfstests: fix modulo-by-zero error in fsx
2011-07-20 23:04 ` Alex Elder
@ 2011-07-20 23:13 ` Dave Chinner
0 siblings, 0 replies; 5+ messages in thread
From: Dave Chinner @ 2011-07-20 23:13 UTC (permalink / raw)
To: Alex Elder; +Cc: xfs
On Wed, Jul 20, 2011 at 06:04:15PM -0500, Alex Elder wrote:
> On Tue, 2011-07-19 at 13:49 +1000, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > The recent fsx fixes has a logic error in the offset trimming code.
> > If a read is done when the file size is zero, then the logic error
> > causes a offset % 0 opertaion to occur. This causes fsx to get a
> > SIGFPE and die.
> >
> > This was not discovered during my testing because I was using a
> > random seed that didn't trip this condition. Changing the seed to
> > that which test 091 uses (the default of 1) causes such an operation
> > to occur....
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
>
> I realize you already committed this, but I'm finally
> getting around to reviewing it.
>
> I started composing this message, explaining how you
> should have done something differently. But at this
> point it'll be more constructive to just send a patch
> against what you have already committed. So that will
> be coming shortly...
Yeah, better to have something working that perfect. Feel free to
make it better ;)
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xfstests: fix modulo-by-zero error in fsx
2011-07-19 3:49 [PATCH] xfstests: fix modulo-by-zero error in fsx Dave Chinner
2011-07-19 17:10 ` Christoph Hellwig
2011-07-20 23:04 ` Alex Elder
@ 2011-07-24 12:41 ` Christoph Hellwig
2 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2011-07-24 12:41 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
I still get fairly regular 091 failures on my 32-bit userspace VM after
this. The interesting thing is that fsx tells we have a mismatch of
the junk vs junk.fsxgood files, but when looking at them using diff or
cmp they actually are identical.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-24 12:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-19 3:49 [PATCH] xfstests: fix modulo-by-zero error in fsx Dave Chinner
2011-07-19 17:10 ` Christoph Hellwig
2011-07-20 23:04 ` Alex Elder
2011-07-20 23:13 ` Dave Chinner
2011-07-24 12:41 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox