Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1316570
| From | Jiri Slaby <jslaby@suse.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.12 12/39] block: Always check queue limits for cloned requests |
| Date | 2016-01-25 13:00 +0100 |
| Message-ID | <qUNYo-3kJ-51@gated-at.bofh.it> (permalink) |
| References | <qUNYl-3kJ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Hannes Reinecke <hare@suse.de>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit bf4e6b4e757488dee1b6a581f49c7ac34cd217f8 upstream.
When a cloned request is retried on other queues it always needs
to be checked against the queue limits of that queue.
Otherwise the calculations for nr_phys_segments might be wrong,
leading to a crash in scsi_init_sgtable().
To clarify this the patch renames blk_rq_check_limits()
to blk_cloned_rq_check_limits() and removes the symbol
export, as the new function should only be used for
cloned requests and never exported.
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Ewan Milne <emilne@redhat.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Fixes: e2a60da74 ("block: Clean up special command handling logic")
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
block/blk-core.c | 21 +++++++--------------
include/linux/blkdev.h | 1 -
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index bf214ae98937..de352508333f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1893,7 +1893,8 @@ void submit_bio(int rw, struct bio *bio)
EXPORT_SYMBOL(submit_bio);
/**
- * blk_rq_check_limits - Helper function to check a request for the queue limit
+ * blk_cloned_rq_check_limits - Helper function to check a cloned request
+ * for new the queue limits
* @q: the queue
* @rq: the request being checked
*
@@ -1904,20 +1905,13 @@ EXPORT_SYMBOL(submit_bio);
* after it is inserted to @q, it should be checked against @q before
* the insertion using this generic function.
*
- * This function should also be useful for request stacking drivers
- * in some cases below, so export this function.
* Request stacking drivers like request-based dm may change the queue
- * limits while requests are in the queue (e.g. dm's table swapping).
- * Such request stacking drivers should check those requests agaist
- * the new queue limits again when they dispatch those requests,
- * although such checkings are also done against the old queue limits
- * when submitting requests.
+ * limits when retrying requests on other queues. Those requests need
+ * to be checked against the new queue limits again during dispatch.
*/
-int blk_rq_check_limits(struct request_queue *q, struct request *rq)
+static int blk_cloned_rq_check_limits(struct request_queue *q,
+ struct request *rq)
{
- if (!rq_mergeable(rq))
- return 0;
-
if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
printk(KERN_ERR "%s: over max size limit.\n", __func__);
return -EIO;
@@ -1937,7 +1931,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq)
return 0;
}
-EXPORT_SYMBOL_GPL(blk_rq_check_limits);
/**
* blk_insert_cloned_request - Helper for stacking drivers to submit a request
@@ -1949,7 +1942,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
unsigned long flags;
int where = ELEVATOR_INSERT_BACK;
- if (blk_rq_check_limits(q, rq))
+ if (blk_cloned_rq_check_limits(q, rq))
return -EIO;
if (rq->rq_disk &&
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b1056783c105..e66eba43d702 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -740,7 +740,6 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
extern void blk_requeue_request(struct request_queue *, struct request *);
extern void blk_add_request_payload(struct request *rq, struct page *page,
unsigned int len);
-extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
extern int blk_lld_busy(struct request_queue *q);
extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
struct bio_set *bs, gfp_t gfp_mask,
--
2.7.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 02/39] tools: Add a "make all" rule Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 26/39] udp: properly support MSG_PEEK with truncated buffers Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 24/39] KEYS: Fix race between read and revoke Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 22/39] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 28/39] xen/gntdev: Grant maps should not be subject to NUMA balancing Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 36/39] MAINTAINERS: Add public mailing list for ARC Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 27/39] x86/signal: Fix restart_syscall number for x32 tasks Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 16/39] staging/dgnc: fix info leak in ioctl Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 37/39] ARC: Fix silly typo in MAINTAINERS file commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 25/39] KEYS: Fix keyring ref leak in join_session_keyring() Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 32/39] x86/boot: Double BOOT_HEAP_SIZE to 64KB Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 38/39] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 12/39] block: Always check queue limits for cloned requests Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 20/39] m68k/mm: Check for mm != NULL in do_page_fault() debug code Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 18/39] m32r: fix potential NULL-pointer dereference Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 15/39] module: remove MODULE_GENERIC_TABLE Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 23/39] USB: quirks: Fix another ELAN touchscreen Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 17/39] pm: use GFP_ATOMIC when pm core call this function Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 39/39] ppp, slip: Validate VJ compression slot parameters completely Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 30/39] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 21/39] m68k/mac: Make SCC reset work more reliably Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 34/39] ALSA: hda - Add Intel Lewisburg device IDs Audio Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 04/39] dlm: make posix locks interruptible Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 35/39] ALSA: hda - Apply pin fixup for HP ProBook 6550b Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 14/39] qla2xxx: Fix hardware lock/unlock issue causing kernel panic. Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 29/39] x86/xen: don't reset vcpu_info on a cancelled suspend Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:00 +0100 [PATCH 3.12 10/39] drm/i915: Fix SRC_COPY width on 830/845g Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 07/39] route: Use ipv4_mtu instead of raw rt_pmtu Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 13/39] Input: aiptek - fix crash on detecting device without endpoints Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 05/39] PCI: Drop "setting latency timer" messages Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 11/39] lpfc: Fix null ndlp dereference in target_reset_handler Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 09/39] ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on() Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 06/39] ipv4: Don't increase PMTU with Datagram Too Big message. Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 03/39] ALSA: hda - Fix noise problems on Thinkpad T440s Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100 [PATCH 3.12 08/39] SUNRPC: Fix oops when trace sunrpc_task events in nfs client Jiri Slaby <jslaby@suse.cz> - 2016-01-25 13:10 +0100
csiph-web