lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 03 Nov 2021 23:43:20 +0000
From:   David Howells <dhowells@...hat.com>
To:     marc.dionne@...istor.com
Cc:     Jeffrey E Altman <jaltman@...istor.com>,
        linux-afs@...ts.infradead.org, dhowells@...hat.com,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] afs: Fix ENOSPC,
 EDQUOT and other errors to fail a write rather than retrying

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@...istor.com>
Signed-off-by: David Howells <dhowells@...hat.com>
cc: Jeffrey E Altman <jaltman@...istor.com>
cc: linux-afs@...ts.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:


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ