From a112c9c24c7ff5401bfb5afebd67ee65d05795fc Mon Sep 17 00:00:00 2001 From: Tiffany Yang Date: Fri, 26 Jul 2024 13:29:58 -0700 Subject: [PATCH] ANDROID: fsnotify: Do not notify lower fs of open when ENOSYS Even though FUSE supports d_canonical_path, the underlying server may not implement the operation. In that case, follow the same logic for filesystems that do not have the canonical path operation instead of returning early from fsnotify_file with an error. Bug: 326995824 Test: cts-tradefed run commandAndExit cts -m CtsOsTestCases -t android.os.cts.FileObserverTest Change-Id: Iae618d4159222b06467b9a0bbb67fb67885aa65e Signed-off-by: Tiffany Yang (cherry picked from commit 61d32e739d27dd35353a22804023f099b383df3b) --- include/linux/fsnotify.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 102913f26152..09b4cf9c13cd 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -107,15 +107,17 @@ static inline int fsnotify_file(struct file *file, __u32 mask) ret = path->dentry->d_op->d_canonical_path(path, &lower_path); - if (ret) - return ret; + if (ret != -ENOSYS) { + if (ret) + return ret; - ret = fsnotify_parent(lower_path.dentry, mask, - &lower_path, FSNOTIFY_EVENT_PATH); - path_put(&lower_path); + ret = fsnotify_parent(lower_path.dentry, mask, + &lower_path, FSNOTIFY_EVENT_PATH); + path_put(&lower_path); - if (ret) - return ret; + if (ret) + return ret; + } } }