Message ID | 20240617220135.43563-1-21cnbao@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | nfs: fix the incorrect assertion in nfs_swap_rw() | expand |
On Tue, Jun 18, 2024 at 10:01:35AM +1200, Barry Song wrote: > +++ b/fs/nfs/direct.c > @@ -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?
On Tue, Jun 18, 2024 at 11:17 AM Matthew Wilcox <willy@infradead.org> wrote: > > On Tue, Jun 18, 2024 at 10:01:35AM +1200, Barry Song wrote: > > +++ b/fs/nfs/direct.c > > @@ -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.
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index bb2f583eb28b..a1bfa86f467a 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -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);