Thread (13 messages) 13 messages, 7 authors, 2021-10-22

Re: [PATCH 01/67] mm: Stop filemap_read() from grabbing a superfluous page

From: Matthew Wilcox <willy@infradead.org>
Date: 2021-10-19 20:08:28
Also in: ceph-devel, linux-cifs, linux-fsdevel, linux-nfs, lkml

On Tue, Oct 19, 2021 at 07:48:15PM +0100, David Howells wrote:
Matthew Wilcox [off-list ref] wrote:
quoted
quoted
+		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 we don't set isize, the loop will never end.  Actually, maybe we can just
break out at that point rather than going to put_pages.
Umm, yes, of course.  Sorry.

It makes more sense to just break because we haven't got any pages,
so putting pages that we haven't got seems unnecessary.
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help