From patchwork Wed Apr 30 13:31:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 4093901 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 174D59F38E for ; Wed, 30 Apr 2014 13:32:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3482D20148 for ; Wed, 30 Apr 2014 13:32:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 517FA202AE for ; Wed, 30 Apr 2014 13:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933732AbaD3NcA (ORCPT ); Wed, 30 Apr 2014 09:32:00 -0400 Received: from mail-qc0-f182.google.com ([209.85.216.182]:52400 "EHLO mail-qc0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933549AbaD3Nb7 (ORCPT ); Wed, 30 Apr 2014 09:31:59 -0400 Received: by mail-qc0-f182.google.com with SMTP id m20so296232qcx.13 for ; Wed, 30 Apr 2014 06:31:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8NDntqb9pej4o1R+3NpnfSV342Ms39/VJT0qI+0MADQ=; b=BETmxwHQ+TWRh23vobXcUIzMEBf/eQy9YMx2OOJ8wEnVptMVRcSl9/5uLhB7DMCTOb EMvKL2kv5SmpgptWfRWsuvfFSj8zqWb56nvj0/vwATUyloEhY4NXtCVqfbJSYl/4OIvy SEngzBKZw+dgUztAKvF9adKRM81+1bnYLjYFqEODG7eCziapdtbWDAess6A4hrYg90j6 u6gOEyf8949NfTRhIHErd9LQWRrmU6lSerXNyUhq+766aDf7rPZwlYtXPdU66B5aFgHt AT5hTGOU8QHVrJqwhXZ8DI9AQAimROVLgW+9D9CX9KxrlBSIPIAKoHRDFsMPrXOGHgOR meUA== X-Gm-Message-State: ALoCoQkqvXY0BVBvQGmGSMVuZ5gIob7EVa88xFviI1g2DlEe0lFWNGznLfiAnRxmSpG+/tiJqGcP X-Received: by 10.140.23.166 with SMTP id 35mr4753768qgp.89.1398864718491; Wed, 30 Apr 2014 06:31:58 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id n105sm30733850qgd.7.2014.04.30.06.31.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Apr 2014 06:31:57 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Tetsuo Handa Subject: [PATCH v2 2/4] cifs: new helper function: cifs_revalidate_mapping Date: Wed, 30 Apr 2014 09:31:46 -0400 Message-Id: <1398864708-18185-3-git-send-email-jlayton@poochiereds.net> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398864708-18185-1-git-send-email-jlayton@poochiereds.net> References: <1398864708-18185-1-git-send-email-jlayton@poochiereds.net> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Consolidate a bit of code. In a later patch we'll expand this to fix some races. Signed-off-by: Jeff Layton --- fs/cifs/cifsfs.h | 1 + fs/cifs/inode.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 26a754f49ba1..40d5a4df1e38 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -67,6 +67,7 @@ extern int cifs_revalidate_dentry_attr(struct dentry *); extern int cifs_revalidate_file(struct file *filp); extern int cifs_revalidate_dentry(struct dentry *); extern int cifs_invalidate_mapping(struct inode *inode); +extern int cifs_revalidate_mapping(struct inode *inode); extern int cifs_getattr(struct vfsmount *, struct dentry *, struct kstat *); extern int cifs_setattr(struct dentry *, struct iattr *); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index fa9ef8d902b5..ff420b275777 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1779,6 +1779,14 @@ cifs_invalidate_mapping(struct inode *inode) return rc; } +int +cifs_revalidate_mapping(struct inode *inode) +{ + if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags)) + return cifs_invalidate_mapping(inode); + return 0; +} + int cifs_revalidate_file_attr(struct file *filp) { int rc = 0; @@ -1845,9 +1853,7 @@ int cifs_revalidate_file(struct file *filp) if (rc) return rc; - if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags)) - rc = cifs_invalidate_mapping(inode); - return rc; + return cifs_revalidate_mapping(inode); } /* revalidate a dentry's inode attributes */ @@ -1860,9 +1866,7 @@ int cifs_revalidate_dentry(struct dentry *dentry) if (rc) return rc; - if (test_bit(CIFS_INO_INVALID_MAPPING, &CIFS_I(inode)->flags)) - rc = cifs_invalidate_mapping(inode); - return rc; + return cifs_revalidate_mapping(inode); } int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,