linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "dwysocha@redhat.com" <dwysocha@redhat.com>,
	"dhowells@redhat.com" <dhowells@redhat.com>
Cc: "linux-cachefs@redhat.com" <linux-cachefs@redhat.com>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"anna.schumaker@netapp.com" <anna.schumaker@netapp.com>
Subject: Re: [PATCH v2 3/8] nfs: Move to using the alternate fallback fscache I/O API
Date: Fri, 1 Oct 2021 14:29:26 +0000	[thread overview]
Message-ID: <97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com> (raw)
In-Reply-To: <CALF+zO=165sRYRaxPpDS7DaQCpTe-YOa4FamSoMy5FV2uuG5Yg@mail.gmail.com>

On Fri, 2021-10-01 at 07:11 -0400, David Wysochanski wrote:
> 
> 
> On Fri, Sep 17, 2021 at 11:05 AM David Howells <dhowells@redhat.com>
> wrote:
> > 
> > Move NFS to using the alternate fallback fscache I/O API instead of
> > the old
> > upstream I/O API as that is about to be deleted.  The alternate API
> > will
> > also be deleted at some point in the future as it's dangerous (as
> > is the
> > old API) and can lead to data corruption if the backing filesystem
> > can
> > insert/remove bridging blocks of zeros into its extent list[1].
> > 
> > The alternate API reads and writes pages synchronously, with the
> > intention
> > of allowing removal of the operation management framework and
> > thence the
> > object management framework from fscache.
> > 
> > The preferred change would be to use the netfs lib, but the new I/O
> > API can
> > be used directly.  It's just that as the cache now needs to track
> > data for
> > itself, caching blocks may exceed page size...
> > 
> > Changes
> > =======
> > ver #2:
> >   - Changed "deprecated" to "fallback" in the new function
> > names[2].
> > 
> > Signed-off-by: David Howells <dhowells@redhat.com>
> > cc: Trond Myklebust <trond.myklebust@hammerspace.com>
> > cc: Anna Schumaker <anna.schumaker@netapp.com>
> > cc: linux-nfs@vger.kernel.org
> > cc: linux-cachefs@redhat.com
> > Link: https://lore.kernel.org/r/YO17ZNOcq+9PajfQ@mit.edu [1]
> > Link:
> > https://lore.kernel.org/r/CAHk-=wiVK+1CyEjW8u71zVPK8msea=qPpznX35gnX+s8sXnJTg@mail.gmail.com/
> > [2]
> > Link:
> > https://lore.kernel.org/r/163162771421.438332.11563297618174948818.stgit@warthog.procyon.org.uk/
> > # rfc
> > ---
> > 
> >  fs/nfs/file.c    |   14 +++--
> >  fs/nfs/fscache.c |  161 +++++++-----------------------------------
> > ------------
> >  fs/nfs/fscache.h |   85 ++++-------------------------
> >  fs/nfs/read.c    |   25 +++-----
> >  fs/nfs/write.c   |    7 ++
> >  5 files changed, 55 insertions(+), 237 deletions(-)
> > 
> > diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> > index aa353fd58240..209dac208477 100644
> > --- a/fs/nfs/file.c
> > +++ b/fs/nfs/file.c
> > @@ -416,7 +416,7 @@ static void nfs_invalidate_page(struct page
> > *page, unsigned int offset,
> >         /* Cancel any unstarted writes on this page */
> >         nfs_wb_page_cancel(page_file_mapping(page)->host, page);
> > 
> > -       nfs_fscache_invalidate_page(page, page->mapping->host);
> > +       wait_on_page_fscache(page);
> >  }
> > 
> >  /*
> > @@ -432,7 +432,12 @@ static int nfs_release_page(struct page *page,
> > gfp_t gfp)
> >         /* If PagePrivate() is set, then the page is not freeable
> > */
> >         if (PagePrivate(page))
> >                 return 0;
> > -       return nfs_fscache_release_page(page, gfp);
> > +       if (PageFsCache(page)) {
> > +               if (!(gfp & __GFP_DIRECT_RECLAIM) || !(gfp &
> > __GFP_FS))
> > +                       return false;
> > +               wait_on_page_fscache(page);
> > +       }

I've found this generally not to be safe. The VM calls ->release_page()
from a variety of contexts, and often fails to report it correctly in
the gfp flags. That's particularly true of the stuff in mm/vmscan.c.
This is why we have the check above that vetos page removal upon
PagePrivate() being set.
> 

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  parent reply	other threads:[~2021-10-01 14:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 15:04 [RFC PATCH v2 0/8] fscache: Replace and remove old I/O API v2 David Howells
2021-09-17 15:04 ` [PATCH v2 1/8] fscache: Generalise the ->begin_read_operation method David Howells
2021-09-17 15:04 ` [PATCH v2 2/8] fscache: Implement a fallback I/O interface to replace the old API David Howells
2021-09-17 15:04 ` [PATCH v2 3/8] nfs: Move to using the alternate fallback fscache I/O API David Howells
2021-09-29 14:44   ` David Wysochanski
2021-10-01 14:42   ` David Howells
     [not found]   ` <CALF+zO=165sRYRaxPpDS7DaQCpTe-YOa4FamSoMy5FV2uuG5Yg@mail.gmail.com>
2021-10-01 14:29     ` Trond Myklebust [this message]
2021-10-01 14:51     ` Can the GFP flags to releasepage() be trusted? -- was " David Howells
2021-10-01 15:04       ` Trond Myklebust
2021-10-01 19:42         ` Matthew Wilcox
2021-10-05 13:15       ` David Howells
2021-09-17 15:04 ` [PATCH v2 4/8] 9p: (untested) Convert to using the netfs helper lib to do reads and caching David Howells
2021-09-17 15:05 ` [PATCH v2 5/8] cifs: (untested) Move to using the alternate fallback fscache I/O API David Howells
2021-09-17 15:05 ` [PATCH v2 6/8] fscache: Remove the old " David Howells
2021-09-17 15:05 ` [PATCH v2 7/8] fscache: Remove stats that are no longer used David Howells
2021-09-17 15:05 ` [PATCH v2 8/8] fscache: Update the documentation to reflect I/O API changes David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97eb17f51c8fd9a89f10d9dd0bf35f1075f6b236.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=anna.schumaker@netapp.com \
    --cc=dhowells@redhat.com \
    --cc=dwysocha@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).