GNOME Bugzilla – Bug 603353
SMB Write File Error: Success
Last modified: 2014-03-31 07:57:31 UTC
Created attachment 148725 [details] Error with Nautilus On the rare occassion for some reason when gvfs needs to write/copy a file to a Samba share it gives the error 'Success', but the file is never actually written. This has happened to me and a colleague a couple of times but there is no exact procedure that will reproduce the error 100%, it just happens when it happens. Originally it was discovered by opening a file in gedit over smb, then saving the file, which gedit would then give the error. I thought it was a problem with gedit, but when I copied the problem file to my machine via nautilus, changed it, then copied it back via nautilus, nautilus would then produce the same error. It seems that when this happens to a file, other files on the exact same samba share in the same directory are perfectly ok. A workaround seems to be unmounting the the smb share from the client machine then reconnecting it again. Client: Ubuntu 9.10 gvfs 1.4.1 Server: Ubuntu 9.04 Samba (whatever the most up-to-date package is in Ubuntu 9.04 repos as of 30 Nov. Will update when more details available) https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/490176
Created attachment 148726 [details] error in gedit
My wild guess is that some other user is accessing the file at the same time, possibly locking it for write. File locking is a mystery in Samba world and might not always work. Please try to check this next time the error happens. Also, smbclient errno mapping is not always correct, that's why you see the "Success" messages.
Created attachment 258205 [details] [review] smb: Set error from errno before running another operation This prevents errors of the form "Error performing operation: Success" when doing a close after a replace that tries to overwrite a file but fails in the final rename.
(In reply to comment #2) > My wild guess is that some other user is accessing the file at the same time, > possibly locking it for write. File locking is a mystery in Samba world and > might not always work. Please try to check this next time the error happens. I reproduced this by trying to replace a file owned by another user. > > Also, smbclient errno mapping is not always correct, that's why you see the > "Success" messages. It is actually a problem with the way that errno is handled.
Created attachment 258283 [details] [review] smb: Set error from the errno of the correct operation This prevents errors of the form "Error performing operation: Success" when doing a close after a replace that tries to overwrite a file but fails in the final rename.
The previous patch was wrong because it sent the job reply to indicate that the job was complete before running the unlink operation.
Created attachment 258284 [details] [review] smb: Set error from the errno of the correct operation This prevents errors of the form "Error performing operation: Success" when doing a close after a replace that tries to overwrite a file but fails in the final rename.
Review of attachment 258284 [details] [review]: It looks good with small fix... ::: daemon/gvfsbackendsmb.c @@ +1469,3 @@ if (res == -1) { + int errsv = errno; Wouldn't be better to declare one errsv variable for the whole function? There is another one few lines before...
(In reply to comment #8) > Review of attachment 258284 [details] [review]: > > It looks good with small fix... > > ::: daemon/gvfsbackendsmb.c > @@ +1469,3 @@ > if (res == -1) > { > + int errsv = errno; > > Wouldn't be better to declare one errsv variable for the whole function? There > is another one few lines before... Sure. Pushed with alterations to master as de923ad.
*** Bug 666880 has been marked as a duplicate of this bug. ***