From patchwork Thu Apr 18 18:40:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hubcap@kernel.org X-Patchwork-Id: 10907855 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF6031390 for ; Thu, 18 Apr 2019 18:42:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7FCE285DB for ; Thu, 18 Apr 2019 18:42:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CBE928D5E; Thu, 18 Apr 2019 18:42:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40B4C285DB for ; Thu, 18 Apr 2019 18:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389982AbfDRSmw (ORCPT ); Thu, 18 Apr 2019 14:42:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:60678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389894AbfDRSmw (ORCPT ); Thu, 18 Apr 2019 14:42:52 -0400 Received: from localhost.localdomain (unknown [24.213.116.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B2C42186A; Thu, 18 Apr 2019 18:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555612971; bh=yLKrUF7LHL+qIHJCbzNd1+2kWal97OPMoqGB96ar1S4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q0M6iyf7SyZTyWIPECBeXPDfkc5oBDA6QMto0xPzPZq0J4gDkNHSZkQQ4+ON9vi1H 6CjLWloPpLgJcQUpNxPbelkH/Sbwklu97RFBT7KbFNVkLFfs5OlHLXJ1SOxrDoDhSW JG7K4lEUWVQGd21AQJIF+y8iaGsG9ZkkRztRhpgM= From: hubcap@kernel.org To: linux-fsdevel@vger.kernel.org, christoph@lameter.com Cc: Martin Brandenburg , Mike Marshall Subject: [PATCH 07/22] orangefs: let setattr write to cached inode Date: Thu, 18 Apr 2019 14:40:59 -0400 Message-Id: <20190418184113.9152-8-hubcap@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190418184113.9152-1-hubcap@kernel.org> References: <20190418184113.9152-1-hubcap@kernel.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Brandenburg This is a fairly big change, but ultimately it's not a lot of code. Implement write_inode and then avoid the call to orangefs_inode_setattr within orangefs_setattr. Signed-off-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/inode.c | 11 +++-------- fs/orangefs/super.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 222ef7be0c7c..2e630c1f7ae2 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -207,8 +207,8 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr) */ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr) { - int ret = -EINVAL; struct inode *inode = dentry->d_inode; + int ret; gossip_debug(GOSSIP_INODE_DEBUG, "%s: called on %pd\n", @@ -228,16 +228,11 @@ int orangefs_setattr(struct dentry *dentry, struct iattr *iattr) setattr_copy(inode, iattr); mark_inode_dirty(inode); - ret = orangefs_inode_setattr(inode, iattr); - gossip_debug(GOSSIP_INODE_DEBUG, - "%s: orangefs_inode_setattr returned %d\n", - __func__, - ret); - - if (!ret && (iattr->ia_valid & ATTR_MODE)) + if (iattr->ia_valid & ATTR_MODE) /* change mod on a file that has ACLs */ ret = posix_acl_chmod(inode, inode->i_mode); + ret = 0; out: gossip_debug(GOSSIP_INODE_DEBUG, "%s: ret:%d:\n", __func__, ret); return ret; diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index ef3388c90ff7..f27da3bbafac 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -152,6 +152,22 @@ static void orangefs_destroy_inode(struct inode *inode) call_rcu(&inode->i_rcu, orangefs_i_callback); } +static int orangefs_write_inode(struct inode *inode, + struct writeback_control *wbc) +{ + struct iattr iattr; + gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_write_inode\n"); + iattr.ia_valid = ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_ATIME | + ATTR_ATIME_SET | ATTR_MTIME | ATTR_MTIME_SET | ATTR_CTIME; + iattr.ia_mode = inode->i_mode; + iattr.ia_uid = inode->i_uid; + iattr.ia_gid = inode->i_gid; + iattr.ia_atime = inode->i_atime; + iattr.ia_mtime = inode->i_mtime; + iattr.ia_ctime = inode->i_ctime; + return orangefs_inode_setattr(inode, &iattr); +} + /* * NOTE: information filled in here is typically reflected in the * output of the system command 'df' @@ -310,6 +326,7 @@ void fsid_key_table_finalize(void) static const struct super_operations orangefs_s_ops = { .alloc_inode = orangefs_alloc_inode, .destroy_inode = orangefs_destroy_inode, + .write_inode = orangefs_write_inode, .drop_inode = generic_delete_inode, .statfs = orangefs_statfs, .remount_fs = orangefs_remount_fs,