<img src="https://mail.gluesys.com/mail/mail_confirm.php?host=gluesys.com&id=shkim3220&sid=17780531250224997008&rcptto=lustre-discuss%40lists.lustre.org" style="display:block" width="1" height="1">

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt">Hi all,<br />
</p>

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt"><br />
</p>

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt">I&#39;d like to report a kernel panic we encountered at a customer site running Lustre 2.15.6 (also reproduced on 2.17.0).<br />
</p>

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt"><br />
</p>

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt">The issue has been filed on Whamcloud Jira: <a href="https://jira.whamcloud.com/browse/LU-20227">LU-20227</a><br />
</p>

<p style="margin:0px; font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt"><br />
</p>

<p>---</p>

<p>Summary</p>

<p>When a Lustre snapshot MDT is mounted in a DNE configuration, lod_statfs() iterates sub-MDT OSPs via lod_foreach_mdt. If a sub-MDT OSP returns rc=0 with an uninitialized opd_statfs cache (os_bsize=0), lod_statfs_sum() silently shifts sfs-&gt;os_bsize down to zero.</p>

<p>This corrupted value is sent to the client with OS_STATFS_SUM set. When project quota is active and a block hard limit is set, ll_statfs_project() divides by sfs-&gt;f_bsize=0, triggering a CPU #DE (Divide Error) exception and kernel panic.</p>

<p>The panic was triggered simply by running linux du command&nbsp;on a directory under the snapshot mount.</p>

<p>---</p>

<p>Environment</p>

<p>&nbsp; - Lustre: 2.15.6 / 2.17.0 (we currently use 2.15.6 and tested also 2.17.0)<br />
&nbsp; - Kernel: 4.18.0-553.5.1<br />
&nbsp; - Backend FS: ZFS<br />
&nbsp; - Topology: MGS, MDT x3, OST x5, project quota enabled</p>

<p>---</p>

<p>Reproduction Conditions (all five must hold)</p>

<p>&nbsp; 1. Snapshot client mounted<br />
&nbsp; 2. Snapshot MDT has sub-MDTs (DNE configuration)<br />
&nbsp; 3. Sub-MDT OSP opd_statfs cache uninitialized (os_bsize=0)<br />
&nbsp; 4. Project quota enabled<br />
&nbsp; 5. Project block hard limit &gt; 0 on the target directory</p>

<p>---</p>

<p>Root Cause</p>

<p>BUG 1 (server): lod_foreach_mdt lacks the os_bsize==0 guard that lod_foreach_ost already has. The uninitialized os_bsize silently corrupts sfs-&gt;os_bsize to zero.</p>

<p>BUG 2 (client): ll_statfs_project() unconditionally divides by sfs-&gt;f_bsize without validating it is non-zero.</p>

<p>---</p>

<p>Proposed Fix</p>

<p>Server side (main fix):</p>

<p>&nbsp; - if (rc)<br />
&nbsp; + if (rc || ost_sfs.os_bsize == 0)</p>

<p>Client side (defensive):<br />
&nbsp; Add an f_bsize == 0 guard in ll_statfs_project() before the division, falling back to 1 &lt;&lt; COMPAT_BSIZE_SHIFT.</p>

<p>Full details and reproduction script are in the Jira issue linked above.</p>

<p>Any feedback or guidance on the proposed fix would be appreciated.</p>

<p>Best regards</p>

<div id="signature_div" style="font-family:\ub9d1\uc740 \uace0\ub515; font-size:10pt"></div>