Comment 0 for bug 1951152

Revision history for this message
Colin Ian King (colin-king) wrote :

== SRU Justification ==

[ The issue ]

Turns out the math is incorrect in calculating the offset into a file on direct I/O writes cause non-block aligned offsets that cause -EINVAL on writes. This can occur when running non-power of two number of hdd stressors, e.g. 5 stressors.

[ The fix ]

Upstream fix:

From 9bbe45dfbd5db48c658dd0cf1f28cdb847bcee9c Mon Sep 17 00:00:00 2001
From: Colin Ian King <email address hidden>
Date: Thu, 11 Nov 2021 13:11:27 +0000
Subject: [PATCH] stress-hdd: ensure offset is aligned to 512 byte boundary

Fix corrects rounds to the 512 byte boundary on offsets.

[ Test plan ]

stress-ng --hdd 5 --hdd-write-size 512 --hdd-bytes 2M --hdd-opts direct,sync,wr-rnd,rd-rnd --timeout 0 --verbose

Without the fix the test exits early with a invalid write failure error. With the fix the test will run forever.

[ Where problems could occur ]

This fix only affects the hdd stressor test with random I/O writes AND direct I/O. The fix aligns the random offset, so in effect the change won't affect the overall test behaviour except for fixing the offsets so they are always naturally block aligned. This does mean that the stressor will do writes that are no longer spanned over multiple blocks (which is a valid test case), so the test case is less effective, but it is now at least working for direct I/O cases.