ANDROID: fuse: Skip canonical path logic if ENOSYS
Not all FUSE servers have implemented canonical_path such as virtiofs.
This patch makes it so they go through the same logic as other
filesystems that don't have canonical path implemented.
Bug: 330136711
Test: ./cts-tradefed run commandAndExit cts -m CtsIncidentHostTestCases -t com.android.server.cts.ErrorsTest#testTombstone
Change-Id: I35f19bd1a12420015128ac9bc2662b9bd252a612
Signed-off-by: Richard Fung <richardfung@google.com>
(cherry picked from commit 4b0be62caf6923eac6acdb5a44eb03688e6f9dc5)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index cc9bde8..135d5f5 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -786,11 +786,13 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
if (path.dentry->d_op->d_canonical_path) {
ret = path.dentry->d_op->d_canonical_path(&path,
&alteredpath);
- if (ret)
- goto path_put_and_out;
-
- canonical_path = &alteredpath;
- path_put(&path);
+ if (ret != -ENOSYS) {
+ if (ret) {
+ goto path_put_and_out;
+ }
+ canonical_path = &alteredpath;
+ path_put(&path);
+ }
}
}