nfs: do not extend writes to the entire folio

JIRA: https://issues.redhat.com/browse/RHEL-59704

commit 39c910a430370fd25d5b5e4b2f4b24581a705499
Author: Christoph Hellwig <hch@lst.de>
Date:   Fri Jul 5 07:42:51 2024 +0200

    nfs: do not extend writes to the entire folio

    nfs_update_folio has code to extend a write to the entire page under
    certain conditions.  With the support for large folios this now
    suddenly extents to the variable sized and potentially much larger folio.
    Add code to limit the extension to the page boundaries of the start and
    end of the write, which matches the historic expecation and the code
    comments.

    Fixes: b73fe2dd6cd5 ("nfs: add support for large folios")
    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
    Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
This commit is contained in:
Scott Mayhew 2024-09-23 16:32:14 -04:00
parent 5244ac5b7b
commit 6500833cf7
1 changed files with 6 additions and 2 deletions

View File

@ -1350,8 +1350,12 @@ int nfs_update_folio(struct file *file, struct folio *folio,
goto out;
if (nfs_can_extend_write(file, folio, pagelen)) {
count = max(count + offset, pagelen);
offset = 0;
unsigned int end = count + offset;
offset = round_down(offset, PAGE_SIZE);
if (end < pagelen)
end = min(round_up(end, PAGE_SIZE), pagelen);
count = end - offset;
}
status = nfs_writepage_setup(ctx, folio, offset, count);