From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965084AbbJIIuT (ORCPT ); Fri, 9 Oct 2015 04:50:19 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:38195 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933722AbbJIIuO (ORCPT ); Fri, 9 Oct 2015 04:50:14 -0400 Subject: Re: [RFC PATCH 1/2] ext4: Fix possible deadlock with local interrupts disabled and page-draining IPI To: Gilad Ben-Yossef References: <1444318308-27560-1-git-send-email-kernel@kyup.com> Cc: mm@1h.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, adilger.kernel@dilger.ca, linux-kernel@vger.kernel.org, operations@siteground.com, tytso@mit.edu From: Nikolay Borisov Message-ID: <56177FC3.4050506@kyup.com> Date: Fri, 9 Oct 2015 11:50:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09/2015 11:41 AM, Gilad Ben-Yossef wrote: > On Oct 8, 2015 18:31, "Nikolay Borisov" wrote: >> >> Currently when bios are being finished in ext4_finish_bio this is done by >> first disabling interrupts and then acquiring a bit_spin_lock. > ... >> >> To fix the situation this patch changes the order in which the >> bit_spin_lock and interrupts disabling occcurs. The exepected >> effect is that even if a core is spinning on the bitlock it will >> have its interrupts enabled, thus being able to respond to IPIs. > > Are you sure this spin lock is never taken from interrupt context? Good point. I think indeed this fix is wrong as this lock is actually taken from soft irq context as evident from this thread, which prompted me to write the patch in the first place: http://permalink.gmane.org/gmane.linux.kernel/2056730 > If it does an interrupt occurring after the lock is taken and before > interrupts are disabled can deadlock . > > Gilad >