Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1393933ybk; Thu, 14 May 2020 07:58:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCO6vO0Q+opHLSTCcrfDH5OhgBciKqWUQLmqT/r7mGBPGxt03NiU2gvy3+MWAIEYdVNfSE X-Received: by 2002:aa7:dc48:: with SMTP id g8mr4307461edu.33.1589468330951; Thu, 14 May 2020 07:58:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589468330; cv=none; d=google.com; s=arc-20160816; b=VTSzpuhwNjGEAGBDghUAL5fk4Pbe1qN/7Hpj+ZKl4soLAXHCg+Ey80Vf56ElcXTs33 7tXkeTTiFcaQYUNNwVFtW+kTHX32XIVzXW5B7eY37zDpJ5ZrmR1r4jUd8H666ATCxqki 0+QdKPqo//JM5WbF9v8mbT0G5+/ECz2BlqVTOZ4KZvN19Pmgyi3+dKiLdn2CR+YQaZt5 bCYiOIo9KhkkZwDug8si+pqrJdN9B7LIqVsC/bkOP8UIzAr/JlzfLCM0D/VScQ0zw+AY ozjD9lQzTgrr2+4xxZAL1cFZvbTbtmYXefmvji52iLNE4j7lXtV50lfgce85CTlYtCgE 99lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=OmEuYbUS33uOdA1nJEzh08qZDEyDtq0IjU6ObIlgoUw=; b=i3W6tKaSyE/jx52FguZTBx37ElDjTEaJqTg7CzoN43lOUc1h8XGeuiJ2DobknBTsaV d1qh4koy7EkPHsqYRvSSgWIqIF4F/oGTS8M8obNsABbni/Yv0HM3uBS5RA0I4nUwDqMo vuI89X6nzLz2mBBahPFRTa7ShnRH5X69+pordYUHDXSZSJ1WWTf4ARpPI7f+QAUIKAjS NtqtiUhjFBDPBMXdntimghGYWlV93MWFtj+C8+wdgmolZPOeDFKgItrtHiBTlzWziLQo 1Utv/UdheX8LiFVWS5mjEXQsihWQxQpdPApOLU0Hltx54dQssQoatKFWAvIQlWCj4lY+ 72ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gl22si2167906ejb.297.2020.05.14.07.58.28; Thu, 14 May 2020 07:58:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727834AbgENO5u (ORCPT + 99 others); Thu, 14 May 2020 10:57:50 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:59709 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726179AbgENO5u (ORCPT ); Thu, 14 May 2020 10:57:50 -0400 Received: from callcc.thunk.org (pool-100-0-195-244.bstnma.fios.verizon.net [100.0.195.244]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 04EEvi0s008963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 May 2020 10:57:44 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 37502420304; Thu, 14 May 2020 10:57:44 -0400 (EDT) Date: Thu, 14 May 2020 10:57:44 -0400 From: "Theodore Y. Ts'o" To: Jan Kara Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Eric Sandeen Subject: Re: [PATCH 3/3] ext4: Avoid freeing inodes on dirty list Message-ID: <20200514145744.GW1596452@mit.edu> References: <20200421085445.5731-1-jack@suse.cz> <20200421085445.5731-4-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421085445.5731-4-jack@suse.cz> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Apr 21, 2020 at 10:54:45AM +0200, Jan Kara wrote: > When we are evicting inode with journalled data, we may race with > transaction commit in the following way: > > CPU0 CPU1 > jbd2_journal_commit_transaction() evict(inode) > inode_io_list_del() > inode_wait_for_writeback() > process BJ_Forget list > __jbd2_journal_insert_checkpoint() > __jbd2_journal_refile_buffer() > __jbd2_journal_unfile_buffer() > if (test_clear_buffer_jbddirty(bh)) > mark_buffer_dirty(bh) > __mark_inode_dirty(inode) > ext4_evict_inode(inode) > frees the inode > > This results in use-after-free issues in the writeback code (or > the assertion added in the previous commit triggering). > > Fix the problem by removing inode from writeback lists once all the page > cache is evicted and so inode cannot be added to writeback lists again. > > Signed-off-by: Jan Kara Applied, thanks. - Ted