Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753794AbdCOVfE (ORCPT ); Wed, 15 Mar 2017 17:35:04 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:42026 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbdCOVe6 (ORCPT ); Wed, 15 Mar 2017 17:34:58 -0400 X-IronPort-AV: E=Sophos;i="5.36,170,1486396800"; d="scan'208";a="3478835" Authentication-Results: spf=pass (sender IP is 74.221.232.54) smtp.mailfrom=sandisk.com; fb.com; dkim=none (message not signed) header.d=none;fb.com; dmarc=bestguesspass action=none header.from=sandisk.com; X-AuditID: ac1c2133-99bff7000000c960-a3-58c9b37a658b From: Bart Van Assche To: "tom.leiming@gmail.com" CC: "linux-kernel@vger.kernel.org" , "hch@infradead.org" , "linux-block@vger.kernel.org" , "yizhan@redhat.com" , "axboe@fb.com" , "stable@vger.kernel.org" Subject: Re: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler Thread-Topic: [PATCH 1/2] blk-mq: don't complete un-started request in timeout handler Thread-Index: AQHSndP5nrP9VfihQ0yRs+by05ZnAA== Date: Wed, 15 Mar 2017 21:34:50 +0000 Message-ID: <1489613676.2660.8.camel@sandisk.com> References: <1489064578-17305-1-git-send-email-tom.leiming@gmail.com> <1489064578-17305-3-git-send-email-tom.leiming@gmail.com> <1489536441.2676.21.camel@sandisk.com> <20170315121851.GA15807@ming.t460p> In-Reply-To: <20170315121851.GA15807@ming.t460p> Accept-Language: en-US, nl-NL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.28.1.254] Content-Type: text/plain; charset="iso-8859-1" Content-ID: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsWyRobxn27d5pMRBpNdLP7vOcZmcXrCIiaL vbe0LS7vmsNmsWDjI0aL9z+us1tsuXKXzYHdY2LzO3aPnbPusntsXqHl8X7fVTaPz5vkAlij uGxSUnMyy1KL9O0SuDJad7xlL7jIXdG98DtrA+M6zi5GTg4JAROJf127mLoYuTiEBJYwSaxd towZwrnEKPHx4RwWkCo2ASOJ2RP2gNkiAsYSn14/YwQpYhZYxSRx43cjK0hCWCBc4lX7DUaI ogiJ9z//s0LYehIrz88Ca2YRUJVoXH2WDcTmFTCUWPZtMwvEtguMEt/+fGMGSXAKGEgs3nwZ rIFRQFZi8fQWJhCbWUBc4taT+UwQdwtILNlznhnCFpV4+fgfK4StIPF5xT82iHo9iRtTp0DZ VhI3Wk6yQNjaEssWvmaGOEJQ4uTMJywTGMVmIVkxC0n7LCTts5C0z0LSvoCRdRWjWHFicnFu emqBoYlecWJeSmZxtl5yfu4mRnCcKhrvYPy3wf0QowAHoxIP7wTfkxFCrIllxZW5hxglOJiV RHjzVwGFeFMSK6tSi/Lji0pzUosPMUpzsCiJ88bMnhohJJCeWJKanZpakFoEk2Xi4JRqYJQQ /DxHJOHeQYs1crIh/H5T7mas39or6P7rWd98rsI9e/J55r6St79bX9h7QKRxv7d84TnjVtZi uw8Pc5kXPzRe/nHuKsWFanfX+O1LfMmWGdMdohX3e2rZisq9LKFNtXIqi8y1BHLC5nnN/LGT 99DWnM8HK5TvffoiEnzQtN5C59NKd1ubEiWW4oxEQy3mouJEAOiop8rPAgAA X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:74.221.232.54;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(39860400002)(39410400002)(39850400002)(39840400002)(39450400003)(2980300002)(438002)(377424004)(199003)(189002)(24454002)(9170700003)(33646002)(54906002)(53936002)(4326008)(110136004)(3846002)(8676002)(93886004)(2906002)(86362001)(305945005)(2501003)(36756003)(5640700003)(8746002)(81166006)(39060400002)(6116002)(102836003)(38730400002)(8936002)(2950100002)(2900100001)(6916009)(103116003)(7736002)(106466001)(6246003)(2351001)(5660300001)(76176999)(50986999)(189998001)(54356999)(23756003)(47776003)(229853002)(50466002)(356003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0401MB1497;H:sacsmgep14.sandisk.com;FPR:;SPF:Pass;MLV:ovrnspm;A:1;MX:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN3NAM04FT011;1:R3SQ6N+W9FbPK5z6m1P7p9QZ9cSUBjrFnOXHoyXgMkboc7jU+5soo+IRowgV3Ad7ob920js1nM8A2c6QzePP2WkX3Q4LVUW9vpXMti3eJj7OjIwIpsHLna2fdFPdiPYF2EFYJI6MAb7qXyt9cZirLAJDHYvND8BIdIjaNu6krnI2mPvII5jY77gU0vxE6KoLCZyZVk14QGjVX3g9ZPL6QWPmiLCk+wOiH08ITnGQiiK/fhm0mx/OiWaRw+PgxYP8cNABTW1Rp4iAHenF88iGP6TvsCky9Tc5FFknXzbcGogUSFcLU6EoizDDGsBkTrCdN39VdA5dV4lBNgLoc9Kbvqso6KYhi98nvcCEenup66WBJvWN3Bom/MQjgiOnXwGorLZeYAjKP3uC4UnCtwvIc30+PaCL+l/IGewM5t0td/ef1jeiaxg6GA3UbLgrx4hnZNgeX5SGniqMUopHnS1dFXp6Zc84+09Jek4ARzr+AAw3Oh/3xlkUXZdHSx1qW16e9AgSgO8uK/d/eLZU3i+nUS8aKo4E/KPj6SR8qW0uoPCVFlENvF+elXDdigZc88kG X-MS-Office365-Filtering-Correlation-Id: d43ed670-9cbb-4c6f-8913-08d46beb1f26 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:BY1PR0401MB1497; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0401MB1497;3:LoRAHvyshJSUKDivoVqnls/jFdelchhdL3FeZMH0wm7FfiAyY7oPWX+6wS3B8Sv9lKxi/+RajYdb+TwnAjHxFgpIgXAAz5QrezJyEF3AWU5So/MDlXK17gpkUqMC97fpv/oc8a2AXABj7NF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gTa1SK4Rfo2pBXu5PRJuHLX7h/2SUimVLPuJa6fHCPMgMSns6Hh6gXPtZQ+0I8mvN9G7NPu9whewaBNTDuRfn79X92LC/dPbE9M5K2aFZeDMjNotEbyzGnKa/qq2f7c+SYwHGUonBFaINfXBLexopJd8nxzfohMM483GaCtviETcd73mtjGnaVDEBRCJFDrfO+Gtpd9mI2WhuinI7HmCc7e60IjGkQkhl1aON/+JjjyQEBXsbL6rG18RFkuRq2Ht3sArn7jDmyJKuQszfWmLEgMhXdf4Y28Xqf5i3BJSQW/JiNXWsoyo2Jp/uB7cZ+edL+lAGGcVc8vYrCEpTPo/3bXpS+iKIqOAhwvD1fKnl09X68f9TTijfzQ/o6kOqBzTMKugejNI8s+0WglHcqlemMBmQ48vOg+gmNH0lqqUmUx1wK7fk6HzwrGcvmwh9R/6xfv90wpixhRghx0L0zlmN WDCIPOUTBOUND: EOP-TRUE X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13023025)(13018025)(13024025)(13016025)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148);SRVR:BY1PR0401MB1497;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0401MB1497; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0401MB1497;4:IeFHl0tbUQIWqjGaBuNf9UOpiiACIXqGfFn1SKxkE3OUXunOzkFNbk8j8B1ej38knJHOssbp5TlDJO3rRG8Y02vp5JljvuVC1yLhFAOlOQ/8VuStqFsdAPP+Lbya2faPfydu6WofM+W+cEg6esvYdgkurylP3Cayt292uxtDkY6jRln6DxHdSAoZYQ6CumhhTBweQp41a1O6zlx0EFotenrEPgq4D/bnVyNxVXvOA8zNpml1RKcrbUcw3susn8zCuFMsDlMiWWPWBQIltQkv5VDq+U9ta+dke6gdHRt1T/bcMB4gXukz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IaTtLkKSfo22fCyu?= =?iso-8859-1?Q?a0N37p5zn3jBWvGTe4XbOHGSJYUU0H8Ufn90fFIhZXHXpXixRRN/05+OkV?= =?iso-8859-1?Q?o1DyZKMDFJV4g1XP3vJQgmjW7w+3Ah3e1GnNQP+aJV+aDgacLhWrRddKbI?= =?iso-8859-1?Q?ZrOizoM377QHta3XZDGuyU3Xcwmv4YX6OuT0qTsHGHfawBY8VBXvKqZNrD?= =?iso-8859-1?Q?HfEEkJdJP1oyY84+UoaqlPm4L20bk2AmSEeYs9dmSc1987r8J61ewMnBls?= =?iso-8859-1?Q?21T/DXra7ZSYtaXe/r4lbNMztqhEYb1aT5egyT8ZLUC8Arl+SbM81XQHFM?= =?iso-8859-1?Q?1arsMj2Pj6uDnZRPiUgMEelkkxWyw5Yj5IVD3DfXhhg8KI66wIrHzgn++D?= =?iso-8859-1?Q?S4sVepadhYQLbTN9teNcIsAgwoFCxrCtqc+rWoU5XlZgMuKDzekLHGEklj?= =?iso-8859-1?Q?fTA5ChXp9K5xUNrZQyupl3vWonCzIixTwj5+rZmXNszKRDpMPXCekJv/nu?= =?iso-8859-1?Q?XDdDxRw7Gvh3qgq31Phnv88/SIOb2bVjS963gJVl2+uN0QJsCmUe3pceWo?= =?iso-8859-1?Q?k3BK7k1FhiKuLJug1DkyYdhsRlTn7zyzxEMfCzvxGzwZv37BbKgz7PFlFB?= =?iso-8859-1?Q?0gInThFdAVXNhJo/c8QfRGrMaDmFiOcw7SZbsZ6JCQ11EZDrJh/7h+t1vn?= =?iso-8859-1?Q?KQDphNc7PB0trKYl3QlzlztswunRlGQTVGQ7eUPtmPWWgngaLXi+lIzufq?= =?iso-8859-1?Q?s7vaja/ute/Q+gebv6MJHJeQ4amXA1wGV1FtLywvuwLjo+lyr5dCjEpZHr?= =?iso-8859-1?Q?2zMb0yOTBEDaO2Lh32Ovwg7MR?= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0401MB1497;6:y+W1Gj+Viz1Hc257YpQ0Bxp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KB/00mgtvg==;20:BUg5fDxzbGA//OlflLUjIfVn/ArhbT3qrlDq1NemyweiCbeH0ihwKwHTxI83OUg6YgSHxH+dVIEIWy7g2Zx4kJv3eqL3CWWSLWpU5YfxJoATaagSfuWeFpkc19HtmB0cVZq1E1XezuvcBvv8Me12fhomtYiK8JW9pIQjVU8klNA= X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2017 21:34:54.3313 (UTC) X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=b61c8803-16f3-4c35-9b17-6f65f441df86;Ip=[74.221.232.54];Helo=[sacsmgep14.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0401MB1497 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v2FLZPfA026143 Content-Length: 1412 Lines: 37 On Wed, 2017-03-15 at 20:18 +0800, Ming Lei wrote: > On Wed, Mar 15, 2017 at 12:07:37AM +0000, Bart Van Assche wrote: > > Both the old and the new check look racy to me. The REQ_ATOM_STARTED bit can > > be changed concurrently by blk_mq_start_request(), __blk_mq_finish_request() > > blk_mq_start_request() and __blk_mq_finish_request() won't be run concurrently. > > From view of __blk_mq_finish_request(): > > - if it is run from merge queue io path(blk_mq_merge_queue_io()), > blk_mq_start_request() can't be run at all, and the COMPLETE flag > is kept as previous value(zero) > > - if it is run from normal complete path, COMPLETE flag is cleared > before the req/tag is released to tag set. > > so there isn't race in blk_mq_start_request() vs. __blk_mq_finish_request() > wrt. timeout. > > > or __blk_mq_requeue_request(). Another issue with this function is that the > > __blk_mq_requeue_request() can be run from two pathes: > > - dispatch failure, in which case the req/tag isn't released to tag set > > - IO completion path, in which COMPLETE flag is cleared before requeue. > > so I can't see races with timeout in case of start rq vs. requeue rq. > > > request passed to this function can be reinitialized concurrently. Hello Ming, You misinterpret what I wrote. I was referring to manipulation of REQ_ATOM_STARTED from different contexts and not to what you explained. Bart.