From patchwork Sun Nov 21 19:32:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 346131 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 oALJVrP5019874 for ; Sun, 21 Nov 2010 19:32:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752992Ab0KUTcZ (ORCPT ); Sun, 21 Nov 2010 14:32:25 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:36028 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752433Ab0KUTcY (ORCPT ); Sun, 21 Nov 2010 14:32:24 -0500 Received: by eye27 with SMTP id 27so3553862eye.19 for ; Sun, 21 Nov 2010 11:32:23 -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=GT1Le54J+r09+p+71l3sAqoXhqkQysUpDC/OB6nCfmY=; b=WESBI4oNJe9DPaw0znbtYmW3Rl8HvlG0CiNwd0/IAWr17OlJWbso11WPH0T/piogz2 XeRifqSitNoeqXmeBBrgA7isXkx15lEziO2CLTnX9t9EWHUpGEZ6nlRBtYLW7QVQrGCF dPtaqMWdqbaofuWSEYxp89H1xHCquGBd4NSII= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; b=P5p2dIRnDJyTgzOfuuhDtzaE1jvSqzw8niGuJJiArPJnKnw7cx11CBjSMJa16Gv/6S Wlc3/wN1oBuixbACIf7HGUdDdy3YYQ+9XkkhyAMxuBHYDGTlcptfZkBqB4YgpQU+Vi6S XLF81A7H3YtZ6gwKNvFlm6jwuF8dOkm8S0m+g= Received: by 10.213.11.12 with SMTP id r12mr3783566ebr.91.1290367943530; Sun, 21 Nov 2010 11:32:23 -0800 (PST) Received: from localhost.localdomain ([95.84.57.127]) by mx.google.com with ESMTPS id x54sm3913706eeh.5.2010.11.21.11.32.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 21 Nov 2010 11:32:22 -0800 (PST) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Subject: [PATCH] CIFS: Make cifsFileInfo_put work with strict cache mode (try #2) Date: Sun, 21 Nov 2010 22:32:17 +0300 Message-Id: <1290367937-11170-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:32:25 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 08bd364..aeda334 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -217,6 +217,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); @@ -232,6 +233,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);