Skip to content

Commit dbad9ce

Browse files
committed
Merge tag 'afs-fixes-20230719' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull AFS writeback fixes from David Howells: - release the acquired batch before returning if we got >=5 skips - retry a page we had to wait for rather than skipping over it after the wait * tag 'afs-fixes-20230719' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: afs: Fix waiting for writeback then skipping folio afs: Fix dangling folio ref counts in writeback
2 parents 45a3e24 + 819da02 commit dbad9ce

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/afs/write.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ static int afs_writepages_region(struct address_space *mapping,
731731
* (changing page->mapping to NULL), or even swizzled
732732
* back from swapper_space to tmpfs file mapping
733733
*/
734+
try_again:
734735
if (wbc->sync_mode != WB_SYNC_NONE) {
735736
ret = folio_lock_killable(folio);
736737
if (ret < 0) {
@@ -757,12 +758,14 @@ static int afs_writepages_region(struct address_space *mapping,
757758
#ifdef CONFIG_AFS_FSCACHE
758759
folio_wait_fscache(folio);
759760
#endif
760-
} else {
761-
start += folio_size(folio);
761+
goto try_again;
762762
}
763+
764+
start += folio_size(folio);
763765
if (wbc->sync_mode == WB_SYNC_NONE) {
764766
if (skips >= 5 || need_resched()) {
765767
*_next = start;
768+
folio_batch_release(&fbatch);
766769
_leave(" = 0 [%llx]", *_next);
767770
return 0;
768771
}

0 commit comments

Comments
 (0)