nfs: fix the incorrect assertion in nfs_swap_rw()
Subsystems (6)
PATCH 1/1 nfs: fix the incorrect assertion in nfs_swap_rw()
From: Barry Song <[email protected]>
Since commit 2282679fb20b ("mm: submit multipage write for SWP_FS_OPS swap-space"), we can plug multiple pages then unplug them all together. That means iov_iter_count(iter) could be way bigger than PAGE_SIZE, it actually equals the size of iov_iter_npages(iter, INT_MAX).
Note this issue has nothing to do with large folios as we don't support THP_SWPOUT to non-block devices.
--- fs/nfs/direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/direct.c +1 -1
@@ -141,7 +141,7 @@ int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) {ssize_t ret; -VM_BUG_ON (iov_iter_count (iter) !=PAGE_SIZE ); +VM_WARN_ON (iov_iter_count (iter) !=iov_iter_npages (iter,INT_MAX ) *PAGE_SIZE );if (iov_iter_rw (iter) ==READ ) ret =nfs_file_direct_read (iocb, iter, true);
Signature · 1 line
2.34.1
fs/nfs/direct.c int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) · line 144
Quoted 7 lines · Barry Song
+++
b/fs/nfs/direct.cfs/nfs/direct.c +1
-1@@ -141,7 +141,7 @@ int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) {ssize_t ret; -VM_BUG_ON (iov_iter_count (iter) !=PAGE_SIZE ); +VM_WARN_ON (iov_iter_count (iter) !=iov_iter_npages (iter,INT_MAX ) *PAGE_SIZE );
Why not just delete the assertion like Christoph did?
Quoted 11 lines · Matthew Wilcox
fs/nfs/direct.c int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) · line 144
Quoted 7 lines · Barry Song
+++
b/fs/nfs/direct.cfs/nfs/direct.c +1
-1@@ -141,7 +141,7 @@ int nfs_swap_rw(struct kiocb *iocb, struct iov_iter *iter) {ssize_t ret; -VM_BUG_ON (iov_iter_count (iter) !=PAGE_SIZE ); +VM_WARN_ON (iov_iter_count (iter) !=iov_iter_npages (iter,INT_MAX ) *PAGE_SIZE );Why not just delete the assertion like Christoph did?
I'm fine with either option. While maintaining this, my thought at the time was that I might
want to reassess this assertion once mTHP swapout is supported on swapfiles later.