From patchwork Thu Apr 18 18:40:56 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: 10907849 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 205361390 for ; Thu, 18 Apr 2019 18:42:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09072285DB for ; Thu, 18 Apr 2019 18:42:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1F5028D5D; Thu, 18 Apr 2019 18:42:50 +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 9ADD928D5F for ; Thu, 18 Apr 2019 18:42:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389969AbfDRSmt (ORCPT ); Thu, 18 Apr 2019 14:42:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:60632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389900AbfDRSmt (ORCPT ); Thu, 18 Apr 2019 14:42:49 -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 14A882064A; Thu, 18 Apr 2019 18:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555612968; bh=fW6/gSecN9rL9T6eaX9s2wiLHRJ7o1d/JZYNU9JEKBM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSjAxcvHmB8DuG6aGtbe8FmpiIJWsJx3OjFja6vYD1vQ3twlSnTsVWfZ/e4IE+UDe gVj8CgyAEhAyGs0JLIZZPTozJElp09FBts5mwUzQsR+MJyCxVtOXKh51c9wBRpcuSO NgGmSL8Jw+ILS+YSuvVQ2Cm1/2wKo8U+zlCcnkyE= From: hubcap@kernel.org To: linux-fsdevel@vger.kernel.org, christoph@lameter.com Cc: Martin Brandenburg , Mike Marshall Subject: [PATCH 04/22] orangefs: update attributes rather than relying on server Date: Thu, 18 Apr 2019 14:40:56 -0400 Message-Id: <20190418184113.9152-5-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 should be a no-op now, but once inode writeback works, it'll be necessary to have the correct attribute in the dirty inode. Previously the attribute fetch timeout was marked invalid and the server provided the updated attribute. When the inode is dirty, the server cannot be consulted since it does not yet know the pending setattr. Signed-off-by: Martin Brandenburg Signed-off-by: Mike Marshall --- fs/orangefs/file.c | 10 ++-------- fs/orangefs/namei.c | 7 ++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index b0688ea894a4..a9e69c56d2fb 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c @@ -327,14 +327,8 @@ static ssize_t do_readv_writev(enum ORANGEFS_io_type type, struct file *file, file_accessed(file); } else { file_update_time(file); - /* - * Must invalidate to ensure write loop doesn't - * prevent kernel from reading updated - * attribute. Size probably changed because of - * the write, and other clients could update - * any other attribute. - */ - orangefs_inode->getattr_time = jiffies - 1; + if (*offset > i_size_read(inode)) + i_size_write(inode, *offset); } } diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 87584d79ca7a..140314b76e10 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -383,6 +383,7 @@ static int orangefs_rename(struct inode *old_dir, unsigned int flags) { struct orangefs_kernel_op_s *new_op; + struct iattr iattr; int ret; if (flags) @@ -392,7 +393,11 @@ static int orangefs_rename(struct inode *old_dir, "orangefs_rename: called (%pd2 => %pd2) ct=%d\n", old_dentry, new_dentry, d_count(new_dentry)); - ORANGEFS_I(new_dentry->d_parent->d_inode)->getattr_time = jiffies - 1; + new_dir->i_mtime = new_dir->i_ctime = current_time(new_dir); + memset(&iattr, 0, sizeof iattr); + iattr.ia_valid |= ATTR_MTIME; + orangefs_inode_setattr(new_dir, &iattr); + mark_inode_dirty_sync(new_dir); new_op = op_alloc(ORANGEFS_VFS_OP_RENAME); if (!new_op)