<div dir="ltr"><div><div><div>Hi,<br><br></div>We have been dealing with a data corruption issue when we run out I/O <br>test suite made by ourselves with multiple thin devices built on top of a <br>thin-pool. In our test suites, we will create multiple thin devices and <br>continually write to them, check the file checksum, and delete all files <br>and issue DISCARD to reclaim space if no checksum error takes place. <br><br></div><div>We found that there is one data access pattern could corrupt the data. <br>Suppose that there are two thin devices A and B, and device A receives <br></div><div>a DISCARD bio to discard a physical(pool) block 100. Device A will quiesce<br></div><div>all previous I/O and held both virtual and physical data cell before it <br></div><div>actually remove the corresponding data mapping. After the data mapping <br></div><div>is removed, both data cell will be released and this DISCARD bio will <br></div><div>be passed down to underlying devices. If device B tries to allocate <br></div><div>a new block at the very same moment, it could reuse the block 100 which <br></div><div>was just been discarded by device A (suppose metadata commit had <br>been triggered, for a block cannot be reused in the same transaction).<br></div><div>In this case, we will have a race between the WRITE bio coming from <br></div><div>device B and the DISCARD bio coming from device A. Once the WRITE<br></div><div>bio completes before the DISCARD bio, there would be checksum error<br></div><div>for device B.<br><br></div><div>So my question is, does dm-thin have any mechanism to eliminate the race when <br>discarded block is reused right away by another device?<br></div><div><br></div><div>Any help would be grateful.<br></div><div>Thanks,<br><br></div><div>Dennis<br></div></div> <br clear="all"><div><div><div><div><div><div><div><div><div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US">Dennis Yang </span><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US"> </span><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US"><br>QNAP Systems, Inc.</span><div><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US">Skype: qnap.dennis.yang<br>Email:</span><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US"> <a href="mailto:dennisyang@qnap.com" target="_blank">dennisyang@qnap.com</a></span><div><span style="font-size:10pt;font-family:Arial,sans-serif" lang="EN-US">Tel:</span><span style="font-family:Arial,sans-serif;font-size:13.333333969116211px"> (+886)-2-2393-5152 ext. </span><span style="font-family:Arial,sans-serif;font-size:13.333333969116211px">15018</span><div><font face="Arial, sans-serif" size="2">Address: </font><span style="color:rgb(51,51,51);font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;line-height:18.66666603088379px">13F., No.56, Sec. 1, Xinsheng S. Rd., Zhongzheng Dist., Taipei City, Taiwan</span></div></div></div></div></div>
</div></div></div></div></div></div></div></div></div></div>