From patchwork Thu May 20 17:05:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 53096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 6D7B7B7D29 for ; Fri, 21 May 2010 03:05:58 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 5A570AD0F6; Thu, 20 May 2010 11:05:58 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.8 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.121]) by lists.samba.org (Postfix) with ESMTP id A38DCAD0F6 for ; Thu, 20 May 2010 11:05:52 -0600 (MDT) X-Authority-Analysis: v=1.1 cv=4x/L/B2yxJxLb41s3JXeIUS8CB8wb2aT6sLVld0bcuM= c=1 sm=0 a=QkGNuJQzwV8A:10 a=Lw_SFsgOoS4A:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=uIaJgRc829iw-sClBD4A:9 a=G-v9AKBXxXoD2qFrGnnCQkKuuJAA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:38601] helo=mail.poochiereds.net) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id 9C/05-28303-EEB65FB4; Thu, 20 May 2010 17:05:51 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 63BC8580AE; Thu, 20 May 2010 13:05:50 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Date: Thu, 20 May 2010 13:05:50 -0400 Message-Id: <1274375150-15275-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.6.1 Cc: linux-cifs-client@lists.samba.org Subject: [linux-cifs-client] [PATCH] cifs: don't attempt busy-file rename unless it's in same-directory X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Busy-file renames don't actually work across directories, so we need to limit this code to renames within the same dir. Signed-off-by: Jeff Layton --- fs/cifs/inode.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 62b324f..6f0683c 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -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,