]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs:aio_pthread: Handle VFS_OPEN_HOW_RESOLVE_NO_XDEV flag
authorSamuel Cabrero <scabrero@suse.de>
Fri, 2 May 2025 09:57:30 +0000 (11:57 +0200)
committerSamuel Cabrero <scabrero@samba.org>
Tue, 18 Nov 2025 08:03:32 +0000 (08:03 +0000)
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 <scabrero@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_aio_pthread.c

index bd0c94b8cce48c51d6e9eb071d432b9f0691b16a..afbaaedf7b521b679e5b688afc0468fa08418662 100644 (file)
@@ -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,