]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.32.17/cifs-don-t-attempt-busy-file-rename-unless-it-s-in-same-directory.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.17 / cifs-don-t-attempt-busy-file-rename-unless-it-s-in-same-directory.patch
1 From ed0e3ace576d297a5c7015401db1060bbf677b94 Mon Sep 17 00:00:00 2001
2 From: Jeff Layton <jlayton@redhat.com>
3 Date: Tue, 1 Jun 2010 16:21:01 -0400
4 Subject: cifs: don't attempt busy-file rename unless it's in same directory
5
6 From: Jeff Layton <jlayton@redhat.com>
7
8 commit ed0e3ace576d297a5c7015401db1060bbf677b94 upstream.
9
10 Busy-file renames don't actually work across directories, so we need
11 to limit this code to renames within the same dir.
12
13 This fixes the bug detailed here:
14
15 https://bugzilla.redhat.com/show_bug.cgi?id=591938
16
17 Signed-off-by: Jeff Layton <jlayton@redhat.com>
18 Signed-off-by: Steve French <sfrench@us.ibm.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20
21 ---
22 fs/cifs/inode.c | 4 ++++
23 1 file changed, 4 insertions(+)
24
25 --- a/fs/cifs/inode.c
26 +++ b/fs/cifs/inode.c
27 @@ -1284,6 +1284,10 @@ cifs_do_rename(int xid, struct dentry *f
28 if (rc == 0 || rc != -ETXTBSY)
29 return rc;
30
31 + /* open-file renames don't work across directories */
32 + if (to_dentry->d_parent != from_dentry->d_parent)
33 + return rc;
34 +
35 /* open the file to be renamed -- we need DELETE perms */
36 rc = CIFSSMBOpen(xid, pTcon, fromPath, FILE_OPEN, DELETE,
37 CREATE_NOT_DIR, &srcfid, &oplock, NULL,