]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
cifs: don't attempt busy-file rename unless it's in same directory
authorJeff Layton <jlayton@redhat.com>
Tue, 1 Jun 2010 20:21:01 +0000 (16:21 -0400)
committerSteve French <sfrench@us.ibm.com>
Sat, 12 Jun 2010 01:45:36 +0000 (01:45 +0000)
Busy-file renames don't actually work across directories, so we need
to limit this code to renames within the same dir.

This fixes the bug detailed here:

    https://bugzilla.redhat.com/show_bug.cgi?id=591938

Signed-off-by: Jeff Layton <jlayton@redhat.com>
CC: Stable <stable@kernel.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/inode.c

index 62b324f26a565b112b59d6cdd7f688dbf735e715..6f0683c689523894cb6fae3edd79181876084d42 100644 (file)
@@ -1401,6 +1401,10 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
        if (rc == 0 || rc != -ETXTBSY)
                return rc;
 
+       /* open-file renames don't work across directories */
+       if (to_dentry->d_parent != from_dentry->d_parent)
+               return rc;
+
        /* open the file to be renamed -- we need DELETE perms */
        rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE,
                         CREATE_NOT_DIR, &srcfid, &oplock, NULL,