Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596500

Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error on any fsync or close

From Ross Zwisler <ross.zwisler@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error on any fsync or close
Date 2017-03-10 01:10 +0100
Message-ID <tjgi6-45M-11@gated-at.bofh.it> (permalink)
References <tiMN3-GJ-3@gated-at.bofh.it> <tiMWJ-Kk-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Mar 08, 2017 at 11:29:28AM -0500, Jeff Layton wrote:
> Currently we don't clear the address space error when there is a -EIO
> error on fsynci, due to writeback initiation failure. If writes fail
	   fsync

> with -EIO and the mapping is flagged with an AS_EIO or AS_ENOSPC error,
> then we can end up returning errors on two fsync calls, even when a
> write between them succeeded (or there was no write).
> 
> Ensure that we also clear out any mapping errors when initiating
> writeback fails with -EIO in filemap_write_and_wait and
> filemap_write_and_wait_range.
> 
> Suggested-by: Jan Kara <jack@suse.cz>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  mm/filemap.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 1694623a6289..fc123b9833e1 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -488,7 +488,7 @@ EXPORT_SYMBOL(filemap_fdatawait);
>  
>  int filemap_write_and_wait(struct address_space *mapping)
>  {
> -	int err = 0;
> +	int err;
>  
>  	if ((!dax_mapping(mapping) && mapping->nrpages) ||
>  	    (dax_mapping(mapping) && mapping->nrexceptional)) {
> @@ -499,10 +499,18 @@ int filemap_write_and_wait(struct address_space *mapping)
>  		 * But the -EIO is special case, it may indicate the worst
>  		 * thing (e.g. bug) happened, so we avoid waiting for it.
>  		 */
> -		if (err != -EIO) {
> +		if (likely(err != -EIO)) {

The above two cleanup changes were made only to filemap_write_and_wait(), but
should also probably be done to filemap_write_and_wait_range() to keep them as
consistent as possible?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 3/9] mm: clear any AS_* errors when returning error on any fsync or close Jeff Layton <jlayton@redhat.com> - 2017-03-08 17:50 +0100
  Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error on any fsync or close NeilBrown <neilb@suse.com> - 2017-03-09 00:20 +0100
    Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error  on any fsync or close Jeff Layton <jlayton@redhat.com> - 2017-03-09 01:20 +0100
  Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error on  any fsync or close Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-03-10 01:10 +0100
    Re: [PATCH v2 3/9] mm: clear any AS_* errors when returning error  on any fsync or close Jeff Layton <jlayton@redhat.com> - 2017-03-10 04:10 +0100

csiph-web