[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YW8OMsrEzrY8aSxo@casper.infradead.org>
Date: Tue, 19 Oct 2021 19:28:02 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Howells <dhowells@...hat.com>
Cc: linux-cachefs@...hat.com,
Kent Overstreet <kent.overstreet@...il.com>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
Trond Myklebust <trondmy@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Steve French <sfrench@...ba.org>,
Dominique Martinet <asmadeus@...ewreck.org>,
Jeff Layton <jlayton@...hat.com>,
Alexander Viro <viro@...iv.linux.org.uk>,
Omar Sandoval <osandov@...ndov.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-afs@...ts.infradead.org, linux-nfs@...r.kernel.org,
linux-cifs@...r.kernel.org, ceph-devel@...r.kernel.org,
v9fs-developer@...ts.sourceforge.net, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/67] mm: Stop filemap_read() from grabbing a
superfluous page
On Mon, Oct 18, 2021 at 03:50:32PM +0100, David Howells wrote:
> @@ -2625,6 +2625,10 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter,
> if ((iocb->ki_flags & IOCB_WAITQ) && already_read)
> iocb->ki_flags |= IOCB_NOWAIT;
>
> + isize = i_size_read(inode);
> + if (unlikely(iocb->ki_pos >= isize))
> + goto put_pages;
> +
Is there a good reason to assign to isize here? I'd rather not,
because it complicates analysis, and a later change might look at
the isize read here, not realising it was a racy use. So I'd
rather see:
if (unlikely(iocb->ki_pos >= i_size_read(inode)))
goto put_pages;
Powered by blists - more mailing lists