Message ID | x49fu5rtnzs.fsf@segfault.boston.devel.redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fri 23-02-18 16:06:15, Jeff Moyer wrote: > Prior to commit d47992f86b307 ("mm: change invalidatepage prototype to > accept length"), an offset of 0 meant that the full page was being > invalidated. After that commit, we need to instead check the length. > > Fixes: d47992f86b307 ("mm: change invalidatepage prototype to accept length") > Signed-off-by: Jeff Moyer <jmoyer@redhat.com> > > --- > Note that I found this via code inspection. I'm not sure if this causes > issues in the wild. The only possible issue is that try_to_release_page() was called more often than necessary. Otherwise the issue is harmless but still it's good to have this fixed. The patch looks good. You can add: Reviewed-by: Jan Kara <jack@suse.cz> Honza > > diff --git a/fs/buffer.c b/fs/buffer.c > index 9a73924db22f..6b98609356ed 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -1511,7 +1511,7 @@ void block_invalidatepage(struct page *page, unsigned int offset, > * The get_block cached value has been unconditionally invalidated, > * so real IO is not possible anymore. > */ > - if (offset == 0) > + if (length == PAGE_SIZE) > try_to_release_page(page, 0); > out: > return;
diff --git a/fs/buffer.c b/fs/buffer.c index 9a73924db22f..6b98609356ed 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1511,7 +1511,7 @@ void block_invalidatepage(struct page *page, unsigned int offset, * The get_block cached value has been unconditionally invalidated, * so real IO is not possible anymore. */ - if (offset == 0) + if (length == PAGE_SIZE) try_to_release_page(page, 0); out: return;
Prior to commit d47992f86b307 ("mm: change invalidatepage prototype to accept length"), an offset of 0 meant that the full page was being invalidated. After that commit, we need to instead check the length. Fixes: d47992f86b307 ("mm: change invalidatepage prototype to accept length") Signed-off-by: Jeff Moyer <jmoyer@redhat.com> --- Note that I found this via code inspection. I'm not sure if this causes issues in the wild.