my_b_read() tries to read within a buffer where possible, and keeps track of the position of that buffer within the file when the buffer is refilled.
However, if my_b_read() hits the end of the file, the operating system file pointer and the IO_CACHE pos_in_file may not be synchronised. A future call to my_b_seek() may not rectify this if the new position is within the buffer. At this point, further reads with my_b_read() would read from the buffer until it is empty, and then try to read from the end of the file. In essence, my_b_read() expects the OS file pointer to be at the end of the buffer (or info->seek_not_done to be set in order to trigger a seek to make this so).
The attached patch fixes this by setting info->seek_not_done when my_b_read() hits EOF, causing future reads to seek to the correct position in the file.