From patchwork Fri May 21 18:25:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 53199 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 093A9B7D24 for ; Sat, 22 May 2010 04:25:26 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 4E99E46607; Fri, 21 May 2010 12:25:26 -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.123]) by lists.samba.org (Postfix) with ESMTP id EE01BAD2D8 for ; Fri, 21 May 2010 12:25:19 -0600 (MDT) X-Authority-Analysis: v=1.1 cv=4x/L/B2yxJxLb41s3JXeIUS8CB8wb2aT6sLVld0bcuM= c=1 sm=0 a=nfWOnbk1rYsA:10 a=GQCbJdZ--msA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=ZNfXFCm2QU-phYmpTxMA:9 a=Bd5HGUhhO0BuoseoWJ9HRBUW65cA: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:38604] helo=mail.poochiereds.net) by cdptpa-oedge03.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id D4/29-28303-E00D6FB4; Fri, 21 May 2010 18:25:18 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id D4650580AC; Fri, 21 May 2010 14:25:17 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Fri, 21 May 2010 14:25:15 -0400 Message-Id: <1274466317-28231-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1274466317-28231-1-git-send-email-jlayton@redhat.com> References: <1274466317-28231-1-git-send-email-jlayton@redhat.com> Cc: linux-fsdevel@vger.kernel.org Subject: [linux-cifs-client] [PATCH 2/4] cifs: don't leave open files dangling 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 If we aren't going to call cifs_new_fileinfo to put the files on the openFileList for an inode, then they should be closed -- full stop. Signed-off-by: Jeff Layton --- fs/cifs/dir.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 54de8e5..e11ee2e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -269,6 +269,8 @@ int cifs_posix_open(char *full_path, struct inode **pinode, oflags); if (pfile_info == NULL) rc = -ENOMEM; + } else { + CIFSSMBClose(xid, cifs_sb->tcon, *pnetfid); } posix_open_ret: @@ -478,11 +480,7 @@ cifs_create_set_dentry: else cFYI(1, "Create worked, get_inode_info failed rc = %d", rc); - /* nfsd case - nfs srv does not set nd */ - if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) { - /* mknod case - do not leave file open */ - CIFSSMBClose(xid, tcon, fileHandle); - } else if (!(posix_create) && (newinode)) { + if (!posix_create && newinode) { struct cifsFileInfo *pfile_info; /* * cifs_fill_filedata() takes care of setting cifsFileInfo @@ -492,7 +490,10 @@ cifs_create_set_dentry: nd->path.mnt, oflags); if (pfile_info == NULL) rc = -ENOMEM; + } else { + CIFSSMBClose(xid, tcon, fileHandle); } + cifs_create_out: kfree(buf); kfree(full_path);