NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/60286 (zfs sparse zvol reports wrong volume size)



The following reply was made to PR kern/60286; it has been noted by GNATS.

From: lenzi himself <nervoso%k1.com.br@localhost>
To: gnats-bugs%netbsd.org@localhost, mlelstv%netbsd.org@localhost, kern-bug-people%netbsd.org@localhost,
        netbsd-bugs%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, riastradh%NetBSD.org@localhost
Cc: 
Subject: Re: kern/60286 (zfs sparse zvol reports wrong volume size)
Date: Fri, 22 May 2026 15:03:58 -0300

 --=-uA9EvUJxW/yJXC2bR53D
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: quoted-printable
 
 Em sex, 2026-05-22 =C3=A0s 16:47 +0000, riastradh%NetBSD.org@localhost escreveu:
 > Synopsis: zfs sparse zvol reports wrong volume size
 >=20
 > Responsible-Changed-From-To: kern-bug-people->mlelstv
 > Responsible-Changed-By: riastradh%NetBSD.org@localhost
 > Responsible-Changed-When: Fri, 22 May 2026 16:47:19 +0000
 > Responsible-Changed-Why:
 > Can you take a look?  Looks like you added the original dkw_size =3D
 > dg_secperunit assignment.
 >=20
 >=20
 >=20
 this is the patch... for me it looks like it removes the dkw->dwk_size =C2=
 =A0and recompute it with new value... 6 lines
 later...
 Unless the code I put on the bug report is messed I think this is correct
 
 
 17 --- usr/src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c.orig 2026-=
 05-22 11:10:15.900492779 -0300
 18 +++ usr/src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c 2026-05-22=
  11:10:28.101264922 -0300
 19 @@ -3621,7 +3621,13 @@
 20 strlcpy(dkw->dkw_parent, "ZFS", sizeof(dkw->dkw_parent));
 21
 22 dkw->dkw_offset =3D 0;
 23 - dkw->dkw_size =3D dg->dg_secperunit;
 24 + /*
 25 + * dkw_size is in DEV_BSIZE (512) blocks, but dg_secperunit
 26 + * counts in dg_secsize blocks (which may be 4096 or larger
 27 + * depending on the pool's ashift). Convert to DEV_BSIZE.
 28 + */
 29 + dkw->dkw_size =3D dg->dg_secperunit *
 30 + (dg->dg_secsize / DEV_BSIZE);
 31 strcpy(dkw->dkw_ptype, DKW_PTYPE_FFS);
 
 --=-uA9EvUJxW/yJXC2bR53D
 Content-Type: text/html; charset="utf-8"
 Content-Transfer-Encoding: quoted-printable
 
 <html><head><style>pre,code,address {
   margin: 0px;
 }
 h1,h2,h3,h4,h5,h6 {
   margin-top: 0.2em;
   margin-bottom: 0.2em;
 }
 ol,ul {
   margin-top: 0em;
   margin-bottom: 0em;
 }
 blockquote {
   margin-top: 0em;
   margin-bottom: 0em;
 }
 </style></head><body><div>Em sex, 2026-05-22 =C3=A0s 16:47 +0000, riastradh=
 @NetBSD.org escreveu:</div><blockquote type=3D"cite" style=3D"margin:0 0 0 =
 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>Synopsis: zfs sp=
 arse zvol reports wrong volume size</pre><pre><br></pre><pre>Responsible-Ch=
 anged-From-To: kern-bug-people-&gt;mlelstv</pre><pre>Responsible-Changed-By=
 : <a href=3D"mailto:riastradh%NetBSD.org@localhost";>riastradh%NetBSD.org@localhost</a></pre><pr=
 e>Responsible-Changed-When: Fri, 22 May 2026 16:47:19 +0000</pre><pre>Respo=
 nsible-Changed-Why:</pre><pre>Can you take a look?  Looks like you added th=
 e original dkw_size =3D</pre><pre>dg_secperunit assignment.</pre><pre><br><=
 /pre><pre><br></pre><pre><br></pre></blockquote><div>this is the patch... f=
 or me it looks like it removes the dkw-&gt;dwk_size &nbsp;and recompute it =
 with new value... 6 lines later...</div><div>Unless the code I put on the b=
 ug report is messed I think this is correct</div><div><br></div><div><br></=
 div><div>     17 --- usr/src/external/cddl/osnet/dist/uts/common/fs/zfs/zvo=
 l.c.orig      2026-05-22 11:10:15.900492779 -0300</div><div>     18 +++ usr=
 /src/external/cddl/osnet/dist/uts/common/fs/zfs/zvol.c   2026-05-22 11:10:2=
 8.101264922 -0300</div><div>     19 @@ -3621,7 +3621,13 @@</div><div>     2=
 0                 strlcpy(dkw-&gt;dkw_parent, "ZFS", sizeof(dkw-&gt;dkw_par=
 ent));</div><div>     21</div><div>     22                 dkw-&gt;dkw_offs=
 et =3D 0;</div><div>     23 -               dkw-&gt;dkw_size =3D dg-&gt;dg_=
 secperunit;</div><div>     24 +               /*</div><div>     25 +       =
          * dkw_size is in DEV_BSIZE (512) blocks, but dg_secperunit</div><d=
 iv>     26 +                * counts in dg_secsize blocks (which may be 409=
 6 or larger</div><div>     27 +                * depending on the pool's as=
 hift).  Convert to DEV_BSIZE.</div><div>     28 +                */</div><d=
 iv>     29 +               dkw-&gt;dkw_size =3D dg-&gt;dg_secperunit *</div=
 ><div>     30 +                   (dg-&gt;dg_secsize / DEV_BSIZE);</div><di=
 v>     31                 strcpy(dkw-&gt;dkw_ptype, DKW_PTYPE_FFS);</div><d=
 iv><br></div><div><span></span></div></body></html>
 
 --=-uA9EvUJxW/yJXC2bR53D--
 



Home | Main Index | Thread Index | Old Index