From patchwork Sun Nov 21 19:43:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 346141 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 oALJhugm026071 for ; Sun, 21 Nov 2010 19:43:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752433Ab0KUTnz (ORCPT ); Sun, 21 Nov 2010 14:43:55 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:61941 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752706Ab0KUTny (ORCPT ); Sun, 21 Nov 2010 14:43:54 -0500 Received: by ewy5 with SMTP id 5so1329760ewy.19 for ; Sun, 21 Nov 2010 11:43:52 -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; bh=Priox6ANU0M746zU3N7B+lReCPCAR2Z0hI/ExGbKdio=; b=VT0n2EuziwQYlQsJmRmDkm1ZKJMEztQqaVaWmqvwRYFqb1uGfn5YNrP++oYS47r7XJ ni/S/3dbRGglD2E9k37PvADuxBkaSe1YewlCARfqW80VDJLFNLQV6b4eecErHl3LmZuD HOBH0anZ7V14OWzsejtC719dcC2yrW3xxwaiQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=ZLYgCPae3S/1DehfAYUGT5O+w1VngXqHW30CORQtAj/TnAn/LV2x8eox3V2siCTB92 O6Rqjf2NWPnPVkKXhTjNFKa5yxdv0YItSmizJAii1Lw/NY/79dYj6BvbqaixZorLftIU qSVzv8fyCCIt3jvJUP1oeXP3muRmxf8Ap1+uk= Received: by 10.213.29.68 with SMTP id p4mr6805742ebc.31.1290368632748; Sun, 21 Nov 2010 11:43:52 -0800 (PST) Received: from localhost.localdomain ([95.84.57.127]) by mx.google.com with ESMTPS id w20sm3923457eeh.6.2010.11.21.11.43.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Nov 2010 11:43:52 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH] CIFS: Make cifsFileInfo_put work with strict cache mode (try #3) Date: Sun, 21 Nov 2010 22:43:38 +0300 Message-Id: <1290368618-12918-1-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.3.2 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]); Sun, 21 Nov 2010 19:43:57 +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 b857ce5..f853bf0 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -264,6 +264,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 +280,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);