summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2014-07-01 10:55:15 -0600
committerJens Axboe <axboe@fb.com>2014-07-01 10:55:15 -0600
commit254c4407cb84a6dec90336054615b0f0e996bb7c (patch)
tree28d91bb07d38f47d557833a2124a8e5f266bb5de /ipc
parent9b4231bf995996d6459c57959ead5a1829ff2c57 (diff)
downloadop-kernel-dev-254c4407cb84a6dec90336054615b0f0e996bb7c.zip
op-kernel-dev-254c4407cb84a6dec90336054615b0f0e996bb7c.tar.gz
bio: modify __bio_add_page() to accept pages that don't start a new segment
The original behaviour is to refuse to add a new page if the maximum number of segments has been reached, regardless of the fact the page we are going to add can be merged into the last segment or not. Unfortunately, when the system runs under heavy memory fragmentation conditions, a driver may try to add multiple pages to the last segment. The original code won't accept them and EBUSY will be reported to userspace. This patch modifies the function so it refuses to add a page only in case the latter starts a new segment and the maximum number of segments has already been reached. The bug can be easily reproduced with the st driver: 1) set CONFIG_SCSI_MPT2SAS_MAX_SGE or CONFIG_SCSI_MPT3SAS_MAX_SGE to 16 2) modprobe st buffer_kbs=1024 3) #dd if=/dev/zero of=/dev/st0 bs=1M count=10 dd: error writing `/dev/st0': Device or resource busy [ming.lei@canonical.com: update bi_iter.bi_size before recounting segments] Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Signed-off-by: Ming Lei <ming.lei@canonical.com> Tested-by: Dongsu Park <dongsu.park@profitbricks.com> Tested-by: Jet Chen <jet.chen@intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Cc: Kent Overstreet <kmo@daterainc.com> Cc: Jens Axboe <axboe@kernel.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'ipc')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud