Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933677AbcJZXFo (ORCPT ); Wed, 26 Oct 2016 19:05:44 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:60213 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932334AbcJZXFl (ORCPT ); Wed, 26 Oct 2016 19:05:41 -0400 Subject: Re: bio linked list corruption. To: Dave Jones , Linus Torvalds , Chris Mason , Andy Lutomirski , Andy Lutomirski , Al Viro , Josef Bacik , David Sterba , linux-btrfs , Linux Kernel , Dave Chinner References: <20161026163018.wx57yy554576s6e2@codemonkey.org.uk> <20161026184201.6ofblkd3j5uxystq@codemonkey.org.uk> <488f9edc-6a1c-2c68-0d33-d3aa32ece9a4@fb.com> <20161026224025.mou27kki4bslftli@codemonkey.org.uk> <20161026230113.jjyadei4ipwixgvg@codemonkey.org.uk> From: Jens Axboe Message-ID: <9bfe5929-3e7f-0e2e-857b-0a6787289361@fb.com> Date: Wed, 26 Oct 2016 17:05:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161026230113.jjyadei4ipwixgvg@codemonkey.org.uk> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [66.29.164.166] X-ClientProxiedBy: CY1PR20CA0108.namprd20.prod.outlook.com (10.164.213.162) To BN6PR15MB1185.namprd15.prod.outlook.com (10.172.205.139) X-MS-Office365-Filtering-Correlation-Id: 54eddfba-2e29-4775-fd35-08d3fdf4949b X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;2:recHr8mwvoMxahV2F9Ew4YzY4jLeThqASYGJcdCn8XmI28hdheOaO1PrOjU2NLaeaKeO35SmNyeUGw6ObMMrwh0yW3FxpKhx6e1kxdp6FtfLOeEOtBEaU/6xubXGIzw3NHQAtJcpCGRCFNm5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l5vYjXKhEBYVvtNPjQd92/G6LZzkanOB00OGZ1P7sS4f9R9FnhM2N7SpBFT0RBEPWqMYMX8LzjFeeEK77HPXG4E3ISZ2P32ncF+dSqEvkZzHPZ+FbiV7Gv8=;4:cuZNQQgv2rr+bTJYtOgvw28oeyrua9wPRJLEV89Lz6aCuk9tKtdLQPWvmHPl5Lfud3xJl6OKQ4d89rMiRSOQ13RYanx00UL0dBpkIDiFTMX/pJeKUaZCGk1krBKP33FfshmvVtxlvzcZc47sckD8HGI89bP82YL/DE3dV0vrTYz+19B39x+aDWiPSWwsGCAGc8L0iFj1UKKQFrW0xwqvxiPhbeex5cLrH3hHE7xhX8udWp8VdHG4utF4V2b0KYcANuRQmfvY8t2Wk/pDiRdr529OAMCx4VxzvByFow+LvlALKsk3W3gLuPEu6/G+k9k8cV9lSI0dClz4rFAUJpCR/8BgZqbUS6fFyKQAJW8h6n3WXm4BqmgWajXoRx/zg/rftGt+zWqzeEiA6E4Z8XdSeA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BN6PR15MB1185;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1185; X-Forefront-PRVS: 0107098B6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(24454002)(377454003)(189998001)(65956001)(81156014)(8676002)(81166006)(105586002)(3480700004)(5001770100001)(106356001)(65806001)(47776003)(97736004)(7736002)(586003)(83506001)(305945005)(107886002)(92566002)(7846002)(6666003)(68736007)(66066001)(3846002)(6116002)(77096005)(101416001)(54356999)(33646002)(230700001)(50986999)(31696002)(86362001)(2950100002)(36756003)(23746002)(93886004)(2906002)(42186005)(117156001)(76176999)(4001350100001)(31686004)(65826007)(64126003)(5660300001)(50466002)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1185;H:[192.168.1.176];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BN6PR15MB1185;23:5PzTvJVeZlcFDDzMqw02I7hnl+PNvb0Jtptix?= =?Windows-1252?Q?PthAFtOarFBL/hkg6MrfrLb4sKcXUXNaDi9kgoMLvT6MhjN3TAsrmkV7?= =?Windows-1252?Q?MYZvXxmmmiTwSn7S8WYyDrbqkfh10fw/lJme+aa51WFNr6gnMM69jAPi?= =?Windows-1252?Q?z+HWSEaiUGBDuxvU/0TJd3iLjTNc1Vjb7t3EaA03c+m9GKI1mFcB8Sdc?= =?Windows-1252?Q?JsF25WABBvibvZsuGJREfJyzZsTnXrspSqPTnTawsmhHrBmbqnPJnW5O?= =?Windows-1252?Q?qoajv5FosAuOg41JIjePph0aVvkyZO87AhD/QjcGMtzWYxnaAxLdBlgv?= =?Windows-1252?Q?6c8QAkj4d40BfmtuxeqvJCansi6gnt5xCr/nIopHpOJqMxOxtZ4G5Rd1?= =?Windows-1252?Q?oFuLvEF9An455bDRqmv/FDJ8RW/mWIjtPTitTazy0OZtO2yoolwPjWce?= =?Windows-1252?Q?mEjgWOEYuU7Wn6JleXqUhEqlhVTHJpK3R7oFqOF5oRRQkA1H5dFiQ41G?= =?Windows-1252?Q?ORoBtka+BOZmgR5lDUMfO325bFmzV95ObqWhEtkgl2WqrN72OCNPour+?= =?Windows-1252?Q?G7bsjZc+x+T0XMhAhODi8xWGU1R/zFx9IC2osMW+rZh4gYTzVSHbBXqn?= =?Windows-1252?Q?pUaCTJfXVt56HsvTT8dXsgz98uSOg2G0C2yOT/0WaEvzQ1kao2ateC6b?= =?Windows-1252?Q?GPA/yoaPox3FosYIJrMVoB5jSVXg8Ww3au6Jjw6VRpdNzXN81iqRiQqP?= =?Windows-1252?Q?rKCu7QVpXO5EKIzb1+0j4UYQWjpDXohpr920cUSDbxj79y/a5ZmuFoGe?= =?Windows-1252?Q?QLOBgvDIDXgnlKlTwust85++mIFbHT8xQWXCb9QR2Vx8K/2RSMd+0aWk?= =?Windows-1252?Q?kKhgsDQybFgzNrIXz2hk3oOUZhkI4zCPpQomCxZbuXMFoJQrNlahfjx9?= =?Windows-1252?Q?hqjJSGBegiltreIkUTnd/CIDhZbidpagC8KPYMMW7ctMsVyHNOP+sI/H?= =?Windows-1252?Q?2qhCH0xdJKd+7iJlFAlrIF1yjfovI/iwZyIa8LIe0gWyp1bkwOhSjXcj?= =?Windows-1252?Q?n7wALjsRMwhHQuvuK4Hpq6FettyQlKw/FjES4J664A0VRq+ddlPYUjts?= =?Windows-1252?Q?n9kG1ROzliTl49I3+XwB5zpL4ySFQdDBw5NTo/5s1HJU/OeJSek1jx5N?= =?Windows-1252?Q?JAHYYOTscnNscqHiCbvkyj6sV0vB2AgfnNj1yxDs6qqvbrDsHLAAHUdE?= =?Windows-1252?Q?KAMzWuwlf9nplAUcdI0ZH/08OI5/nK99RuuCQwLmzp1Y699jHYes3rfO?= =?Windows-1252?Q?gXX1nHhcof1xsrc29N4Rv68fHb8Bs2zp+lENmoSdLeCPVXeyRUk8X9ql?= =?Windows-1252?Q?nAK80IheiR5Ft8lY1wCz56vy+pdn2uook8CwBvjLTp/IVsALlXW/388X?= =?Windows-1252?Q?aNtLD4qCax6VHeps1lRFxx7UNfnsDPBEuCw63bp10pCOt8BGXj7I9eyO?= =?Windows-1252?Q?JBkcXw=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;6:KOGnCOxBe0aSZ3MfpzMoryXpQpQnm527FMdJnHEB9RsHjqGw6L7Y9rknDVPYrTd3GP+A9spOvWylm57FySr7/kDCkFk9kaLwyCP11bH5hbE+MZoAOQDacMfDAMc+O5ch0Xxd9jnLni+LJHevY4wQaNJNdO/9k7ShGKPVlNkSonL26Or2QftsL3JrWOB2OyZ753OJ1pqt3UsmoLJjsmUIpBv1uSuvqGMDWJ+HeYTFDYhcQ+ccpuV2ceztsrjxjgH/KBDINmaCHByTJCTiZsJg+Kts1UClHXG7gO021CQOOBUXLNrOTOIGMdxUsOTxEm6Y;5:2x20+qlou7jbyvqIi/dGyEqKe2sIdZsqaeR5AvcJQbjSm6P7ICndjfeZiiIx5GFEaFNW6+KcA5+5RdBLh+FybyiXMYxlCJMncDrItZmLoqmQSa2V9EbJD94tyhFpcjCFf3M9r+4k360Y9kVfT/7jrA==;24:dv2dIM2DMOsyT0c4ysJSqYb2JTMmNhI3qjVvEk3fzdcDkhCUMy62qoKrr5ErII08nk3VkfvtVTrlxvhiUlWze3X8czMOksBedM9LEd9BI5I=;7:xi4oTqOEMpaPLRYMWA6CjO5QMnxpHvPqArlH11WWH1THa/bq1PikdMZTzZoWQUUL/2GOxzNIS1XdsyLXZFKN4ZDxM2vzKV0yAIMkL7jE3dhUe5RvfbkZ7Osa/CdmAbAP0VFUdzb4nmZ+9kycA7fL4rvPQeRVz6DOhnA0iafqfiTWzF+s5frJEtO+pmb6zyu1RdUzAjLxWw5k9eu1kL1VmGvhyu5V6SHGSo/bTtGhBNjUdrEv6nvE4fnT4j+Ue1e8wIyCObcSgJwUGNkgqHuhm0k8YrAPwj2C/GDtSiNsQOqeLm+nmqTLpBNlxLS3GalSHBroqFHhvt3z7Kr6X2dfNXXvcF4ugYi/oI8+MIpHXhY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BN6PR15MB1185;20:lCrCeCWtfirc29ieLvrU/9o0NGUDQrlOHbOJiCzt6wy0yVHMbAqOGpz/6HvGIedmlnCtwZzoe1BvBNdia0GNcgvAE9HwcIw0driWZJ/fIZckT/TshX25abHFE4YVTlVnQELqOvGNb9zmC7NSMZmIuyDOiEI10kTj0rI4G3erZVI= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 23:05:27.7264 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1185 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-26_14:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1551 Lines: 50 On 10/26/2016 05:01 PM, Dave Jones wrote: > On Wed, Oct 26, 2016 at 03:51:01PM -0700, Linus Torvalds wrote: > > Dave: it might be a good idea to split that "WARN_ON_ONCE()" in > > blk_mq_merge_queue_io() into two, since right now it can trigger both > > for the > > > > blk_mq_bio_to_request(rq, bio); > > > > path _and_ for the > > > > if (!blk_mq_attempt_merge(q, ctx, bio)) { > > blk_mq_bio_to_request(rq, bio); > > goto insert_rq; > > > > path. If you split it into two: one before that "insert_rq:" label, > > and one before the "goto insert_rq" thing, then we could see if it is > > just one of the blk_mq_merge_queue_io() cases (or both) that is > > broken.. > > It's the latter of the two. > > [ 12.302392] WARNING: CPU: 3 PID: 272 at block/blk-mq.c:1191 > blk_sq_make_request+0x320/0x4d0 I would expect that - so normal request, since we know merging is on. I just sent out a patch, can you give that a whirl? Keep Linus' debugging patch, and apply it on top. Below as well, for reference. diff --git a/block/blk-mq.c b/block/blk-mq.c index ddc2eed64771..80a9c45a9235 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1217,9 +1217,7 @@ static struct request *blk_mq_map_request(struct request_queue *q, blk_mq_set_alloc_data(&alloc_data, q, 0, ctx, hctx); rq = __blk_mq_alloc_request(&alloc_data, op, op_flags); - hctx->queued++; - data->hctx = hctx; - data->ctx = ctx; + data->hctx->queued++; return rq; } -- Jens Axboe