From 7009f9192425b9a69114ffefa88ae2dd351ea863 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Mon, 17 Jan 2022 15:09:46 +0000 Subject: [PATCH] UPSTREAM: ANDROID: fs/fuse: Backing move returns EXDEV if TO not backed In a move operation, if the FROM file has a backing inode associated and is handled in backing, it might happen that the TO file does not have a backing path associated (yet), maybe because the FUSE daemon didn't have the chance to traverse it. Thus this special case would mistakenly trigger EBADF, while EXDEV is more appropriate. Bug: 202785178 Test: mv /storage/emulated/0/Android/data//file /sdcard/DCIM Signed-off-by: Alessio Balsini Change-Id: I513c0e17c128ed9181a6b96fbf9f0b950e78be77 --- fs/fuse/backing.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 3099d3c1c962..6e24c55b8e9a 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -1272,7 +1272,13 @@ static int fuse_rename_backing_common( return -EBADF; get_fuse_backing_path(newent, &new_backing_path); if (!new_backing_path.dentry) { - err = -EBADF; + /* + * TODO A file being moved from a backing path to another + * backing path which is not yet instrumented with FUSE-BPF. + * This may be slow and should be substituted with something + * more clever. + */ + err = -EXDEV; goto put_old_path; } if (new_backing_path.mnt != old_backing_path.mnt) {