From: Volker Lendecke Date: Tue, 8 Mar 2022 11:44:33 +0000 (+0100) Subject: smbd: Always use O_NONBLOCK in openat_pathref_fsp() X-Git-Tag: tevent-0.12.0~456 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93d2defa42683cd151b7a11075396aa911dbf0ae;p=thirdparty%2Fsamba.git smbd: Always use O_NONBLOCK in openat_pathref_fsp() 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index da792a41c6e..8d18339fb92 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -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)) {