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

George K Colley gcolley at apple.com
Tue Sep 2 01:49:56 GMT 2008


On Sep 1, 2008, at 4:52 AM, Jeff Layton wrote:

> 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
> SMB_COM_RENAME which fails with NT_STATUS_SHARING_VIOLATION.
>
> 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. It only allows you to rename the file, it does not support  
moving. The Mac OS X
Leopard code has this implemented. You could look at the darwin code  
to see how it is done.
>
>
>
> 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 samba.org>
> _______________________________________________
> linux-cifs-client mailing list
> linux-cifs-client at lists.samba.org
> https://lists.samba.org/mailman/listinfo/linux-cifs-client



More information about the samba-technical mailing list