diff --git a/src/client/dfuse/ops/read.c b/src/client/dfuse/ops/read.c index 47f8b96523a..55c2941541a 100644 --- a/src/client/dfuse/ops/read.c +++ b/src/client/dfuse/ops/read.c @@ -76,8 +76,6 @@ dfuse_readahead_reply(fuse_req_t req, size_t len, off_t position, struct dfuse_o oh->doh_linear_read_eof = true; } - DFUSE_TRA_DEBUG(oh, "%#zx-%#zx requested", position, position + len - 1); - /* At this point there is a buffer of known length that contains the data, and a read * request. * If the attempted read is bigger than the data then it will be truncated. @@ -94,7 +92,7 @@ dfuse_readahead_reply(fuse_req_t req, size_t len, off_t position, struct dfuse_o position + reply_len - 1, position + reply_len, position + len - 1); } - DFUSE_REPLY_BUF(oh, req, oh->doh_readahead->dra_ev->de_iov.iov_buf + position, reply_len); + DFUSE_REPLY_BUFQ(oh, req, oh->doh_readahead->dra_ev->de_iov.iov_buf + position, reply_len); return true; } diff --git a/utils/node_local_test.py b/utils/node_local_test.py index 62e9da899cf..f194fe7a32e 100755 --- a/utils/node_local_test.py +++ b/utils/node_local_test.py @@ -22,6 +22,7 @@ import stat import errno import argparse +import random import threading import functools import traceback @@ -1871,6 +1872,14 @@ def test_pre_read(self): with open(join(dfuse.dir, 'file2'), 'w') as fd: fd.write('testing') + raw_data0 = ''.join(random.choices(['d', 'a', 'o', 's'], k=1024 * 1024)) # nosec + with open(join(dfuse.dir, 'file3'), 'w') as fd: + fd.write(raw_data0) + + raw_data1 = ''.join(random.choices(['d', 'a', 'o', 's'], k=(1024 * 1024) - 1)) # nosec + with open(join(dfuse.dir, 'file4'), 'w') as fd: + fd.write(raw_data1) + if dfuse.stop(): self.fatal_errors = True @@ -1886,12 +1895,22 @@ def test_pre_read(self): with open(join(dfuse.dir, 'file2'), 'r') as fd: data2 = fd.read(2) + with open(join(dfuse.dir, 'file3'), 'r') as fd: + data3 = fd.read() + + with open(join(dfuse.dir, 'file4'), 'r') as fd: + data4 = fd.read() + data5 = fd.read() + if dfuse.stop(): self.fatal_errors = True print(data0) assert data0 == 'test' assert data1 == 'test' assert data2 == 'te' + assert raw_data0 == data3 + assert raw_data1 == data4 + assert len(data5) == 0 def test_two_mounts(self): """Create two mounts, and check that a file created in one can be read from the other"""