From 9628355a5936f340dc54c5d6845d3e5307b1c09b Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 5 Dec 2013 15:57:54 -0700 Subject: [PATCH 1/5] s3-aio: Use correct locking context for SMB2 The synchronous SMB2 reads and writes use open_persistent_id. The AIO codepathes have to use the same, otherwise a write will conflict with a lock on the same open file. Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison (cherry picked from commit dfef0701c398982226dde8a8e15ff97bba0fef53) --- source3/smbd/aio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index e8be408..3d43b2c 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -720,7 +720,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn, return NT_STATUS_NO_MEMORY; } - init_strict_lock_struct(fsp, (uint64_t)smbreq->smbpid, + init_strict_lock_struct(fsp, fsp->op->global->open_persistent_id, (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK, &aio_ex->lock); @@ -872,7 +872,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn, aio_ex->write_through = write_through; - init_strict_lock_struct(fsp, (uint64_t)smbreq->smbpid, + init_strict_lock_struct(fsp, fsp->op->global->open_persistent_id, in_offset, (uint64_t)in_data.length, WRITE_LOCK, &aio_ex->lock); -- 1.7.1 From e14ad670ac7ff030736b96f32156ca9c33849130 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 5 Dec 2013 16:20:26 -0700 Subject: [PATCH 2/5] s3: Return correct error code from SMB2 AIO read failure This is similar to commit 27e20d5d60ea8aa526bcb7c2dfc18dd2de0bb97b which fixed the same case for SMB2 writes: When sending the AIO read fails, return the real error instead of mapping it to NT_STATUS_FILE_CLOSED. Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison (cherry picked from commit eadb2a54d1733a482999eb770182156dad1e184d) --- source3/smbd/smb2_read.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index 41adb03..8a9a670 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -462,7 +462,7 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) { /* Real error in setting up aio. Fail. */ - tevent_req_nterror(req, NT_STATUS_FILE_CLOSED); + tevent_req_nterror(req, status); return tevent_req_post(req, ev); } -- 1.7.1 From b35cb771cdd7fa241a83c7229b4263d4bd06b23f Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 5 Dec 2013 15:20:06 -0700 Subject: [PATCH 3/5] selftest: Introduce share for testing AIO Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison (cherry picked from commit 63727c15450e1db2be49ade758c369aa4599657a) --- selftest/target/Samba3.pm | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 2061d97..792bbca 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -1004,6 +1004,10 @@ sub provision($$$$$$) directory mask = 0777 force directory mode = 0 vfs objects = $vfs_modulesdir_abs/xattr_tdb.so +[aio] + copy = tmp + aio read size = 1 + aio write size = 1 [print\$] copy = tmp -- 1.7.1 From 3d59fd03c5f88608bf7a8eb2f2657891627c93e1 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 5 Dec 2013 15:22:13 -0700 Subject: [PATCH 4/5] selftest: Run smb2.lock tests also against AIO share Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison (cherry picked from commit d551d5256f9b1ca57b8018d816ea665c9b847ced) --- source3/selftest/tests.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index c293e6d..a968665 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -336,6 +336,10 @@ for t in tests: plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/valid-users-tmp -U$USERNAME%$PASSWORD') plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/write-list-tmp -U$USERNAME%$PASSWORD') plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD') + elif t == "smb2.lock": + plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/aio -U$USERNAME%$PASSWORD', 'aio') + plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD') + plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD') else: plansmbtorture4testsuite(t, "s3dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD') plansmbtorture4testsuite(t, "plugin_s4_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD') -- 1.7.1 From c5bd24f35ca154ff7b901b8ecfc6d6b58950257b Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Thu, 5 Dec 2013 15:53:47 -0700 Subject: [PATCH 5/5] selftest: Remove samba3.smb2.lock.*.rw-exclusive from flapping file This test demonstrates a problem with byte range locks and AIO. Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Dec 6 05:19:37 CET 2013 on sn-devel-104 (cherry picked from commit 8c3bf7b84950fbb0305bcccd49ecfc202e08901a) --- selftest/flapping | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/selftest/flapping b/selftest/flapping index afeae65..fd2e0c3 100644 --- a/selftest/flapping +++ b/selftest/flapping @@ -16,7 +16,6 @@ ^samba3.rap.printing # fails sometimes on sn-devel ^samba3.rpc.spoolss.printer.*addprinter.print_test # fails on some hosts due to timing issues ? ^samba3.rpc.lsa.privileges.lsa.Privileges\(s3dc\) # fails sometimes on sn-devel -^samba3.smb2.lock.*.rw-exclusive # another intermittent failure ^samba4.blackbox.gentest # is flakey due to timing ^samba3.smb2.acls.INHERITANCE\(plugin_s4_dc\) # Seems to flap - succeeds on sn-devel, fails on Fedora 16 ^samba3.smb2.acls.DYNAMIC\(plugin_s4_dc\) # Seems to flap - succeeds on sn-devel, fails on Fedora 16 -- 1.7.1