linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] afs: Fix ENOSPC, EDQUOT and other errors to fail a write rather than retrying
@ 2021-11-03 23:43 David Howells
  2021-11-04  2:29 ` Jeffrey E Altman
  2021-11-04  3:22 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: David Howells @ 2021-11-03 23:43 UTC (permalink / raw)
  To: marc.dionne
  Cc: Jeffrey E Altman, linux-afs, dhowells, linux-fsdevel,
	linux-kernel

Currently, at the completion of a storage RPC from writepages, the errors
ENOSPC, EDQUOT, ENOKEY, EACCES, EPERM, EKEYREJECTED and EKEYREVOKED cause
the pages involved to be redirtied and the write to be retried by the VM at
a future time.

However, this is probably not the right thing to do, and, instead, the
writes should be discarded so that the system doesn't get blocked (though
unmounting will discard the uncommitted writes anyway).

Fix this by making afs_write_back_from_locked_page() call afs_kill_pages()
instead of afs_redirty_pages() in those cases.

EKEYEXPIRED is left to redirty the pages on the assumption that the caller
just needs to renew their key.  Unknown errors also do that, though it
might be better to squelch those too.

This can be triggered by the generic/285 xfstest.  The writes can be
observed in the server logs.  If a write fails with ENOSPC (ie. CODE
49733403, UAENOSPC) because a file is made really large, e.g.:

Wed Nov 03 23:21:35.794133 2021 [1589] EVENT YFS_SRX_StData CODE 49733403 NAME --UnAuth-- HOST [192.168.1.2]:7001 ID 32766 FID 1048664:0.172306:30364251 UINT64 17592187027456 UINT64 65536 UINT64 17592187092992 UINT64 0

this should be seen once and not repeated.

Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jeffrey E Altman <jaltman@auristor.com>
cc: linux-afs@lists.infradead.org
---

 fs/afs/write.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/fs/afs/write.c b/fs/afs/write.c
index 8b1d9c2f6bec..04f3f87b15cb 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -620,22 +620,18 @@ static ssize_t afs_write_back_from_locked_page(struct address_space *mapping,
 	default:
 		pr_notice("kAFS: Unexpected error from FS.StoreData %d\n", ret);
 		fallthrough;
-	case -EACCES:
-	case -EPERM:
-	case -ENOKEY:
 	case -EKEYEXPIRED:
-	case -EKEYREJECTED:
-	case -EKEYREVOKED:
 		afs_redirty_pages(wbc, mapping, start, len);
 		mapping_set_error(mapping, ret);
 		break;
 
+	case -EACCES:
+	case -EPERM:
+	case -ENOKEY:
+	case -EKEYREJECTED:
+	case -EKEYREVOKED:
 	case -EDQUOT:
 	case -ENOSPC:
-		afs_redirty_pages(wbc, mapping, start, len);
-		mapping_set_error(mapping, -ENOSPC);
-		break;
-
 	case -EROFS:
 	case -EIO:
 	case -EREMOTEIO:



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-04 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-03 23:43 [PATCH] afs: Fix ENOSPC, EDQUOT and other errors to fail a write rather than retrying David Howells
2021-11-04  2:29 ` Jeffrey E Altman
2021-11-04  3:22 ` Matthew Wilcox
2021-11-04 15:15   ` Jeffrey E Altman

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).