From: Jeff Layton <jlayton@kernel.org> Date: 2023-02-13 20:23:54
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>
---
fs/nfsd/filecache.c | 22 ----------------------
1 file changed, 22 deletions(-)
@@ -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'tthrowoutfilesthatarestillundergoingI/Oor-*thathaveunclearederrorspending.-*/-if(nfsd_file_check_writeback(nf)){-trace_nfsd_file_gc_writeback(nf);-returnLRU_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);
From: Chuck Lever III <hidden> Date: 2023-02-14 14:48:25
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref] 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>
/* 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
On Tue, 2023-02-14 at 14:48 +0000, Chuck Lever III wrote:
quoted
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref]
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>
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-
quoted
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.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
From: Chuck Lever III <hidden> Date: 2023-02-14 15:05:22
On Feb 14, 2023, at 10:00 AM, Trond Myklebust [off-list ref] wrote:
On Tue, 2023-02-14 at 14:48 +0000, Chuck Lever III wrote:
quoted
quoted
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref]
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>
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-
quoted
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.
Then perhaps skipping these files can be gated on an EXPORT_OP flag?
--
Chuck Lever
On Tue, 2023-02-14 at 15:05 +0000, Chuck Lever III wrote:
quoted
On Feb 14, 2023, at 10:00 AM, Trond Myklebust [off-list ref]
wrote:
On Tue, 2023-02-14 at 14:48 +0000, Chuck Lever III wrote:
quoted
quoted
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref]
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>
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-
quoted
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.
Then perhaps skipping these files can be gated on an EXPORT_OP flag?
That would work.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
From: Jeff Layton <jlayton@kernel.org> Date: 2023-02-14 15:16:37
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:
quoted
quoted
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref]
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>
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-
quoted
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?
--
Jeff Layton [off-list ref]
On Tue, 2023-02-14 at 10:16 -0500, Jeff Layton wrote:
On Tue, 2023-02-14 at 10:00 -0500, Trond Myklebust wrote:
quoted
On Tue, 2023-02-14 at 14:48 +0000, Chuck Lever III wrote:
quoted
quoted
On Feb 13, 2023, at 3:23 PM, Jeff Layton [off-list ref]
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>
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-
quoted
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