From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 21 22:18:35 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BAFBBD1 for ; Mon, 21 Apr 2014 22:18:35 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA92B1E41 for ; Mon, 21 Apr 2014 22:18:34 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.8/8.14.8) with ESMTP id s3LMIUkY034101; Tue, 22 Apr 2014 01:18:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s3LMIUkY034101 Received: (from kostik@localhost) by tom.home (8.14.8/8.14.8/Submit) id s3LMIUuG034100; Tue, 22 Apr 2014 01:18:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 22 Apr 2014 01:18:30 +0300 From: Konstantin Belousov To: Chris Torek Subject: Re: MAXPHYS in md(4) Message-ID: <20140421221830.GV4016@kib.kiev.ua> References: <201404212215.s3LMFstd045652@elf.torek.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="pnwJnpr18esoRWH7" Content-Disposition: inline In-Reply-To: <201404212215.s3LMFstd045652@elf.torek.net> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2014 22:18:35 -0000 --pnwJnpr18esoRWH7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 21, 2014 at 04:15:54PM -0600, Chris Torek wrote: > In svn commit: r264504 - head/sys/geom/uzip we have: >=20 > Make sure not to do I/O for more than MAXPHYS bytes. Doing so can cause > problems in our providers, such as a KASSERT in md(4). ... >=20 > That would be this one: >=20 > KASSERT(bp->bio_length <=3D MAXPHYS, ("bio_length %jd", > (uintmax_t)bp->bio_length)); > if ((bp->bio_flags & BIO_UNMAPPED) =3D=3D 0) { > pb =3D NULL; > aiov.iov_base =3D bp->bio_data; > } else { > pb =3D getpbuf(&md_vnode_pbuf_freecnt); > ... >=20 > As it happens, the KASSERT is really only required for the > pb !=3D NULL case, which uses one of the reserved getpbuf() buffers > that only map MAXPHYS bytes at a time. If bp->bio_flags says that > the bio is mapped, we just use the existing KVA, and VOP_READ() and > VOP_WRITE() must already break up arbitrarily large transfers. >=20 > So, it seems like the md(4) KASSERT can be moved into the "else". > Is this a good idea? (It might not help r264504 much since it > looks like r264504 wants to handle short-read results anyway, but > it seems overly restrictive to require <=3D MAXPHYS for the mapped > cases.) See r259198. In fact, I considered reverting this after the r264504. --pnwJnpr18esoRWH7 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTVZk1AAoJEJDCuSvBvK1BHKkP/1c8M1w4eLAWqhJXEbcku2Ka +IVGS+sCWUhoGthN1BMT3lFW2jyybK4ZetivvWSM+7G0UaqrxXV617mbTg9jjFGc 0tw2WObk1+psVZJqETenZFn3znvYf5h64Zu9l31lUQkmzHxQpNB1Toe3L2t3+wjX U8ijIPZQsT4ZozgYTqjSn3eAKj8mbAK5wVwLozkrDWtkSUlrmPXQ99NzYusgHRsY w+euTj4mxsu7pUI49YAUiafHIueZFaC0jFiflX+2j4OuB5XZ+Yv87AWSklMRZjBz Pv6hUlTTZ6cZ9cltVP2lV1oMYQG0b3ZtowqDjY9qTvgvvt31uEvGqXsuAe5S2EIK 7AgVQuwrz0yTunn6U3lGZQyRWHFi2udnyNV2RD68jZM0zclNa8QBoeOoh1wUoyRi xqOEyL5CinfmqXc1mLmUdXmlbyNdpKqN6zoEozDMMpqPS1DizpVjXLNf9zUF0aS7 +21VwmDaI3binXujmSisMlxhqswKLigs5aH8n/cHa6p3Mj63hsbrmqGAtPjRO8/U GSAmZ/Z92vlmXaFJsCrGE5thICh6S0w2jIBvUjtUtTDSCskcI/E4zMlvX2rGmnR3 pXZxm+76F6/+zCb75woScGbFRyu2vUlhP9o3rnOghwTidKT5pOsFQqceDWTSTSlJ Tq24TRutB5EaEEeE/87m =bvsV -----END PGP SIGNATURE----- --pnwJnpr18esoRWH7--