summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-06-04 21:00:24 -0700
committerJeremy Allison <jra@samba.org>2010-06-04 21:00:24 -0700
commit62e0a744e23ced873241b8fd531276e8f0c870b7 (patch)
tree81a03c00a964058fd8fbdb4b0384e53c58912757 /source3/smbd/close.c
parent79ec886aa4e8398cd45d9821030a1b87a17950f8 (diff)
downloadsamba-62e0a744e23ced873241b8fd531276e8f0c870b7.tar.gz
samba-62e0a744e23ced873241b8fd531276e8f0c870b7.tar.bz2
samba-62e0a744e23ced873241b8fd531276e8f0c870b7.zip
Fix a long-standing bug with async io that would only be triggered by SMB2.
On normal or shutdown close, ensure we wait for any pending IO to complete before returning. Implement a blocking aio_suspend inside vfs_aio_fork.c. These changes pass make test when the aio_fork module is used by default on the test shares. Jeremy.
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 20fe9e46f1..b35d544630 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -580,9 +580,11 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
NTSTATUS tmp;
connection_struct *conn = fsp->conn;
- if (fsp->aio_write_behind) {
+ if (close_type == ERROR_CLOSE) {
+ cancel_aio_by_fsp(fsp);
+ } else {
/*
- * If we're finishing write behind on a close we can get a write
+ * If we're finishing async io on a close we can get a write
* error here, we must remember this.
*/
int ret = wait_for_aio_completion(fsp);
@@ -590,10 +592,8 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
status = ntstatus_keeperror(
status, map_nt_error_from_unix(ret));
}
- } else {
- cancel_aio_by_fsp(fsp);
}
-
+
/*
* If we're flushing on a close we can get a write
* error here, we must remember this.