renaming open files on windows with CIFS

Jeff Layton jlayton at
Mon Sep 1 11:52:41 GMT 2008

I've been playing with trying to get open file renames working against
windows in CIFS VFS. The simple reproducer I have just opens a file and
then tries to rename it on a win2k3 share. We first try a normal

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.

So my question is -- is this expected to work? If not, then why does
CIFS have the ability to rename by filehandle at all? Aren't the
filehandles returned by CREATE_ANDX only good for the life of the open?
Or are they persistent after the file is closed?

If this just won't work at all, my next idea is to have the rename
hardlink the file to the new name and set the delete on close bit on the
original FID (and maybe set ATTR_HIDDEN). I haven't yet attempted this
though, so it may also not work.

Any advice on how this should be implemented would be welcome.

Jeff Layton <jlayton at>

More information about the samba-technical mailing list