summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-08-29 09:58:45 +0200
committerKarolin Seeger <kseeger@samba.org>2016-09-21 11:55:16 +0200
commita69dae26d7a6dd4b1e3cc958c9fd05980668a5a3 (patch)
tree16c5fab4c89d94b91fb716861c2fecf1544521d0 /source3
parentdbbf8dcd7863fd4bd2989a7cf75520c5b788d186 (diff)
downloadsamba-a69dae26d7a6dd4b1e3cc958c9fd05980668a5a3.tar.gz
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@samba.org> Reviewed-by: Simo <simo@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Sep 15 20:21:41 CEST 2016 on sn-devel-144 (cherry picked from commit e69b17d603e5f09ac1e7ee05fc1f5ad67288c484)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 2ae6f835bbc..9d10d199e1e 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. */