From patchwork Mon Mar 31 17:50:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 3917171 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 A6A849F370 for ; Mon, 31 Mar 2014 17:50:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D597620380 for ; Mon, 31 Mar 2014 17:50:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11ACE20386 for ; Mon, 31 Mar 2014 17:50:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbaCaRuY (ORCPT ); Mon, 31 Mar 2014 13:50:24 -0400 Received: from mail-qg0-f42.google.com ([209.85.192.42]:42811 "EHLO mail-qg0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753561AbaCaRuT (ORCPT ); Mon, 31 Mar 2014 13:50:19 -0400 Received: by mail-qg0-f42.google.com with SMTP id q107so7910162qgd.1 for ; Mon, 31 Mar 2014 10:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JwWumKZEADwcDhlY6JWnjizaVj899vttFDpdTU5giKE=; b=krval2lNfusBtN52JCEtCjZMk/BJtLeKLCErdSBxhY41biVFJ4YyAPsKdIQ0sQrm/R 6be37Yjw5H7tGDlFcBID1pfYDy3loxqHVzu5vLHQNBgXL0hsRjWLZnwp+9iqO8RFNrHA cnVlsbjNQDOdR1x+DOIabVg+56eiu/0eRe/u2wQCyTUQKbURieiQJHjEDwdxgin/y7jg LFjPhn8VXPL2bemTjMZAzpkmcRjidcNiR5bOO/Ih9dIucW+f3wBtBCe1Bf2kX8udc8UT bkYaMGXlFgNIxb8+OdktpkhJPN56qdXmggv1Ce0BC1ZYuo4t0s8M7RkeohiWiEDiXE0o qZxQ== X-Gm-Message-State: ALoCoQl09QwMfNwOcECRHTkIV9KxKR6ZhAgu1Po3IYjS+Dyfr2OBbyWyO5M+ayzVC/0rYUXzyawo X-Received: by 10.140.83.37 with SMTP id i34mr3958320qgd.100.1396288218738; Mon, 31 Mar 2014 10:50:18 -0700 (PDT) Received: from tlielax.poochiereds.net ([2001:470:8:d63:3a60:77ff:fe93:a95d]) by mx.google.com with ESMTPSA id i95sm14384104qge.5.2014.03.31.10.50.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Mar 2014 10:50:18 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, Tetsuo Handa Subject: [PATCH 2/4] cifs: new helper function: cifs_revalidate_mapping Date: Mon, 31 Mar 2014 13:50:07 -0400 Message-Id: <1396288209-27328-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1396288209-27328-1-git-send-email-jlayton@redhat.com> References: <1396288209-27328-1-git-send-email-jlayton@redhat.com> 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 3e9d8ba21f5c..39b76bac196d 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_INODE_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,