Skip to content

Commit

Permalink
vfs_aio_pthread: use SMB_VFS_NEXT_OPENAT() in aio_pthread_openat_fn()
Browse files Browse the repository at this point in the history
1. Set 'aio_allow_open' to false if fsp->fsp_flags.is_pathref
2. Move !(how->flags & O_CREAT) and !(how->flags & O_EXCL) up and set 'aio_allow_open' to false
3. Use SMB_VFS_NEXT_OPENAT() instead of openat() for disable async opens case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15453

Signed-off-by: MikeLiu <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Tue Aug 22 17:44:00 UTC 2023 on atb-devel-224

Autobuild-User(v4-19-test): Jule Anger <[email protected]>
Autobuild-Date(v4-19-test): Mon Sep  4 10:17:37 UTC 2023 on atb-devel-224
  • Loading branch information
MikeLiu authored and Jule Anger committed Sep 4, 2023
1 parent 1af8a09 commit 8a34b37
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions source3/modules/vfs_aio_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,28 +483,28 @@ static int aio_pthread_openat_fn(vfs_handle_struct *handle,
aio_allow_open = false;
}

if (!aio_allow_open) {
/* aio opens turned off. */
return openat(fsp_get_pathref_fd(dirfsp),
smb_fname->base_name,
how->flags,
how->mode);
if (fsp->fsp_flags.is_pathref) {
/* Use SMB_VFS_NEXT_OPENAT() to call openat() with O_PATH. */
aio_allow_open = false;
}

if (!(how->flags & O_CREAT)) {
/* Only creates matter. */
return openat(fsp_get_pathref_fd(dirfsp),
smb_fname->base_name,
how->flags,
how->mode);
aio_allow_open = false;
}

if (!(how->flags & O_EXCL)) {
/* Only creates with O_EXCL matter. */
return openat(fsp_get_pathref_fd(dirfsp),
smb_fname->base_name,
how->flags,
how->mode);
aio_allow_open = false;
}

if (!aio_allow_open) {
/* aio opens turned off. */
return SMB_VFS_NEXT_OPENAT(handle,
dirfsp,
smb_fname,
fsp,
how);
}

/*
Expand Down

0 comments on commit 8a34b37

Please sign in to comment.