[linux-cifs-client] renaming open files on windows with CIFS

George K Colley gcolley at apple.com
Tue Sep 2 15:18:32 GMT 2008


On Sep 2, 2008, at 7:06 AM, Jeff Layton wrote:

> On Mon, 01 Sep 2008 18:49:56 -0700
> George K Colley <gcolley at apple.com> wrote:
>
>>
>> On Sep 1, 2008, at 4:52 AM, Jeff Layton wrote:
>>
>>> CIFS already had an existing function called CIFSSMBRenameOpenFile
>>> that
>>> does a Trans2 rename. This function does not seem to work against  
>>> any
>>> open file that I've tested it against. Even using a modified cifs.ko
>>> module that opens a file and tries to rename the FID to another name
>>> always seems to fail no matter how I open the file.
>> Not sure how the linux client implements this but the
>> SMB_SFILEINFO_RENAME_INFORMATION call
>> does work.
>
> Thanks, George...
>
> Looks like CIFS calls this SMB_SET_FILE_RENAME_INFORMATION (0x3f2),  
> and
> that looks like the same thing as SMB_SFILEINFO_RENAME_INFORMATION in
> darwin.
>
>> It only allows you to rename the file, it does not support
>> moving.
>
> I'm not sure what you mean by this...
It can only be used to rename in place. You can not move the file to  
another location.
>
>
>> The Mac OS X
>> Leopard code has this implemented. You could look at the darwin code
>> to see how it is done.
>
> Looks like it mostly does the same thing as we do. The main difference
> seems to be that the Linux CIFS client always sets the root_fid to 0
> (which I presume means the root of the share)...
>
> I did a quick experiment where I tried to rename a file that was at  
> the
> root of the share (in which case root_fid should be 0, I think), but  
> it
> still didn't work (NT_STATUS_ACCESS_DENIED from the rename call).
>
> Is there a particular way that the FID being renamed needs to be  
> opened?
If the file is not open already with delete access then you will need  
to do a new open on it with delete access:
#define STD_RIGHT_DELETE_ACCESS         0x00010000

If this doesn't get me a tcpdump and I will look at it for you.

George
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the linux-cifs-client mailing list