linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Menzel <pmenzel@molgen.mpg.de>
To: Christoph Hellwig <hch@lst.de>,
	Markus Stockhausen <stockhausen@collogia.de>
Cc: Dave Chinner <david@fromorbit.com>,
	"it+linux-nfs@molgen.mpg.de" <it+linux-nfs@molgen.mpg.de>,
	Brian Foster <bfoster@redhat.com>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Jeff Layton <jlayton@poochiereds.net>
Subject: Re: Locking problems with Linux 4.9 and 4.11 with NFSD and `fs/iomap.c`
Date: Fri, 11 Aug 2017 17:14:15 +0200	[thread overview]
Message-ID: <1853b5d0-891c-6cdd-7270-a2eaedc4072e@molgen.mpg.de> (raw)
In-Reply-To: <20170811101513.GA11531@lst.de>

Dear Christoph, dear Markus,


On 08/11/17 12:15, Christoph Hellwig wrote:
> On Thu, Aug 10, 2017 at 07:54:51PM +0000, Markus Stockhausen wrote:
>> Lets say you are trying to zero multiple of 4GB chunks. With bytes
>> evaluated towards 0 this will hit an endless loop within that iomap
>> function. That might explain your observation. If that is right a bugfix
>> would qualify for stable 4.8+
> 
> Yes, it seems like min_t casts arguments 2 and 3 to the type in argument
> 1, which could lead to incorrect truncation.
> 
> Paul, please try the patch below:
> 
> diff --git a/fs/iomap.c b/fs/iomap.c
> index 039266128b7f..59cc98ad7577 100644
> --- a/fs/iomap.c
> +++ b/fs/iomap.c
> @@ -278,7 +278,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>   		unsigned long bytes;	/* Bytes to write to page */
>   
>   		offset = (pos & (PAGE_SIZE - 1));
> -		bytes = min_t(unsigned long, PAGE_SIZE - offset, length);
> +		bytes = min_t(loff_t, PAGE_SIZE - offset, length);
>   
>   		rpage = __iomap_read_page(inode, pos);
>   		if (IS_ERR(rpage))
> @@ -373,7 +373,7 @@ iomap_zero_range_actor(struct inode *inode, loff_t pos, loff_t count,
>   		unsigned offset, bytes;
>   
>   		offset = pos & (PAGE_SIZE - 1); /* Within page */
> -		bytes = min_t(unsigned, PAGE_SIZE - offset, count);
> +		bytes = min_t(loff_t, PAGE_SIZE - offset, count);
>   
>   		if (IS_DAX(inode))
>   			status = iomap_dax_zero(pos, offset, bytes, iomap);

I applied this on top of Linux 4.9.41. Even when writing 40 100 GB in 
parallel on an NFS exported directory from different systems, and 
keeping the load high on the system, the NFS exported directory was 
always accessible from all hosts.

Markus, thank you very much for looking into this and spotting the bug. 
A bug thank you to all people helping to analyze this issue.

I’ll keep you posted, but until know.

Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

  reply	other threads:[~2017-08-11 15:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07 19:09 Locking problems with Linux 4.9 with NFSD and `fs/iomap.c` Paul Menzel
2017-05-08 13:18 ` Brian Foster
2017-05-09  9:05   ` Christoph Hellwig
     [not found]     ` <7ae18b0d-38e3-9b12-0989-ede68956ad43@molgen.mpg.de>
     [not found]       ` <358037e8-6784-ebca-9fbb-ec7eef3977d6@molgen.mpg.de>
     [not found]         ` <20170510171757.GA10534@localhost.localdomain>
2017-06-27 11:59           ` Locking problems with Linux 4.9 and 4.11 " Paul Menzel
2017-06-28 16:41             ` Christoph Hellwig
2017-08-01 17:49             ` Paul Menzel
2017-08-01 22:51               ` Dave Chinner
2017-08-10 14:11                 ` Paul Menzel
2017-08-10 19:54                   ` AW: " Markus Stockhausen
2017-08-11 10:15                     ` Christoph Hellwig
2017-08-11 15:14                       ` Paul Menzel [this message]
2017-05-10  9:08   ` Locking problems with Linux 4.9 " Paul Menzel
2017-05-10 17:23     ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1853b5d0-891c-6cdd-7270-a2eaedc4072e@molgen.mpg.de \
    --to=pmenzel@molgen.mpg.de \
    --cc=bfields@fieldses.org \
    --cc=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=it+linux-nfs@molgen.mpg.de \
    --cc=jlayton@poochiereds.net \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stockhausen@collogia.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).