[PATCH] Fix bug 12268
Volker Lendecke
vl at samba.org
Thu Sep 15 11:57:58 UTC 2016
Hi!
Review appreciated!
Thanks, Volker
-------------- next part --------------
>From 5484c80dd51581443689e75d220bef66b0b55eae Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 29 Aug 2016 09:58:45 +0200
Subject: [PATCH] smbd: Reset O_NONBLOCK on open files
See the comment inline :-)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=12268
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/smbd/open.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index d536076..c6de2dc 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -901,6 +901,25 @@ static NTSTATUS open_file(files_struct *fsp,
return status;
}
+ if (local_flags & O_NONBLOCK) {
+ /*
+ * GPFS can return ETIMEDOUT for pread on
+ * nonblocking file descriptors when files
+ * migrated to tape need to be recalled. I
+ * could imagine this happens elsehwere
+ * too. With blocking file descriptors this
+ * does not happen.
+ */
+ ret = set_blocking(fsp->fh->fd, true);
+ if (ret == -1) {
+ status = map_nt_error_from_unix(errno);
+ DBG_WARNING("Could not set fd to blocking: "
+ "%s\n", strerror(errno));
+ fd_close(fsp);
+ return status;
+ }
+ }
+
ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
if (ret == -1) {
/* If we have an fd, this stat should succeed. */
--
2.7.4
More information about the samba-technical
mailing list