From patchwork Wed Nov 10 15:41:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 314582 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAAFqBYn032081 for ; Wed, 10 Nov 2010 15:52:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756759Ab0KJPv4 (ORCPT ); Wed, 10 Nov 2010 10:51:56 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:37971 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756754Ab0KJPvy (ORCPT ); Wed, 10 Nov 2010 10:51:54 -0500 Received: by eye27 with SMTP id 27so389688eye.19 for ; Wed, 10 Nov 2010 07:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:x-mailer:in-reply-to:references; bh=IXIBivUUs3HVOFYAshXzAdqUo+GfduPukInnV2fIpiw=; b=aNP0DTPl/qcpg2i8Y+sW2DEUtd7kgfNtFutboTBfyMfBKEXgvgl9oRJf0gw2ikc/UK 0LRxGSgU5dK+P7KOPN44s4yP1YI7c9nK7nQ+b1mm8P128WaxUVN9pjvmg1Gp8xWpfrg6 PhEM0nmu8SiqgWmq5fhMg6bzwx1Ysz9wftNzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=Fd8sn/Vu2X4w1XZSzGecpmJylPdfzc79/p7Hs/Z8Rp7ujiYJIpnxvkVjgDSFF+sF1m +0NjHZsHkspkN6s2EIpKbIt9+slpYPVf8AMwqcaVe7cuiQct7Wil6NI9ZD5jB6NtL5+N X7dBLWm7SP70TPE0yKZ9h4CVfgUWjR0y5fAmA= Received: by 10.213.33.82 with SMTP id g18mr4873003ebd.64.1289403751331; Wed, 10 Nov 2010 07:42:31 -0800 (PST) Received: from localhost.localdomain ([79.126.90.150]) by mx.google.com with ESMTPS id w20sm815303eeh.0.2010.11.10.07.42.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Nov 2010 07:42:30 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH 1/6] CIFS: Make cifsFileInfo_put work with strict cache mode Date: Wed, 10 Nov 2010 18:41:46 +0300 Message-Id: <1289403711-12965-2-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1289403711-12965-1-git-send-email-piastryyy@gmail.com> References: <1289403711-12965-1-git-send-email-piastryyy@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 10 Nov 2010 15:52:12 +0000 (UTC) diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h index e9a393c..be7b159 100644 --- a/fs/cifs/cifs_fs_sb.h +++ b/fs/cifs/cifs_fs_sb.h @@ -40,6 +40,7 @@ #define CIFS_MOUNT_FSCACHE 0x8000 /* local caching enabled */ #define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */ #define CIFS_MOUNT_MULTIUSER 0x20000 /* multiuser mount */ +#define CIFS_MOUNT_STRICT_IO 0x40000 /* strict cache mode */ struct cifs_sb_info { struct rb_root tlink_tree; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 06c3e83..88bb366 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -148,6 +148,9 @@ client_can_cache: cifs_set_oplock_level(pCifsInode, oplock); + if (pCifsInode->invalid_mapping) + invalidate_remote_inode(inode); + return rc; } @@ -250,6 +253,9 @@ cifs_new_fileinfo(__u16 fileHandle, struct file *file, cifs_set_oplock_level(pCifsInode, oplock); + if (pCifsInode->invalid_mapping) + invalidate_remote_inode(inode); + file->private_data = pCifsFile; return pCifsFile; } @@ -264,6 +270,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) struct inode *inode = cifs_file->dentry->d_inode; struct cifsTconInfo *tcon = tlink_tcon(cifs_file->tlink); struct cifsInodeInfo *cifsi = CIFS_I(inode); + struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifsLockInfo *li, *tmp; spin_lock(&cifs_file_list_lock); @@ -279,6 +286,13 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) if (list_empty(&cifsi->openFileList)) { cFYI(1, "closing last open instance for inode %p", cifs_file->dentry->d_inode); + + /* in strict cache mode we need invalidate mapping on the last + close because it may cause a error when we open this file + again and get at least level II oplock */ + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) + CIFS_I(inode)->invalid_mapping = true; + cifs_set_oplock_level(cifsi, 0); } spin_unlock(&cifs_file_list_lock);