All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: receive: retry encoded_write on EPERM
@ 2024-07-02 16:27 Boris Burkov
  2024-07-02 17:12 ` Josef Bacik
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Boris Burkov @ 2024-07-02 16:27 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

encoded_write fails if we run without CAP_SYS_ADMIN, but the decompress
and write fallback could succeed if we are running with write
permissions on the file. Therefore, it is helpful to fall back on EPERM
as well. While this will increase the "silent failure" rate of encoded
writes, we do have the verbose log in place to debug that while setting
up a receive workflow that expects encoded_write.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 cmds/receive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmds/receive.c b/cmds/receive.c
index 412bc8afe..9101e8ccf 100644
--- a/cmds/receive.c
+++ b/cmds/receive.c
@@ -1285,7 +1285,8 @@ static int process_encoded_write(const char *path, const void *data, u64 offset,
 		if (ret >= 0)
 			return 0;
 		/* Fall back for these errors, fail hard for anything else. */
-		if (errno != ENOSPC && errno != ENOTTY && errno != EINVAL) {
+		if (errno != ENOSPC && errno != ENOTTY &&
+		    errno != EINVAL && errno != EPERM) {
 			ret = -errno;
 			error("encoded_write: writing to %s failed: %m", path);
 			return ret;
-- 
2.45.2


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

end of thread, other threads:[~2024-07-03 23:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02 16:27 [PATCH] btrfs-progs: receive: retry encoded_write on EPERM Boris Burkov
2024-07-02 17:12 ` Josef Bacik
2024-07-03  7:28 ` Qu Wenruo
2024-07-03 23:20 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.