Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1579323rwd; Wed, 31 May 2023 16:23:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Mskeo6Q8kvj2gFnvw6Zjxe7tZeFsjGrTaPSlulA95ezpeqn0F0Np3AidsraAIQdrma8W4 X-Received: by 2002:a05:6a00:2184:b0:64d:1c59:6767 with SMTP id h4-20020a056a00218400b0064d1c596767mr5917748pfi.24.1685575411283; Wed, 31 May 2023 16:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685575411; cv=none; d=google.com; s=arc-20160816; b=FcfAkfRLRfvwWhn+yl/hpoGNyOb6K/UYIEzKx6A3jzKL/VZj5OZDlV1kHDjUgkQLHN nSMTqerUHCIZAKoUGWK4vIYxTQu2fuCDEKXCaVKVxNNXebdhshT3DlpstwDC7mpialwz eaKwQyNTJsIR7+qMUaNtpZxRszODEiw2dQIuI2g7U6ff1GlfR5hIZ2L87YxcJcIvgMtL KDOK/K+mkqgArgDn1ARWVPpNfcc4NOR9i0VrtyyNEGJ0oZWAnkn0x8V5IqOxsLLHNZUi vNfjlb8CbIhuLlWiMnaTGJHqLzJmyRkwJYWFVMpKCIl/j8gKylzfL/upVVgCuBw/UAk1 xKXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:from:organization :dkim-signature; bh=zpHJAAZtdS1eGDoBPdNCfJy7V4CHGDGY+NY0zDJG5HY=; b=hhJdegeuIn1DYI3RYFiFFrB8JDMHkCEEAfrnBKK/NRvb4kzGV7PSkSbksyfFDvlO6h dpSz2f4WiNCE8ga28JUlgAA3wjRF0h10+lEw2jFANt8BV62vGH9PlhzW8A0ww3fnc9e9 AHmktKR+SfjH1te7OCdCAwS7qLlxw1QYkkjlzD1AUnAbJNMyUSZuQpVa09M2mayucyi9 jMQDLGhdN3P5CQdTS24KpucSLmi/SMBXr4afWCGubZzCsrppeshySy/xUjh1VfGrhbtZ XG2PIn7fqyjQHzw5uUA6lrvI/JiR+3N6j4NX5iQgx/wdkDLJnpVJjPP43VsewzsXTG2E Ci3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XxN7dlzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z129-20020a626587000000b0064d28796335si2975579pfb.92.2023.05.31.16.23.16; Wed, 31 May 2023 16:23:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XxN7dlzJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229638AbjEaWvE (ORCPT + 99 others); Wed, 31 May 2023 18:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbjEaWvC (ORCPT ); Wed, 31 May 2023 18:51:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68D759F for ; Wed, 31 May 2023 15:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685573415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zpHJAAZtdS1eGDoBPdNCfJy7V4CHGDGY+NY0zDJG5HY=; b=XxN7dlzJepmhs2+dOo1erZYTkHUU6dnVAh+N5dqjZpRK4ZWNA1YJKp5qd1dM2aNTN/S/sw uyG566EOsgWmMolGMimrBFCt+XmbpE+bHz7KTU9fwIVTa+ef2lOrxo30T1qeIVgbOKupVz AAh0IJuhy1Q90eQcxW+mQI0IpMirZ9A= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-7f37sz9DMzaFOEFZovZXsQ-1; Wed, 31 May 2023 18:50:14 -0400 X-MC-Unique: 7f37sz9DMzaFOEFZovZXsQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 948E6800159; Wed, 31 May 2023 22:50:13 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE2932166B25; Wed, 31 May 2023 22:50:12 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Marc Dionne cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] afs: Fix setting of mtime when creating a file/dir/symlink MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <808139.1685573412.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 31 May 2023 23:50:12 +0100 Message-ID: <808140.1685573412@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org = kafs incorrectly passes a zero mtime (ie. 1st Jan 1970) to the server when creating a file, dir or symlink because commit 52af7105eceb caused the mtime recorded in the afs_operation struct to be passed to the server, but didn't modify the afs_mkdir(), afs_create() and afs_symlink() functions to set it first. Those functions were written with the assumption that the mtime would be obtained from the server - but that fell foul of malsynchronised clocks, s= o it was decided that the mtime should be set from the client instead. Fix this by filling in op->mtime before calling the create op. Fixes: 52af7105eceb ("afs: Set mtime from the client for yfs create operat= ions") Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org --- fs/afs/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 4dd97afa536c..5219182e52e1 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -1358,6 +1358,7 @@ static int afs_mkdir(struct mnt_idmap *idmap, struct= inode *dir, op->dentry =3D dentry; op->create.mode =3D S_IFDIR | mode; op->create.reason =3D afs_edit_dir_for_mkdir; + op->mtime =3D current_time(dir); op->ops =3D &afs_mkdir_operation; return afs_do_sync_operation(op); } @@ -1661,6 +1662,7 @@ static int afs_create(struct mnt_idmap *idmap, struc= t inode *dir, op->dentry =3D dentry; op->create.mode =3D S_IFREG | mode; op->create.reason =3D afs_edit_dir_for_create; + op->mtime =3D current_time(dir); op->ops =3D &afs_create_operation; return afs_do_sync_operation(op); = @@ -1796,6 +1798,7 @@ static int afs_symlink(struct mnt_idmap *idmap, stru= ct inode *dir, op->ops =3D &afs_symlink_operation; op->create.reason =3D afs_edit_dir_for_symlink; op->create.symlink =3D content; + op->mtime =3D current_time(dir); return afs_do_sync_operation(op); = error: