Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 2014 01:18:30 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Chris Torek <torek@torek.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: MAXPHYS in md(4)
Message-ID:  <20140421221830.GV4016@kib.kiev.ua>
In-Reply-To: <201404212215.s3LMFstd045652@elf.torek.net>
References:  <201404212215.s3LMFstd045652@elf.torek.net>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Mon, Apr 21, 2014 at 04:15:54PM -0600, Chris Torek wrote:
> In svn commit: r264504 - head/sys/geom/uzip we have:
> 
>   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). ...
> 
> That would be this one:
> 
> 	KASSERT(bp->bio_length <= MAXPHYS, ("bio_length %jd",
> 	    (uintmax_t)bp->bio_length));
> 	if ((bp->bio_flags & BIO_UNMAPPED) == 0) {
> 		pb = NULL;
> 		aiov.iov_base = bp->bio_data;
> 	} else {
> 		pb = getpbuf(&md_vnode_pbuf_freecnt);
> 		...
> 
> As it happens, the KASSERT is really only required for the
> pb != 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.
> 
> 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 <= MAXPHYS for the mapped
> cases.)

See r259198.  In fact, I considered reverting this after the r264504.

[-- Attachment #2 --]
-----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-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140421221830.GV4016>