Bug 193146 - [PATCH] getblk: Assert that bsize is non-zero
Summary: [PATCH] getblk: Assert that bsize is non-zero
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-30 13:30 UTC by Conrad Meyer
Modified: 2014-09-04 00:14 UTC (History)
2 users (show)

See Also:


Attachments
(Applies to CURRENT with -p0.) (396 bytes, patch)
2014-08-30 13:30 UTC, Conrad Meyer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Meyer 2014-08-30 13:30:04 UTC
Created attachment 146535 [details]
(Applies to CURRENT with -p0.)

If !vn_isdisk(vp) and bo_bsize is zero, getblk() will calculate offsets for different blknos as zero, and create multiple bufs pointing at the same section of VM object (due to offset being zero). As you might imagine, this is pretty bad.

This patch attempts to head off developer errors like bo_bsize == 0 quickly with a KASSERT.

Sponsored by:	EMC / Isilon storage division
Comment 1 commit-hook freebsd_committer freebsd_triage 2014-09-04 00:10:14 UTC
A commit references this bug:

Author: benno
Date: Thu Sep  4 00:10:06 UTC 2014
New revision: 271070
URL: http://svnweb.freebsd.org/changeset/base/271070

Log:
  Add KASSERTs to catch the case where a developer may have forgotten to
  set bo_bsize on a bufobj.

  This is a slight modification of the patch provided.

  PR:		193146
  Submitted by:	Conrad Meyer <conrad.meyer@isilon.com>
  Sponsored by:	EMC Isilon Storage Division

Changes:
  head/sys/kern/vfs_bio.c