Re: [RFC PATCH v2 1/5] nfs: Fix write to swapfile failure due to generic_write_checks()

From: Christoph Hellwig
Date: Fri Aug 13 2021 - 03:02:39 EST


On Fri, Aug 13, 2021 at 04:09:39AM +0100, Matthew Wilcox wrote:
> On Thu, Aug 12, 2021 at 09:22:06PM +0100, David Howells wrote:
> > Trying to use a swapfile on NFS results in every DIO write failing with
> > ETXTBSY because generic_write_checks(), as called by nfs_direct_write()
> > from nfs_direct_IO(), forbids writes to swapfiles.
>
> Why does nfs_direct_write() call generic_write_checks()?
>
> ie call generic_write_checks() earlier, and only swap would bypass them.

Yes, something like that is a good idea probably. Additionally I'd like
to move to a separate of for swap I/O ASAP given that NFS only
implemens ->direct_IO for swap.