From patchwork Fri May 1 22:44:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish Pargaonkar X-Patchwork-Id: 21524 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n41Misv2023789 for ; Fri, 1 May 2009 22:44:55 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 0E854163C96 for ; Fri, 1 May 2009 22:44:31 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.8 tests=AWL,BAYES_00, DNS_FROM_RFC_POST,SPF_PASS autolearn=no version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.251]) by lists.samba.org (Postfix) with ESMTP id 52C69163C0F for ; Fri, 1 May 2009 22:44:16 +0000 (GMT) Received: by an-out-0708.google.com with SMTP id c2so1654144anc.35 for ; Fri, 01 May 2009 15:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=Vjzi0T9xM3tcqO3XhN+mtKstQN6/fyJ7tXRqYsOjEbA=; b=Vx55iO9U038j9kW/dPccUPeyFkX0PC5f+RC8dEvmzdTb2BGkMe4vFhXQjFFRaEKiyf AkUwQFXYgrHgeGlD5KG+itr0EhWXrdbvy50hnDAXUGUXnnS5JnjWWyFUsJ2b+sQixAto KN+KIuTyCjcG6WSX713Rz9OjJgYIhRp5wRhno= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eydVHs99rcYucjp37mdJW2LuCk8wi8RfvmAT9QmcBuDI0xQRn6fZnFcZwI4O+QZ+Ck 6h7uo9Fcz163c5iwTwTUyRP/EA+AaM8CV1+NGkVC13Tai4tR1WEIQzpjoKo2g+D8qsai Q+dicoNijTM3w4hHdR/jOtOdFBSqcZYFIrj2E= MIME-Version: 1.0 Received: by 10.100.125.12 with SMTP id x12mr6930799anc.112.1241217879368; Fri, 01 May 2009 15:44:39 -0700 (PDT) In-Reply-To: <4a4634330905011421h1e25b5f9u311809d8f54c2b9a@mail.gmail.com> References: <4a4634330905011316o65609395pb05c5676d66783f3@mail.gmail.com> <4a4634330905011421h1e25b5f9u311809d8f54c2b9a@mail.gmail.com> Date: Fri, 1 May 2009 17:44:39 -0500 Message-ID: <4a4634330905011544t28be8f6byede1e119a6638f89@mail.gmail.com> Subject: Re: [patch][linux-cifs-client] fix a regression in cifs caused during lookup intent code patch From: Shirish Pargaonkar To: "linux-cifs-client@lists.samba.org" X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Second attempt at the patch to fix regression in cifs - Remove adding open file entry twice to lists in case of posix opens - fill file info in cifs_create only if creating file without posix open if (pCifsInode == NULL) { @@ -145,17 +142,6 @@ static inline int cifs_posix_open_inode_helper(struct inode *inode, return -EINVAL; } - /* want handles we can use to read with first - in the list so we do not have to walk the - list to search for one in write_begin */ - if ((file->f_flags & O_ACCMODE) == O_WRONLY) { - list_add_tail(&pCifsFile->flist, - &pCifsInode->openFileList); - } else { - list_add(&pCifsFile->flist, - &pCifsInode->openFileList); - } - if (pCifsInode->clientCanCacheRead) { /* we have the inode open somewhere else no need to discard cache data */ diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 461750e..11431ed 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -281,6 +281,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, int create_options = CREATE_NOT_DIR; int oplock = 0; int oflags; + bool posix_create = false; /* * BB below access is probably too much for mknod to request * but we have to do query and setpathinfo so requesting @@ -328,11 +329,13 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, negotation. EREMOTE indicates DFS junction, which is not handled in posix open */ - if ((rc == 0) && (newinode == NULL)) - goto cifs_create_get_file_info; /* query inode info */ - else if (rc == 0) /* success, no need to query */ - goto cifs_create_set_dentry; - else if ((rc != -EIO) && (rc != -EREMOTE) && + if (rc == 0) { + posix_create = true; + if (newinode == NULL) /* query inode info */ + goto cifs_create_get_file_info; + else /* success, no need to query */ + goto cifs_create_set_dentry; + } else if ((rc != -EIO) && (rc != -EREMOTE) && (rc != -EOPNOTSUPP)) /* path not found or net err */ goto cifs_create_out; /* else fallthrough to retry, using older open call, this is @@ -464,7 +467,7 @@ cifs_create_set_dentry: if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) { /* mknod case - do not leave file open */ CIFSSMBClose(xid, tcon, fileHandle); - } else if (newinode) { + } else if (!(posix_create) && (newinode)) { cifs_fill_fileinfo(newinode, fileHandle, cifs_sb->tcon, write_only); } diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 50ca088..38c06f8 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -129,15 +129,12 @@ static inline int cifs_posix_open_inode_helper(struct inode *inode, struct file *file, struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) { - struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); -/* struct timespec temp; */ /* BB REMOVEME BB */ file->private_data = kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); if (file->private_data == NULL) return -ENOMEM; pCifsFile = cifs_init_private(file->private_data, inode, file, netfid); write_lock(&GlobalSMBSeslock); - list_add(&pCifsFile->tlist, &cifs_sb->tcon->openFileList); pCifsInode = CIFS_I(file->f_path.dentry->d_inode);