The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Kent Overstreet <kmo@daterainc.com>, Shaohua Li <shli@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: next bio iters break discard?
Date: Sun, 12 Jan 2014 19:52:40 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.1401121909160.1239@eggly.anvils> (raw)

When I try to exercise heavy swapping with discard on mmotm 2014-01-09,
I soon hit a NULL pointer dereference in __blk_recalc_rq_segments():

__blk_recalc_rq_segments
blk_recount_segments
ll_back_merge_fn
bio_attempt_back_merge
blk_queue_bio
generic_make_request
submit_bio
blkdev_issue_discard
swap_do_scheduled_discard
scan_swap_map_try_ssd_cluster
scan_swap_map
get_swap_page
add_to_swap
shrink_page_list
etc. etc.

The crash is on the NULL struct page pointer in page_to_pfn(bv.bv_page)
on line 35 of block/blk-merge.c.

The code around there is not very different from 3.13-rc8 (which doesn't
crash), and I didn't notice REQ_DISCARD or bio_has_data() checks removed.

I think it worked before because the old bio_for_each_segment()
iterator was a straightforward "i < bio->bi_vcnt" loop which would
do nothing when bi_vcnt is 0; but the new iterators are relying
(perhaps) on bio->bi_iter.bi_size which is non-0 despite no data?

I expect it would crash in the same way on other recent nexts and
mmotms, I've not tried.

Hugh

             reply	other threads:[~2014-01-13  3:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-13  3:52 Hugh Dickins [this message]
2014-01-14  2:33 ` next bio iters break discard? Kent Overstreet
2014-01-14  4:06   ` Martin K. Petersen
2014-01-14  4:48     ` Kent Overstreet
2014-01-14 20:17       ` Martin K. Petersen
2014-01-14 22:24         ` Kent Overstreet
2014-01-16  1:39           ` Martin K. Petersen
2014-01-16 20:21           ` Hugh Dickins
2014-01-17  1:06             ` Kent Overstreet
2014-01-17  1:21             ` Kent Overstreet
2014-01-31 17:17               ` Hugh Dickins
2014-01-31 21:58                 ` Jens Axboe
2014-02-04 10:17                 ` [PATCH] block: Explicitly handle discard/write same segments Kent Overstreet
2014-02-04 12:25                   ` Hugh Dickins
2014-02-04 12:35                     ` Kent Overstreet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.11.1401121909160.1239@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=kmo@daterainc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shli@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox