]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Always use O_NONBLOCK in openat_pathref_fsp()
authorVolker Lendecke <vl@samba.org>
Tue, 8 Mar 2022 11:44:33 +0000 (12:44 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 11 Mar 2022 18:22:28 +0000 (18:22 +0000)
There's no reason why we would ever want to block on open(O_PATH). The
only cases that to me right now seem relevant is oplock breaks and
FIFOs, which can block forever. Oplock breaks don't happen for
O_PATH (hopefully...) but for the non-O_PATH case we don't want to
block either but we do handle this higher up.

We're handling EWOULDBLOCK for the oplock case correctly in
open_file_ntcreate() by setting up polling. So far we haven't done
this for the implicit openat_pathref_fsp() from filename_convert()
yet. But as our kernel oplock implementation lacks in functionality
big time anyway I would rather fail an open with NETWORK_BUSY than to
sit waiting for an oplock break for 30 seconds.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/files.c

index da792a41c6ec1ac2265e4f1b35d1c1f3f702f20e..8d18339fb922f6ae104fae62265631795da858ea 100644 (file)
@@ -511,9 +511,7 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
                }
        }
 
-       if (S_ISFIFO(smb_fname->st.st_ex_mode)) {
-               open_flags |= O_NONBLOCK;
-       }
+       open_flags |= O_NONBLOCK;
 
        status = fd_openat(dirfsp, smb_fname, fsp, open_flags, 0);
        if (!NT_STATUS_IS_OK(status)) {