After calling allinfo on a file using smbclient against a windows server the file remains opened and trying to delete the file results in an NT_STATUS_SHARING_VIOLATION error. Reproduction steps: see http://pastebin.com/raw.php?i=WsPRngS7 Note that this only causes an issue with a windows smb server (tested with 2012R2) when doing the same steps with a linux samaba server the file can be deleted after calling allinfo (although that might be because linux generally allows you to delete a file thats still open)
Did you use SMB1 or SMB2 to connect ?
(Copy of reproduction steps). smb: \test\> put a.jpg putting file a.jpg as \test\a.jpg (43392.1 kb/s) (average 37733.0 kb/s) smb: \test\> del a.jpg smb: \test\> put a.jpg putting file a.jpg as \test\a.jpg (36160.2 kb/s) (average 37407.7 kb/s) smb: \test\> allinfo a.jpg altname: a.jpg create_time: Fri Nov 14 05:12:04 PM 2014 CET access_time: Fri Nov 14 05:12:10 PM 2014 CET write_time: Fri Nov 14 05:12:10 PM 2014 CET change_time: Fri Nov 14 05:12:10 PM 2014 CET attributes: A (20) stream: [::$DATA], 222172 bytes smb: \test\> del a.jpg NT_STATUS_SHARING_VIOLATION deleting remote file \test\a.jpg NT_STATUS_SHARING_VIOLATION listing \test\a.jpg smb: \test\>
(In reply to Jeremy Allison from comment #1) SMB1, when using SMB2 I cant reproduce the issue
Created attachment 10715 [details] Proposed patch for master. Can you test this ? I think it will fix it.
Reproduced here and confirmed the fix works.
Created attachment 10717 [details] git-am fix for 4.2.0 - cherry-pick from master
Comment on attachment 10717 [details] git-am fix for 4.2.0 - cherry-pick from master Also applies cleanly to 4.1.next, 4.0.next.
Comment on attachment 10717 [details] git-am fix for 4.2.0 - cherry-pick from master >From dbb4bb2e7afb108e0e7eeb2f2ef843be55c5577e Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Tue, 10 Feb 2015 09:32:11 -0800 >Subject: [PATCH] s3: smbclient: Allinfo leaves the file handle open. > >https://bugzilla.samba.org/show_bug.cgi?id=11094 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Volker Lendecke <vl@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Tue Feb 10 23:28:46 CET 2015 on sn-devel-104 > >(cherry picked from commit 080ec0f7d9735b27138deb5f91a397935f089f02) >--- > source3/client/client.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/source3/client/client.c b/source3/client/client.c >index 5d70897..1458cf2 100644 >--- a/source3/client/client.c >+++ b/source3/client/client.c >@@ -1816,6 +1816,7 @@ static int do_allinfo(const char *name) > } > > TALLOC_FREE(snapshots); >+ cli_close(cli, fnum); > > return 0; > } >-- >2.2.0.rc0.207.ga3a616c >
Re-assigning to Karolin for inclusion in 4.2.0, 4.1.next. 4.0.next.
(In reply to Jeremy Allison from comment #9) Pushed to autobuild-v4-[0|1|2].
(In reply to Karolin Seeger from comment #10) Pushed to all branches. Closing out bug report. Thanks!