From patchwork Wed Sep 29 05:38:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 216442 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 o8T5ciAu009684 for ; Wed, 29 Sep 2010 05:38:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277Ab0I2Fio (ORCPT ); Wed, 29 Sep 2010 01:38:44 -0400 Received: from mail-qy0-f174.google.com ([209.85.216.174]:38400 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357Ab0I2Fin convert rfc822-to-8bit (ORCPT ); Wed, 29 Sep 2010 01:38:43 -0400 Received: by qyk36 with SMTP id 36so484269qyk.19 for ; Tue, 28 Sep 2010 22:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=Wc1s+DRp1hlKvpgketJtivHAs5L1XcHFOSM8FkwntPc=; b=DPDG5oGBYk6Dr9LX84d/5lU1CcT2hYwppuIrQHvy3Z02zC6h7eO92/ehOhtqDIrIE+ JI17JJxb2jD044yqGDmURmMgsFeLFHIEVTL+9+O7MJIjtrm0OgIw1xjOaE3Ru7LwlMfF WCon0piGoT2ZqitCEXPzXXmw+PytFqp9avK9Y= 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:content-transfer-encoding; b=lgZ1plv0rOE0wxcgBCMqu2YXBmOjKHnXQziJIHQNhGaxrN31uUy6P2a2BNgPXnpP6L cwUEUtJyiGmp+CgijeASgOSAWUyHjyOHglTMObXA2DsQFyPVJl7A8Lz+xtCfBfWcRoWu et5MlX2vu5aKG9bN6w8geMPqWSTG24i2+YC/s= MIME-Version: 1.0 Received: by 10.224.60.19 with SMTP id n19mr709297qah.248.1285738690220; Tue, 28 Sep 2010 22:38:10 -0700 (PDT) Received: by 10.229.13.166 with HTTP; Tue, 28 Sep 2010 22:38:10 -0700 (PDT) In-Reply-To: References: Date: Wed, 29 Sep 2010 09:38:10 +0400 Message-ID: Subject: Re: [PATCH 3/3] CIFS: Invaldate remote inode on the last close From: Pavel Shilovsky To: linux-cifs@vger.kernel.org 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, 29 Sep 2010 05:38:45 +0000 (UTC) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index de046e1..68e1789 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -153,9 +153,16 @@ psx_client_can_cache:                pCifsInode->clientCanCacheAll = true;                pCifsInode->clientCanCacheRead = true;                cFYI(1, "Exclusive Oplock granted on inode %p", -                        file->f_path.dentry->d_inode); -       } else if ((oplock & 0xF) == OPLOCK_READ) +                    file->f_path.dentry->d_inode); +       } else if ((oplock & 0xF) == OPLOCK_READ) { +               pCifsInode->clientCanCacheAll = false;                pCifsInode->clientCanCacheRead = true; +               cFYI(1, "Level II Oplock granted on inode %p", +                    file->f_path.dentry->d_inode); +       } else { +               pCifsInode->clientCanCacheAll = false; +               pCifsInode->clientCanCacheRead = false; +       }        /* will have to change the unlock if we reenable the           filemap_fdatawrite (which does not seem necessary */ @@ -211,8 +218,14 @@ client_can_cache:                pCifsInode->clientCanCacheAll = true;                pCifsInode->clientCanCacheRead = true;                cFYI(1, "Exclusive Oplock granted on inode %p", inode); -       } else if ((oplock & 0xF) == OPLOCK_READ) +       } else if ((oplock & 0xF) == OPLOCK_READ) { +               pCifsInode->clientCanCacheAll = false;                pCifsInode->clientCanCacheRead = true; +               cFYI(1, "Level II Oplock granted on inode %p", inode); +       } else { +               pCifsInode->clientCanCacheAll = false; +               pCifsInode->clientCanCacheRead = false; +       }        return rc;  } @@ -633,6 +646,8 @@ int cifs_close(struct inode *inode, struct file *file)                   on this inode, much less write behind and read ahead */                CIFS_I(inode)->clientCanCacheRead = false;                CIFS_I(inode)->clientCanCacheAll  = false; +               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_STRICT_IO) +                       invalidate_remote_inode(inode);        }        read_unlock(&GlobalSMBSeslock);        if ((rc == 0) && CIFS_I(inode)->write_behind_rc)