scoutfs: add data_wait_err for reporting errors

Add support for reporting errors to data waiters via a new
SCOUTFS_IOC_DATA_WAIT_ERR ioctl.  This allows waiters to return an error
to readers when staging fails.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
[zab: renamed to data_wait_err, took ino arg]
Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Benjamin LaHaise
2020-05-20 16:22:51 -04:00
committed by Zach Brown
parent 8cf6f73744
commit 492afae552
2 changed files with 38 additions and 0 deletions

View File

@@ -14,6 +14,20 @@ offline wating should be empty again:
offline waiting should now have one known entry:
offline waiting should be empty again:
0
== EIO injection for waiting readers works
offline waiting should now have two known entries:
2
data_wait_err found 2 waiters.
offline waiting should now have 0 known entries:
0
dd: error reading /mnt/test/test/offline-extent-waiting/dir/file: Input/output error
0+0 records in
0+0 records out
dd: error reading /mnt/test/test/offline-extent-waiting/dir/file: Input/output error
0+0 records in
0+0 records out
offline waiting should be empty again:
0
== readahead while offline does no harm
== waiting on interesting blocks works
offline waiting is empty at block 0

View File

@@ -76,6 +76,30 @@ wait "$pid" 2> /dev/null
echo "offline waiting should be empty again:"
scoutfs data-waiting 0 0 "$DIR" | wc -l
echo "== EIO injection for waiting readers works"
ino=$(stat -c "%i" "$DIR/file")
dd if="$DIR/file" bs=$BS skip=0 of=/dev/null 2>&1 | \
t_filter_fs | head -3 > $T_TMP.cat1 &
pid="$!"
dd if="$DIR/file" bs=$BS skip=1 of=/dev/null 2>&1 | \
t_filter_fs | head -3 > $T_TMP.cat2 &
pid2="$!"
sleep .1
echo "offline waiting should now have two known entries:"
scoutfs data-waiting 0 0 "$DIR" | wc -l
expect_wait "$DIR/file" "read" $ino 0 $ino 1
scoutfs data-wait-err "$DIR" "$ino" "$vers" 0 $((BS*2)) read -5
sleep .1
echo "offline waiting should now have 0 known entries:"
scoutfs data-waiting 0 0 "$DIR" | wc -l
# silence terminated message
wait "$pid" 2> /dev/null
wait "$pid2" 2> /dev/null
cat $T_TMP.cat1
cat $T_TMP.cat2
echo "offline waiting should be empty again:"
scoutfs data-waiting 0 0 "$DIR" | wc -l
echo "== readahead while offline does no harm"
xfs_io -c "fadvise -w 0 $BYTES" "$DIR/file"
scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden"