]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
afs: Handle len being extending over page end in write_begin/write_end
authorDavid Howells <dhowells@redhat.com>
Mon, 14 Jun 2021 12:48:02 +0000 (13:48 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 21:23:49 +0000 (21:23 +0000)
commit77043b4ce159a2b83c3ce9d0db63538991dc0add
tree4c1cc3dbcda29371e6fb1c2ccb4bd6dce6fcf3e6
parentfb8e5be0a2a3d1e58e2e8e791dd9448ce7b71ba6
afs: Handle len being extending over page end in write_begin/write_end

With transparent huge pages, in the future, write_begin() and write_end()
may be passed a length parameter that, in combination with the offset into
the page, exceeds the length of that page.  This allows
grab_cache_page_write_begin() to better choose the size of THP to allocate.

Fix afs's functions to handle this by trimming the length as needed after
the page has been allocated.

[Removed the now-unnecessary index var; spotted by kernel test robot]

Fixes: e1b1240c1ff5 ("netfs: Add write_begin helper")
Reported-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Jeff Layton <jlayton@kernel.org>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/162367681795.460125.11729955608839747375.stgit@warthog.procyon.org.uk/
fs/afs/write.c