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

Jeff Layton jlayton at samba.org
Tue Sep 2 14:06:47 GMT 2008

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  
> 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

> It only allows you to rename the file, it does not support  
> moving.

I'm not sure what you mean by this...

> 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?

Jeff Layton <jlayton at samba.org>

More information about the samba-technical mailing list