<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p></p>
<div class="_rp_S4" style="width: 1267px;">
<div class="_rp_o1">
<div class="_rp_q2 disableTextSelection _rp_y2" role="heading" aria-level="3">
<div class="_rp_I2">
<div class="_rp_62">
<div class="_rp_32">
<div class="ms-font-color-neutralSecondary ms-font-weight-semilight ms-font-s _rp_e8">
<div>
<div>
<div class="_rp_f8">
<div class="_rw_2" id="ItemHeader.ToContainer" role="heading" tabindex="-1" style="max-width: calc(100% - 200px);">
<div class="rpHighlightAllClass rpHighlightAllRecipientsClass rpHighlightToClass recipientWellWrapping _rw_3">
<div class="_rw_a" tabindex="0" aria-label="至收件人。使用箭头键导航列表,然后使用 Enter 键打开联系人卡片。">
<div class="_rw_9"><span tabindex="-1" class="_rw_b"><span class="_rw_8 PersonaPaneLauncher" tabindex="-1">
<div class="_pe_d _pe_G _pe_i" tabindex="-1" aria-expanded="false" aria-haspopup="true" style="width: 255.828px;">
<span autoid="_pe_b" class="_pe_l _pe_G _pe_W1 bidi _pe_m1 ms-font-s _pe_S allowTextSelection" style="width: 253.828px;">Gao Xiang <hsiangkao@linux.alibaba.com>;</span></div>
</span></span><span tabindex="-1" class="_rw_b"><span class="_rw_8 PersonaPaneLauncher" tabindex="-1">
<div class="_pe_d _pe_G _pe_i" tabindex="-1" aria-expanded="false" aria-haspopup="true" style="width: 162.078px;">
<span autoid="_pe_b" class="_pe_l _pe_G _pe_W1 bidi _pe_m1 ms-font-s _pe_S allowTextSelection" style="width: 160.078px;">linux-erofs@lists.ozlabs.org;</span></div>
</span></span><span tabindex="-1" class="_rw_b"><span class="_rw_8 PersonaPaneLauncher" tabindex="-1">
<div class="_pe_d _pe_G _pe_i" tabindex="-1" aria-expanded="false" aria-haspopup="true" style="width: 219.625px;">
<span autoid="_pe_b" class="_pe_l _pe_G _pe_W1 bidi _pe_m1 ms-font-s _pe_S allowTextSelection" style="width: 217.625px;">LKML <linux-kernel@vger.kernel.org></span></div>
</span></span></div>
</div>
</div>
</div>
<button type="button" class="ms-font-s _rw_4 o365button ms-font-color-neutralPrimary" role="button" aria-label="其他收件人" title="显示更多">
<span class="_fc_3 owaimg _rw_5 ms-Icon--chevronsDown ms-icon-font-size-12 ms-fcl-ns-b"></span>
</button></div>
</div>
</div>
</div>
</div>
</div>
<div class="_rp_32"></div>
</div>
</div>
<div class="_rp_x2">
<div class="_rp_32"></div>
<div></div>
</div>
</div>
</div>
<div class="_rp_45 _rp_35">
<div></div>
<div>
<div data-reactroot=""></div>
</div>
<div></div>
<div></div>
<div role="document">
<div autoid="_rp_x" class="_rp_T4" id="Item.MessagePartBody">
<div class="_rp_U4 ms-font-weight-regular ms-font-color-neutralDark rpHighlightAllClass rpHighlightBodyClass" id="Item.MessageUniqueBody" style="">
<div style="">
<div style="">
<div style="">
<div dir="ltr" style="">
<div id="x_divtagdefaultwrapper" style=""><font style=""><span id="x_divtagdefaultwrapper" style="">
<div style="color: black; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 12pt; margin-top: 0px; margin-bottom: 0px;">
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">When handling deduplicated compressed data, there can be multiple</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">decompressed extents pointing to the same compressed data in one shot.</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">In such cases, the bvecs which belong to the longest extent will be</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">selected as the primary bvecs for real decompressors to decode and the</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">other duplicated bvecs will be directly copied from the primary bvecs.</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">Previously, only relative offsets of the longest extent was checked to</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">decompress the primary bvecs. On rare occasions, it can be incorrect</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">if there are several extents with the same start relative offset.</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">As a result, some short bvecs could be selected for decompression and</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">then cause data corruption.</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">For example, as Shijie Sun reported off-list, considering the following</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">extents of a file:</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;"> 117: 903345.. 915250 | 11905 : 385024.. 389120 | 4096</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">...</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;"> 119: 919729.. 930323 | 10594 : 385024.. 389120 | 4096</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">...</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;"> 124: 968881.. 980786 | 11905 : 385024.. 389120 | 4096</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">The start relative offset is the same: 2225, but extent 119 (919729..</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">930323) is shorter than the others.</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">Let's restrict the bvec length in addition to the start offset if bvecs</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">are not full.</span></font><br>
<br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">Reported-by: Shijie Sun <sunshijie@xiaomi.com></span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">Fixes: 5c2a64252c5d ("erofs: introduce partial-referenced pclusters")</span></font><br>
<font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121"><span style="font-size: 13.32px;">Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com></span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px;"><font face="Microsoft YaHei UI,Microsoft YaHei,微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont" size="1" color="#212121" style="color: black; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 12pt;"><span style="font-size: 13.32px;"></span></font><font face="Microsoft YaHei UI, Microsoft YaHei, 微软雅黑, SimSun, 宋体, sans-serif, serif, EmojiFont"><span style="font-size: 13.32px;"><br>
</span></font><font color="#000000" face="Calibri, Helvetica, sans-serif, serif, EmojiFont"><span style="font-size: 12pt;">Tested-by: Shijie Sun <sunshijie@xiaomi.com></span></font></div>
<div style="color: black; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 12pt; margin-top: 0px; margin-bottom: 0px;">
<br>
</div>
<div style="color: black; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 12pt; margin-top: 0px; margin-bottom: 0px;">
Thanks, </div>
<div style="color: black; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 12pt; margin-top: 0px; margin-bottom: 0px;">
Sun Shijie</div>
</span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> 孙士杰<br>
<b>发送时间:</b> 2023年7月19日 18:17:40<br>
<b>收件人:</b> Gao Xiang; linux-erofs@lists.ozlabs.org<br>
<b>抄送:</b> LKML<br>
<b>主题:</b> 答复: [External Mail][PATCH] erofs: fix wrong primary bvec selection on deduplicated extents</font>
<div> </div>
</div>
<div>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p><span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">When handling deduplicated compressed data, there can be multiple</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">decompressed extents pointing to the same compressed data in one shot.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">In such cases, the bvecs which belong to the longest extent will be</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">selected as the primary bvecs for real decompressors to decode and the</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">other duplicated bvecs will be directly copied from the primary bvecs.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">Previously, only relative offsets of the longest extent was checked to</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">decompress the primary bvecs. On rare occasions, it can be incorrect</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">if there are several extents with the same start relative offset.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">As a result, some short bvecs could be selected for decompression and</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">then cause data corruption.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">For example, as Shijie Sun reported off-list, considering the following</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">extents of a file:</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> 117: 903345.. 915250 | 11905 : 385024.. 389120 | 4096</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">...</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> 119: 919729.. 930323 | 10594 : 385024.. 389120 | 4096</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">...</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> 124: 968881.. 980786 | 11905 : 385024.. 389120 | 4096</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">The start relative offset is the same: 2225, but extent 119 (919729..</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">930323) is shorter than the others.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">Let's restrict the bvec length in addition to the start offset if bvecs</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">are not full.</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">Reported-by: Shijie Sun <sunshijie@xiaomi.com></span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">Fixes: 5c2a64252c5d ("erofs: introduce partial-referenced pclusters")</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com></span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">---</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> fs/erofs/zdata.c | 7 ++++---</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> 1 file changed, 4 insertions(+), 3 deletions(-)</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">index b69d89a11dd0..de4f12152b62 100644</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">--- a/fs/erofs/zdata.c</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">+++ b/fs/erofs/zdata.c</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">@@ -1144,10 +1144,11 @@ static void z_erofs_do_decompressed_bvec(struct z_erofs_decompress_backend *be,</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> struct z_erofs_bvec *bvec)</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> {</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> struct z_erofs_bvec_item *item;</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">+ unsigned int pgnr;</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">- if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK)) {</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">- unsigned int pgnr;</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">-</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">+ if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK) &&</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">+ (bvec->end == PAGE_SIZE ||</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">+ bvec->offset + bvec->end == be->pcl->length)) {</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> pgnr = (bvec->offset + be->pcl->pageofs_out) >> PAGE_SHIFT;</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> DBG_BUGON(pgnr >= be->nr_pages);</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px"> if (!be->decompressed_pages[pgnr]) {</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">--</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
<span style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">2.24.4</span><br style="color:rgb(33,33,33); font-family:"Microsoft YaHei UI","Microsoft YaHei",微软雅黑,SimSun,宋体,sans-serif,serif,EmojiFont; font-size:13.3333px">
Tested-by Shijie Sun <sunshijie@xiaomi.com></p>
<p><br>
</p>
<p>Thanks, </p>
<p>Sun Shijie</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>发件人:</b> Gao Xiang <hsiangkao@linux.alibaba.com><br>
<b>发送时间:</b> 2023年7月19日 14:54:59<br>
<b>收件人:</b> linux-erofs@lists.ozlabs.org<br>
<b>抄送:</b> LKML; Gao Xiang; 孙士杰<br>
<b>主题:</b> [External Mail][PATCH] erofs: fix wrong primary bvec selection on deduplicated extents</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">[外部邮件] 此邮件来源于小米公司外部,请谨慎处理。若对邮件安全性存疑,请将邮件转发给misec@xiaomi.com进行反馈<br>
<br>
When handling deduplicated compressed data, there can be multiple<br>
decompressed extents pointing to the same compressed data in one shot.<br>
<br>
In such cases, the bvecs which belong to the longest extent will be<br>
selected as the primary bvecs for real decompressors to decode and the<br>
other duplicated bvecs will be directly copied from the primary bvecs.<br>
<br>
Previously, only relative offsets of the longest extent was checked to<br>
decompress the primary bvecs. On rare occasions, it can be incorrect<br>
if there are several extents with the same start relative offset.<br>
As a result, some short bvecs could be selected for decompression and<br>
then cause data corruption.<br>
<br>
For example, as Shijie Sun reported off-list, considering the following<br>
extents of a file:<br>
117: 903345.. 915250 | 11905 : 385024.. 389120 | 4096<br>
...<br>
119: 919729.. 930323 | 10594 : 385024.. 389120 | 4096<br>
...<br>
124: 968881.. 980786 | 11905 : 385024.. 389120 | 4096<br>
<br>
The start relative offset is the same: 2225, but extent 119 (919729..<br>
930323) is shorter than the others.<br>
<br>
Let's restrict the bvec length in addition to the start offset if bvecs<br>
are not full.<br>
<br>
Reported-by: Shijie Sun <sunshijie@xiaomi.com><br>
Fixes: 5c2a64252c5d ("erofs: introduce partial-referenced pclusters")<br>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com><br>
---<br>
fs/erofs/zdata.c | 7 ++++---<br>
1 file changed, 4 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c<br>
index b69d89a11dd0..de4f12152b62 100644<br>
--- a/fs/erofs/zdata.c<br>
+++ b/fs/erofs/zdata.c<br>
@@ -1144,10 +1144,11 @@ static void z_erofs_do_decompressed_bvec(struct z_erofs_decompress_backend *be,<br>
struct z_erofs_bvec *bvec)<br>
{<br>
struct z_erofs_bvec_item *item;<br>
+ unsigned int pgnr;<br>
<br>
- if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK)) {<br>
- unsigned int pgnr;<br>
-<br>
+ if (!((bvec->offset + be->pcl->pageofs_out) & ~PAGE_MASK) &&<br>
+ (bvec->end == PAGE_SIZE ||<br>
+ bvec->offset + bvec->end == be->pcl->length)) {<br>
pgnr = (bvec->offset + be->pcl->pageofs_out) >> PAGE_SHIFT;<br>
DBG_BUGON(pgnr >= be->nr_pages);<br>
if (!be->decompressed_pages[pgnr]) {<br>
--<br>
2.24.4<br>
<br>
</div>
</span></font></div>
#/******本邮件及其附件含有小米公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件! This e-mail and its attachments contain confidential information from XIAOMI, which is intended only for the person or entity whose address
is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in
error, please notify the sender by phone or email immediately and delete it!******/#
</body>
</html>