From 62e0a744e23ced873241b8fd531276e8f0c870b7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 4 Jun 2010 21:00:24 -0700 Subject: 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. --- source3/smbd/close.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/smbd') 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. -- cgit