From patchwork Mon Apr 4 20:26:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Brandenburg X-Patchwork-Id: 8744121 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2F97F9F38C for ; Mon, 4 Apr 2016 20:27:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 54902201EF for ; Mon, 4 Apr 2016 20:27:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7318C201CE for ; Mon, 4 Apr 2016 20:27:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756536AbcDDU1e (ORCPT ); Mon, 4 Apr 2016 16:27:34 -0400 Received: from mail-yw0-f171.google.com ([209.85.161.171]:33603 "EHLO mail-yw0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754917AbcDDU0o (ORCPT ); Mon, 4 Apr 2016 16:26:44 -0400 Received: by mail-yw0-f171.google.com with SMTP id t10so79343232ywa.0 for ; Mon, 04 Apr 2016 13:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omnibond-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=oa6JPw+QvfzUQNJUzZyLgCffaR4iPmYFSsZlZNasxVs=; b=GxlfpOwLLIM9hTu4PfgghxnpLjGVcPW9TD2Pz8TDMdZ80CTvk6Vv4LLaEQLvD1YZVU Mcv8BlfnHe3ZwR12lp7Ku64CldtKgzZij6OVCsLFUXbcd1QQxwgz32ZXnMpffXVSTObR p4do8dLFbdnjfeKNJGbOyepvHsYMDqh6C/VmAnVFRKaGs7W55xuO1gPYlrLONVwEVjlM 7BkHbVzi3hPbBtIOebHG0Z220t36a/eV2Yg2v39GrdvgwdSaWUAnDWDOtVj72tYU9CYS BM3Yn2aXcg24p61pYnc/PbZSgzTKs9+CuuxN9Cpp+S3WidmXTPKOt0a+ki3BPQkBEfmv OURg== 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; bh=oa6JPw+QvfzUQNJUzZyLgCffaR4iPmYFSsZlZNasxVs=; b=BNpQM3k2RBBbyIR1V+hO7wvd5hmO2kWcOO4CETJc9BDR6qQtkCKRJQVNUf90j3wfJU jLLFzkgw4bGbwKkIpv6OhdRI0xIgENq12qjtF/vip4k1kxUe9cqVfnosNEDQvlJVIchW x9cwCcgH+40U0eWzS7zuHU36eKCFTWIa4lN33I4hEOn8RNCzLmRXBkgRZEphCX4ZR/6B 2JOfP+SA5HHcWCAtJyfM4S4hYOkBbQzWxAWfxnHyDA19ld6r3Eip8pb9Nf9nrv/t4pzh m4unaNK0HC//30ZUsPdn0CuIn6hrMSgAU7AGdmQusrJ9mr77390BWB5t4nlPAsPGOJIx HF+A== X-Gm-Message-State: AD7BkJJR+lZUAx7TEDh8lQcQIrtZV7TPc1ZOo3VscNpIJbaPnPz/plgySF02U+19I+c+9w== X-Received: by 10.129.155.7 with SMTP id s7mr16048637ywg.146.1459801603092; Mon, 04 Apr 2016 13:26:43 -0700 (PDT) Received: from mailclient9.clemson.edu ([130.127.148.93]) by smtp.gmail.com with ESMTPSA id o63sm18484204ywb.9.2016.04.04.13.26.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Apr 2016 13:26:42 -0700 (PDT) From: Martin Brandenburg X-Google-Original-From: Martin Brandenburg To: hubcap@omnibond.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Martin Brandenburg Subject: [PATCH 1/3] orangefs: clean up truncate ctime and mtime setting Date: Mon, 4 Apr 2016 16:26:36 -0400 Message-Id: <1459801598-12757-1-git-send-email-martin@martinbrandenburg.com> X-Mailer: git-send-email 2.7.4 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Martin Brandenburg The ctime and mtime are always updated on a successful ftruncate and only updated on a successful truncate where the size changed. We handle the ``if the size changed'' bit. This matches FUSE's behavior. Signed-off-by: Martin Brandenburg --- fs/orangefs/inode.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 2382e26..975a796 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -204,22 +204,8 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr) if (ret != 0) return ret; - /* - * Only change the c/mtime if we are changing the size or we are - * explicitly asked to change it. This handles the semantic difference - * between truncate() and ftruncate() as implemented in the VFS. - * - * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a - * special case where we need to update the times despite not having - * these flags set. For all other operations the VFS set these flags - * explicitly if it wants a timestamp update. - */ - if (orig_size != i_size_read(inode) && - !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { - iattr->ia_ctime = iattr->ia_mtime = - current_fs_time(inode->i_sb); + if (orig_size != i_size_read(inode)) iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; - } return ret; }