Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934903AbcJZW4q (ORCPT ); Wed, 26 Oct 2016 18:56:46 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:58408 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933396AbcJZW4l (ORCPT ); Wed, 26 Oct 2016 18:56:41 -0400 Subject: Re: bio linked list corruption. To: Linus Torvalds , Dave Jones , Chris Mason , Andy Lutomirski , Andy Lutomirski , Al Viro , Josef Bacik , David Sterba , linux-btrfs , Linux Kernel , Dave Chinner References: <20161026002752.qvrm6yxqb54fiqnd@codemonkey.org.uk> <20161026163018.wx57yy554576s6e2@codemonkey.org.uk> <20161026184201.6ofblkd3j5uxystq@codemonkey.org.uk> <488f9edc-6a1c-2c68-0d33-d3aa32ece9a4@fb.com> <20161026224025.mou27kki4bslftli@codemonkey.org.uk> From: Jens Axboe Message-ID: Date: Wed, 26 Oct 2016 16:55:43 -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: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [66.29.164.166] X-ClientProxiedBy: SN1PR10CA0024.namprd10.prod.outlook.com (10.162.255.162) To MWHPR15MB1199.namprd15.prod.outlook.com (10.175.2.141) X-MS-Office365-Filtering-Correlation-Id: 33a59bd1-2144-462a-e0dd-08d3fdf33bfa X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;2:aiMV77lyFeZXN4O07X4B2maKFzTKk6AJKgsHOvnswVqJ/4uazjmTj6UpRfFKbObVIXql5SXXXQAw05o4Paf93lu4If1GkRnXBdUE2P8ZCp/0FMG7hIQr78Y3yioke5ipEH1+ac7lUIxW6nm6OvycpiEFTsHq8HT2tQqaQLzUvIwkmA65j33dADOd+toc4xMJFyuG9fKz1MAgXLg31MOa1A==;3:O7DCzctGgBjO5TuHd2eBQa8SANfZAFmi8RMXClx2DI5cBRx5VFmUeIEpLf08/EIF71J8PsUKPpAanuadZBKxeIsMi+pp7OIDuR4LEpGu8SJ4NDLqmKduP/A/X04bw8tlRHlc+HFn0feYXBdTFEr1lg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1199; X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;25:6h0iF57iLaFV0UQ9ZQ9XT2AmQFHJCGNDQkYCNJExebiT3G3wA1r8t187h6cTpjlHDxmw7n5ce80rUjsqN1zzNAcTCL3QF7MB7UO8k3gosoZ1wEOZ2LmfR3o58omAO0Sj/IL6DMj9tpjmBZPX5AyKLv9kw1cWe6LknJ7TVihxMZkIDg/Yzb7AwRtvTAqB2shTEWkCEyb6heda6Ja5qJScouKOla5Eq4vd887htAhYrDKi2TCGndz3d/E6t4qfQJWFiPsdjBPTUhFQXxBnqq/v9tCuYg4HVB9H749qF3KuBuQtT+PvEoGwvrkqR7xlcROPdnNCh68r4nRqZbc/37p3gvC4W9Jw1bvczh7tcaH9mF76aOAAGo4bQ4cT7rxg7RqATTT5CoYuD9u4yJavtBlZ6gXyOwSW9YgetU7kXezr+HilKxP9DcrWAWysJAtp6s3HUJXBnbfRfTGY6pWjzoes3t3Udt3gVfgkgF9vjy8eSWqy23IevOkIxUbmgsntxerm6BbGUbrDI7ZaHZX0EwLRUvQH7/GwM1fJaxwe2zX22HQfIYCz63xBbPE1agw20WpHsQC65R9/0ufV9YDrz1ewfXma26+KJqg5vZnlcecm7ZPhgxkG0kq+QA7LNEJZM9CZtMFjkgg/nPLWCCOiiku68KuQ+1+3YhyDau1LJEBUWanIN8uiHzJ5J/nu46Pp7VnoT34fCtiDrCXjAGZpIq/JFpHzkjWaXqFxbs7w7e11EHpPptFed1FYSMmwFbf11g2w X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;31:pinTltzYkkaeIlFdL7KFo/T1saGPEjceRNBA1HN0zaA7cV2JXAYrMop4CdK9/QTQ0NUO7bFDNzkwgpCdgP04qRogvDf93cy61pPq/7jDagYmoAsQ93wtTpeMhZvQ+0fCWe4iOrAdWCMh+KELLC8i9zo49kV51ByfJFX8urynmmwnvRW7k1E4aLb8g1IcCgs/DvQvBwO49ZU1mf3ReX2SW7nAEn7T+7JaIptF2SaYc7tcAkWskvLNIIUW+AinwJB76UtSSqmQ2Gxzt3oyru2pTA==;20:IcxMr8SfCSgtBDmBWjOaI/8U7UHM0Ik2BxME9WM23Lnp8LtWGhfSt34OSaua+/Rq4WXgr9rCqh2zYu0l+/ZfcmFwNSPgyFu96y7NJBd2g7j0q9YcpgfRvLf4rnWs98iHhEIEbNAX6pM3kxZAAx683WLv67g3Qv98f+soR/y5UnA=;4:i+pYmPhHcw3re3Zwii+NOww3MNJB54u4dFNJxwmixqtHF3VQq8qQqJ8N+guBi9+01oysz8R3u10bylO5qd4/DQvN2RBLYXD6Xt0qpcyr3tmjBnTDzigpaLMJ6nofxJRTHr+d7aZlr7RSMKkTLZGoDGo7gmmVN4uw52aNuYn6I/Sz2LvjLAkFJK5tGuDKJyzr45ATbfS5c2epI3pFkH0KJABS/kI/WEB2VkzlcGpc8Pglk6MINhvI2XMBejaDaX34qR0B9TgB/LyAsjBIlytLwdd9ax12Go4DWUeoN1sqgJ1oGJ5kGpkCUJK8ynLPGRT9DxpCcX6m5Qh0J/q1ficUW883ZcZ2Lt9nrg8gYBxTto/j/ThtL8kApB+Xb+jYFkJqOKSG/9aGBP/w5oaYm4rkiA== 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:MWHPR15MB1199;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1199; X-Forefront-PRVS: 0107098B6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(199003)(24454002)(46034005)(189002)(377454003)(2906002)(65806001)(2950100002)(3846002)(5660300001)(36756003)(65826007)(50986999)(586003)(86362001)(76176999)(50466002)(19580405001)(54356999)(68736007)(6116002)(305945005)(7736002)(7846002)(64126003)(230700001)(81166006)(31696002)(19580395003)(101416001)(5001770100001)(47776003)(42186005)(81156014)(97736004)(4001350100001)(8676002)(3480700004)(92566002)(77096005)(66066001)(23676002)(33646002)(65956001)(117156001)(106356001)(189998001)(83506001)(105586002)(6666003)(93886004)(107886002)(31686004)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR15MB1199;H:[192.168.1.176];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjE1TUIxMTk5OzIzOkZ3WHViMmVNOWs3bkNISzJwdE5sa1lzVnZv?= =?utf-8?B?M2l6dHNEMm1waHN5M0tNRzg3emI2Q3JtNEdiUEI4RHUwMHRza1pzVDlFZTJv?= =?utf-8?B?SmdaSWM4VG5FMUJ5eFVKNFhpblRPb1R0SCtQeVE5NVpXYW9qN2RhN1dNS2l0?= =?utf-8?B?QytUcVZyeUc3NnBSOUFPNU91WUxvSVRVb2FnK3F4RDRWWEpEdU1YWjJvOS9u?= =?utf-8?B?VkVVVXN1ZkhBdC8vMHNpck53VUtxMGdvYXpFOHpzbUI5ZDJoSWhZWmYwd013?= =?utf-8?B?RGxRd0dhSk42bm1ZYzhpVXIzaEdiOHV3cUFHTCszY3VpUGtRR0VvQjJ2VkY2?= =?utf-8?B?ck5OanZrVTduTnY1b0N5R001Zk9uNGJncExJVENTdVB0aUlGZldEVjZ4N2xk?= =?utf-8?B?YTQ5cVhqbFBrY1poRUV5VWN0WDJ3Y2tiRU1YQWtGV0JKQW80Y2dzbzlhcC91?= =?utf-8?B?SGdlVm15Qk9lQm1rZEV1K1VHNmdCdGtaLzJlVnoySTJqc2s2NnowdH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ypfGw+o0XIiwqejl6AuXkG+owQEfChOmcUh0RvZMRjMsHDQQHGaUSqbRJNeZX8FvX4Xt4e//f3SIG+GnUJTw==;24:wxSX0uTS6mBdwudGC3D87M/J/VyEFG0RBrnT66cp7XpoNP1Q4Ci1qw5VVTVX7Tpxq/cHFJzbcO206CyfecBOXF9S4qhl24sjMow/5ApK5u8=;7:j5MDafGhctBP4DEh57EvqnhIuhSf/ZvPORMtjMoLqLi9hEXAcPYbu82tCftIepN8k5PHnJoMw/wb30eYFIxM2+eep0ZK9xE0xSXQLAKWOwy9qeb6/HWDueA/CJgPMvQEFhld/xXcbx+c9eWqPCbVtwr2HcOVDGjG0nZb+ocsr2N09BeE53i6J801+o+xlfRHaYkfb5p4bqC6nnwlxXURrWtrjU9eBMAdkLYOJQX9if0pLFQwTHS2vZun/vqfsOMtZhh75v4lxJ48eWYEiVjuvSKJ7zYwP1nC9DNByHSTNrFoVtTvXCldyCp4Lpa8+GqSLGtUaRxqf43c2Rauph+hfa0GF6Fm6RiO+Q2MAemX7NE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR15MB1199;20:9PbXPq4DFk+AiWvL1Fz8/kO2gTzydnE5k1sjP46fDsP+o30MNaoZaZOSBI6XacGRpbTXkn3ZX73Rcrikdoi3v2XlS8S20C2YVaDGPJwcQwipoErcyfvRoLIVIufXrB4sfaHugslmaXt8FgeO4pLPBUX1pXY0GnVW6arMlbbi+e4= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2016 22:55:48.9928 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1199 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: 1620 Lines: 52 On 10/26/2016 04:51 PM, Linus Torvalds wrote: > On Wed, Oct 26, 2016 at 3:40 PM, Dave Jones wrote: >> >> I gave it a shot too for shits & giggles. >> This falls out during boot. >> >> [ 9.278420] WARNING: CPU: 0 PID: 1 at block/blk-mq.c:1181 blk_sq_make_request+0x465/0x4a0 > > Hmm. That's the > > WARN_ON_ONCE(rq->mq_ctx != ctx); > > that I added to blk_mq_merge_queue_io(), and I really think that > warning is valid, and the fact that it triggers shows that something > is wrong with locking. > > We just did a > > spin_lock(&ctx->lock); > > and that lock is *supposed* to protect the __blk_mq_insert_request(), > but that uses rq->mq_ctx. > > So if rq->mq_ctx != ctx, then we're locking the wrong context. > > Jens - please explain to me why I'm wrong. > > Or maybe I actually might have found the problem? In which case please > send me a patch that fixes it ;) I think you're pretty close, the two should not be different and I don't immediately see how. I'll run some testing here, should be easier with this knowledge. > 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; And just in case I can't trigger, would be interesting to add a call to blk_rq_dump_flags() as well, in case this is some special request. -- Jens Axboe