Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp447443rwd; Wed, 7 Jun 2023 02:05:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4XMPUtGVGfhqitVMcTAdjN+7PyTRqq32dPWck7oIpSBVbeTM3fHASNnKIH46aCNiUHAtyy X-Received: by 2002:a05:6a00:2401:b0:656:3d3a:da9c with SMTP id z1-20020a056a00240100b006563d3ada9cmr3642695pfh.2.1686128756368; Wed, 07 Jun 2023 02:05:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686128756; cv=none; d=google.com; s=arc-20160816; b=AibHhLSEdeKZbqtQ5fBhBduNS7rfVZdXIs/3n8yq+GB3zM5o0bSzvm4L34GzKxCM2Q AvzE2s0WwnnScTtPP1qwaT2ad66Hb9GtPWLIgmXvbfIdqW2H5flGXjSihKY6J2VfB5bh o3zW0/7spmc4fr1ZmWkmDwm0k0dMaL1eiWMjTQwNW1ojZUinVb2GIx0Q5IN6ID+fvQBk 3pkg22sBMfH4s6v5iIMEG1LCwm9e6k0rroOfkQ4v4ILWf13CHEdzSMZLHILLtPulSuQw M3TKUtbkw/MDlLl8GO5/yGccVfB/kb9kJ3k2woAxyw1+i3xMuab+e2pXBSjNE5ndqdfH OZug== 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=8b14LlHo3zt86QE7i50t7gWF3Pe+IncdMmgq5VH/CA4=; b=Fg3BWZiT7dgeUqvxfr7ri3ZTLf+b4JPN/nwb6s5gQCrWEdzjPd6HCXL5YLtMbgyhtl XyaQ4K7Fn+VZyjFJs/w9DDnWug6IrtXmxQyNEZy/VwaFVEtoYBgVKvNE0bp9XE63899o kcjENNTijJr6qOBT22WAnCEFrnZM4qwUan9Aeu5JNcSlDejiA/GaJ3UaJ0/FhyAy7oNx W2Q7dlsvcXG1MIoWVHenfumwRFNFdMKnXuat50Jc5oYXPWjaok+dUcJJhJLYn+l6h+KJ Z4/MWPdclBgLIA7ZKpNHEE2C1DhxyTccIbYxBORJg69MyaCOUoB1SKvMywMrdy4A2W0Z IKwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MWPsrQdc; 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 e18-20020a637452000000b0053fb7f98c63si8352819pgn.778.2023.06.07.02.05.44; Wed, 07 Jun 2023 02:05:56 -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=MWPsrQdc; 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 S239328AbjFGIsJ (ORCPT + 99 others); Wed, 7 Jun 2023 04:48:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239301AbjFGIsI (ORCPT ); Wed, 7 Jun 2023 04:48:08 -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 A3B8911F for ; Wed, 7 Jun 2023 01:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686127642; 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=8b14LlHo3zt86QE7i50t7gWF3Pe+IncdMmgq5VH/CA4=; b=MWPsrQdcsKzUKkNS+vS+Lfq/0sLRKVzv4hlG9gucV1d3hvcKgIB1tXu8wqgMBKosRTKos+ r3FmOZcsD5Hk+M01KE7iNEK0P7hGF1BYVST9MWsDTd3hdizCfdsKXoUPVT/7vm7a4VmE0E +DKqcG5v1JP0n/YLUwgtsPopHAvjTZY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-xw3_LTiZMzKbmW33Oy1jXQ-1; Wed, 07 Jun 2023 04:47:15 -0400 X-MC-Unique: xw3_LTiZMzKbmW33Oy1jXQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9527B1C0171B; Wed, 7 Jun 2023 08:47:14 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id AE3AB40CFD46; Wed, 7 Jun 2023 08:47:13 +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: torvalds@linux-foundation.org cc: dhowells@redhat.com, Jeffrey Altman , Marc Dionne , 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: <2004569.1686127633.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 07 Jun 2023 09:47:13 +0100 Message-ID: <2004570.1686127633@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 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=unavailable 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 the mtime recorded in the afs_operation struct gets passed to the server by the marshalling routines= , but the afs_mkdir(), afs_create() and afs_symlink() functions don't set it= . This gets masked if a file or directory is subsequently modified. Fix this by filling in op->mtime before calling the create op. Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" conc= ept") Signed-off-by: David Howells Reviewed-by: Jeffrey Altman Reviewed-by: 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: