Linux NFS development
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@kernel.org>
To: Jeff Layton <jlayton@kernel.org>,
	Chuck Lever III <chuck.lever@oracle.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] nfsd: allow reaping files that are still under writeback
Date: Tue, 14 Feb 2023 10:21:57 -0500	[thread overview]
Message-ID: <3afba9fdbd9b0056eff0d3262d6951641f46ca10.camel@kernel.org> (raw)
In-Reply-To: <e8f5b07200f197a2972beb0628df55ec92b627b5.camel@kernel.org>

On Tue, 2023-02-14 at 10:16 -0500, Jeff Layton wrote:
> On Tue, 2023-02-14 at 10:00 -0500, Trond Myklebust wrote:
> > On Tue, 2023-02-14 at 14:48 +0000, Chuck Lever III wrote:
> > > 
> > > 
> > > > On Feb 13, 2023, at 3:23 PM, Jeff Layton <jlayton@kernel.org>
> > > > wrote:
> > > > 
> > > > There's no reason to delay reaping an nfsd_file just because
> > > > its
> > > > underlying inode is still under writeback. nfsd just relies on
> > > > client
> > > > activity or the local flusher threads to do writeback.
> > > > 
> > > > Holding the file open does nothing to facilitate that, nor does
> > > > it
> > > > help
> > > > with tracking errors. Just allow it to close and let the kernel
> > > > do
> > > > writeback as it normally would.
> > > > 
> > > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > 
> > > Thanks! Applied to topic-filecache-cleanups.
> > > 
> > > 
> > > > ---
> > > > fs/nfsd/filecache.c | 22 ----------------------
> > > > 1 file changed, 22 deletions(-)
> > > > 
> > > > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
> > > > index e6617431df7c..3b9a10378c83 100644
> > > > --- a/fs/nfsd/filecache.c
> > > > +++ b/fs/nfsd/filecache.c
> > > > @@ -296,19 +296,6 @@ nfsd_file_free(struct nfsd_file *nf)
> > > >         call_rcu(&nf->nf_rcu, nfsd_file_slab_free);
> > > > }
> > > > 
> > > > -static bool
> > > > -nfsd_file_check_writeback(struct nfsd_file *nf)
> > > > -{
> > > > -       struct file *file = nf->nf_file;
> > > > -       struct address_space *mapping;
> > > > -
> > > > -       if (!file || !(file->f_mode & FMODE_WRITE))
> > > > -               return false;
> > > > -       mapping = file->f_mapping;
> > > > -       return mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) ||
> > > > -               mapping_tagged(mapping,
> > > > PAGECACHE_TAG_WRITEBACK);
> > > > -}
> > > > -
> > > > static bool nfsd_file_lru_add(struct nfsd_file *nf)
> > > > {
> > > >         set_bit(NFSD_FILE_REFERENCED, &nf->nf_flags);
> > > > @@ -438,15 +425,6 @@ nfsd_file_lru_cb(struct list_head *item,
> > > > struct list_lru_one *lru,
> > > >         /* We should only be dealing with GC entries here */
> > > >         WARN_ON_ONCE(!test_bit(NFSD_FILE_GC, &nf->nf_flags));
> > > > 
> > > > -       /*
> > > > -        * Don't throw out files that are still undergoing I/O
> > > > or
> > > > -        * that have uncleared errors pending.
> > > > -        */
> > > > -       if (nfsd_file_check_writeback(nf)) {
> > > > -               trace_nfsd_file_gc_writeback(nf);
> > > > -               return LRU_SKIP;
> > > > -       }
> > > > -
> > > >         /* If it was recently added to the list, skip it */
> > > >         if (test_and_clear_bit(NFSD_FILE_REFERENCED, &nf-
> > > > > nf_flags)) {
> > > >                 trace_nfsd_file_gc_referenced(nf);
> > > > -- 
> > > > 2.39.1
> > > > 
> > > 
> > > --
> > > Chuck Lever
> > > 
> > > 
> > > 
> > 
> > Wait... There is a good reason for wanting to do this in the case
> > of
> > NFS re-exports, since close() is a very expensive operation if the
> > file
> > has dirty data.
> > 
> 
> Fair enough. What if we added a new EXPORT_OP_FLUSH_ON_CLOSE flag
> that
> filesystems could set in the export_operations? Then we could make
> this
> behavior conditional on that being set?

Sure.

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



      reply	other threads:[~2023-02-14 15:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-13 20:23 [PATCH] nfsd: allow reaping files that are still under writeback Jeff Layton
2023-02-14 14:48 ` Chuck Lever III
2023-02-14 15:00   ` Trond Myklebust
2023-02-14 15:05     ` Chuck Lever III
2023-02-14 15:11       ` Trond Myklebust
2023-02-14 15:16     ` Jeff Layton
2023-02-14 15:21       ` Trond Myklebust [this message]

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=3afba9fdbd9b0056eff0d3262d6951641f46ca10.camel@kernel.org \
    --to=trondmy@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --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