From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753490AbbJGDey (ORCPT ); Tue, 6 Oct 2015 23:34:54 -0400 Received: from imap.thunk.org ([74.207.234.97]:35739 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960AbbJGDew (ORCPT ); Tue, 6 Oct 2015 23:34:52 -0400 Date: Tue, 6 Oct 2015 23:34:48 -0400 From: "Theodore Ts'o" To: Dave Hansen Cc: Andrew Morton , Linus Torvalds , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [REGRESSION] 998ef75ddb and aio-dio-invalidate-failure w/ data=journal Message-ID: <20151007033448.GB24678@thunk.org> Mail-Followup-To: Theodore Ts'o , Dave Hansen , Andrew Morton , Linus Torvalds , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20151005152236.GA8140@thunk.org> <5612BBB3.7010201@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5612BBB3.7010201@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 05, 2015 at 11:04:35AM -0700, Dave Hansen wrote: > > The warning comes out of ext4_walk_page_buffers() and the dirty state > comes from page_zero_new_buffers(). That seems a _bit_ goofy that the > filesystem is marking the page dirty and then so shortly warning about it. Yes, this is a bug in ext4 --- and in fact in ext3, which apparently we've lived with for *years*. The problem is that when we are journalling data buffers, we can't use page_zero_new_buffers(), because instead of calling mark_buffer_dirty(bh), we need to call ext4_handle_dirty_metadata(bh). This will call mark_buffer_dirty(bh) if journalling is not enabled, or if journalling is enabled, it will call jbd2_journal_dirty_metadata(handle,bh). Apprently it is extremely rare that (copied < len) --- especially when mm/filemap.c was doing a prefault. :-) So your patch looks good, but in addition to that, if copied is > 0 and less than len, we shouldn't be calling page_zero_new_buffers(). We're going to need our own version of it that doesn't call mark_buffer_dirty(). So if Linus wants to revert 998ef75ddb patch, we can do that, but I'm also happy applying your patch as a way of preventing the failure. We'll need to do more work to make ext4_journalled_write_end(), but that's a bigger change which I'd rather not do at this point in the development cycle. Thanks again for taking a closer look at things. I'm currently running a full soak test to make sure your patch to ext4_journalled_write_end() doesn't introduce any other problems, but I'm quite confident it should be fine. Cheers, - Ted