[linux-cifs-client] [PATCH 2/2] cifs: fix busy-file renames and refactor cifs_rename logic

Christoph Hellwig hch at infradead.org
Fri Sep 5 03:02:04 GMT 2008


On Thu, Sep 04, 2008 at 10:45:26PM -0400, Jeff Layton wrote:
> Break out the code that does the actual renaming into a separate
> function and have cifs_rename call that. That function will attempt a
> path based rename first and then do a filehandle based one if it looks
> like the source is busy.
> 
> The existing logic tried a path based rename first, but if we needed to
> remove the destination then it only attempted a filehandle based rename
> afterward. Not all servers support renaming by filehandle, so we need to
> always attempt path rename first and fall back to filehandle rename if
> it doesn't work.
> 
> The renaming logic also wasn't quite right in some cases. If the source
> and target are hardlinked then it's not really a no-op (we still need to
> unlink the source).

Actually per posix rename _is_ a no-op if old and new are hardlinks to
same inode.  But this case is completely handled in the VFS, and
filesystems don't need to consider it at all.



More information about the linux-cifs-client mailing list