[jcifs] Trouble deleting directory-- receive error message "Theprocess cannot access the file because it is being used byanother process."

Brian Bernstein bernie9998 at gmail.com
Wed Apr 2 15:36:16 GMT 2008


That is very interesting.  I wonder if you are accessing files on
these machines in a manner that is avoiding many of the issues we're
having with file locks.  On our platform, we find that we inevitably
end up with stale locks left on some files, especially after writing
to them.  These locks tend to remain stale for a few seconds or so
before they are finally removed.  In that time, we get a "in use by
another process" error when trying to delete them.

Our solution has been to open the files with the FILE_SHARE_DELETE
flag in order to avoid this error.  However, the error still remains
with the SmbComDelete command.  I believe this is because SmbComDelete
will not allow a "pending delete", resulting in its failure.  When we
delete by setting the 'delete file on close' flag, via the
SetFileInformation command, we are actually setting a "pending delete"
to occur when no more handles are open on that file.  If the file is
not open by any other process, then the delete occurs as soon as we
close the file after setting the flag.

-Brian

On 02/04/2008, Caldarale, Charles R <Chuck.Caldarale at unisys.com> wrote:
> > From:
>  > jcifs-bounces+chuck.caldarale=unisys.com at lists.samba.org
>  > [mailto:jcifs-bounces+chuck.caldarale=unisys.com at lists.samba.o
>  > rg] On Behalf Of Brian Bernstein
>  > Subject: Re: [jcifs] Trouble deleting directory-- receive
>  > error message "Theprocess cannot access the file because it
>
> > is being used byanother process."
>  >
>
> > Yes, I wouldn't be surprised if this is an issue of the SmbComDelete
>  > being a little out of date.
>
>
> The SMB client on our proprietary platform uses SmbComDelete (0x06)
>  without any difficulty when talking to Windows XP, 2003, Vista, as well
>  as Samba without any apparent difficulty.
>
>   - Chuck
>
>
>  THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>  MATERIAL and is thus for use only by the intended recipient. If you
>  received this in error, please contact the sender and delete the e-mail
>  and its attachments from all computers.
>


-- 
======================================
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2


More information about the jcifs mailing list