Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754195AbdCHSra (ORCPT ); Wed, 8 Mar 2017 13:47:30 -0500 Received: from mail-qk0-f175.google.com ([209.85.220.175]:36406 "EHLO mail-qk0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754178AbdCHSr2 (ORCPT ); Wed, 8 Mar 2017 13:47:28 -0500 Message-ID: <1488998288.2802.25.camel@redhat.com> Subject: Re: [PATCH v2 6/9] mm: set mapping error when launder_pages fails From: Jeff Layton To: Trond Myklebust , "viro@zeniv.linux.org.uk" , "akpm@linux-foundation.org" Cc: "linux-nilfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "konishi.ryusuke@lab.ntt.co.jp" , "neilb@suse.com" , "linux-mm@kvack.org" , "adilger@dilger.ca" , "James.Bottomley@HansenPartnership.com" , "linux-fsdevel@vger.kernel.org" , "ross.zwisler@linux.intel.com" , "openosd@gmail.com" , "jack@suse.cz" Date: Wed, 08 Mar 2017 13:38:08 -0500 In-Reply-To: <1488996103.3098.4.camel@primarydata.com> References: <20170308162934.21989-1-jlayton@redhat.com> <20170308162934.21989-7-jlayton@redhat.com> <1488996103.3098.4.camel@primarydata.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.5 (3.22.5-1.fc25) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1958 Lines: 55 On Wed, 2017-03-08 at 18:01 +0000, Trond Myklebust wrote: > On Wed, 2017-03-08 at 11:29 -0500, Jeff Layton wrote: > > If launder_page fails, then we hit a problem writing back some inode > > data. Ensure that we communicate that fact in a subsequent fsync > > since > > another task could still have it open for write. > > > > Signed-off-by: Jeff Layton > > --- > >  mm/truncate.c | 6 +++++- > >  1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/mm/truncate.c b/mm/truncate.c > > index 6263affdef88..29ae420a5bf9 100644 > > --- a/mm/truncate.c > > +++ b/mm/truncate.c > > @@ -594,11 +594,15 @@ invalidate_complete_page2(struct address_space > > *mapping, struct page *page) > >   > >  static int do_launder_page(struct address_space *mapping, struct > > page *page) > >  { > > + int ret; > > + > >   if (!PageDirty(page)) > >   return 0; > >   if (page->mapping != mapping || mapping->a_ops->launder_page > > == NULL) > >   return 0; > > - return mapping->a_ops->launder_page(page); > > + ret = mapping->a_ops->launder_page(page); > > + mapping_set_error(mapping, ret); > > + return ret; > >  } > >   > >  /** > > No. At that layer, you don't know that this is a page error. In the NFS > case, it could, for instance, just as well be a fatal signal. > Ok...don't we have the same problem with writepage then? Most of the writepage callers will set an error in the mapping if writepage returns any sort of error? A fatal signal in that codepath could cause the same problem, it seems. We don't dip into direct reclaim so much anymore, so maybe signals aren't an issue there? The alternative here would be to push this down into the callers. I worry a bit though about getting this right across filesystems though. It'd be preferable it if we could keep the mapping_set_error call in generic VFS code instead, but if not then I'll just plan to do that. Thanks, -- Jeff Layton