From 71baa41073a1e2cf6fb88d7a20f8758843c7485b Mon Sep 17 00:00:00 2001 From: Samuel Cabrero Date: Fri, 2 May 2025 11:57:30 +0200 Subject: [PATCH] vfs:aio_pthread: Handle VFS_OPEN_HOW_RESOLVE_NO_XDEV flag This module uses openat() instead of openat2() so the flag won't be used and automounts might not be triggered. Disable flag usage for subsequent opens and return an error to callers to warn the user and retry without the flag. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15805 Signed-off-by: Samuel Cabrero Reviewed-by: Ralph Boehme --- source3/modules/vfs_aio_pthread.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index bd0c94b8cce..afbaaedf7b5 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -457,7 +457,9 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle, bool aio_allow_open = lp_parm_bool( SNUM(handle->conn), "aio_pthread", "aio open", false); - if ((how->resolve & ~VFS_OPEN_HOW_WITH_BACKUP_INTENT) != 0) { + if ((how->resolve & ~(VFS_OPEN_HOW_WITH_BACKUP_INTENT | + VFS_OPEN_HOW_RESOLVE_NO_XDEV)) != 0) + { errno = ENOSYS; return -1; } @@ -498,6 +500,16 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle, aio_allow_open = false; } + if (how->resolve & VFS_OPEN_HOW_RESOLVE_NO_XDEV) { + /* + * RESOLVE_NO_XDEV needs openat2(). Disallow further usage of + * this flag and return ENOSYS to force a retry. + */ + fsp->conn->open_how_resolve &= ~VFS_OPEN_HOW_RESOLVE_NO_XDEV; + errno = ENOSYS; + return -1; + } + if (!aio_allow_open) { /* aio opens turned off. */ return SMB_VFS_NEXT_OPENAT(handle, -- 2.47.3