From a91a95edbc945a5a6a2c020e64fab982c2dc7225 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Fri, 6 Nov 2026 22:35:02 +0000 Subject: [PATCH] Fall back to inotify when fanotify rejects mounts with EXDEV (#65325) --- tsc/internal/fswatch/fanotify_linux.go | 2 +- tsc/internal/fswatch/fanotify_linux_test.go | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tsc/internal/fswatch/fanotify_linux.go b/tsc/internal/fswatch/fanotify_linux.go index 899e64ad3051b..677c69cc6f67c 100644 --- a/tsc/internal/fswatch/fanotify_linux.go +++ b/tsc/internal/fswatch/fanotify_linux.go @@ -366,7 +366,7 @@ func (b *fanotifyBackend) markDir(w *dirWatch, path string, markPath string) err } func maybeWrapUnsupportedFilesystem(err error) error { - if errors.Is(err, unix.EOPNOTSUPP) || errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODEV) { + if errors.Is(err, unix.EOPNOTSUPP) || errors.Is(err, unix.ENOTSUP) || errors.Is(err, unix.ENODEV) || errors.Is(err, unix.EXDEV) { return fmt.Errorf("%w: %w", err, ErrFilesystemUnsupported) } return err diff --git a/tsc/internal/fswatch/fanotify_linux_test.go b/tsc/internal/fswatch/fanotify_linux_test.go index 7dfe9f5825bbb..0bf7672c36754 100644 --- a/tsc/internal/fswatch/fanotify_linux_test.go +++ b/tsc/internal/fswatch/fanotify_linux_test.go @@ -127,13 +127,15 @@ func TestLinuxFanotifyMaybeWrapUnsupportedFilesystem(t *testing.T) { // Errnos that indicate the filesystem cannot support fanotify FID-based // watching are tagged with ErrFilesystemUnsupported so higher layers can // fall back to inotify (issue #63646). - for _, errno := range []error{unix.EOPNOTSUPP, unix.ENODEV} { - wrapped := maybeWrapUnsupportedFilesystem(fmt.Errorf("name_to_handle_at: %w", errno)) - if !errors.Is(wrapped, ErrFilesystemUnsupported) { - t.Errorf("expected %v to be tagged ErrFilesystemUnsupported", errno) - } - if !errors.Is(wrapped, errno) { - t.Errorf("expected wrapped error to still unwrap to %v", errno) + for _, errno := range []error{unix.EOPNOTSUPP, unix.ENODEV, unix.EXDEV} { + for _, err := range []error{errno, fmt.Errorf("name_to_handle_at: %w", errno)} { + wrapped := maybeWrapUnsupportedFilesystem(err) + if !errors.Is(wrapped, ErrFilesystemUnsupported) { + t.Errorf("expected %v to be tagged ErrFilesystemUnsupported", err) + } + if !errors.Is(wrapped, errno) { + t.Errorf("expected wrapped error to still unwrap to %v", errno) + } } }