From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C06AC7EE2E for ; Mon, 12 Jun 2023 10:48:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbjFLKsX (ORCPT ); Mon, 12 Jun 2023 06:48:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230054AbjFLKr6 (ORCPT ); Mon, 12 Jun 2023 06:47:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A5C0469E; Mon, 12 Jun 2023 03:32:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 59E8D61500; Mon, 12 Jun 2023 10:32:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B86DC433D2; Mon, 12 Jun 2023 10:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686565967; bh=4JEuqK24RTZHbmzS7TylCNb/mAwUm4REqmtTWQI/w5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nbo9HcGghtnSIcjew/TWxzbR/gT49bNVstENig0a6BvqAj5l3SgsYJUgLZ0moR9s9 4qPODriNfNzP0slMG0ITzX77YZ/TVug5vKtPGDj1aFSIQc6eBCrt1QoTNEWGvf1AfS MPemIVjvLlhOhaE/f7z6k+hdP6hdSclKMCzSssOE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Howells , Jeffrey Altman , Marc Dionne , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.10 14/68] afs: Fix setting of mtime when creating a file/dir/symlink Date: Mon, 12 Jun 2023 12:26:06 +0200 Message-ID: <20230612101659.057271793@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612101658.437327280@linuxfoundation.org> References: <20230612101658.437327280@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: David Howells [ Upstream commit a27648c742104a833a01c54becc24429898d85bf ] 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" concept") 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 Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/afs/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 159795059547f..a59d6293a32b2 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -1313,6 +1313,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) op->dentry = dentry; op->create.mode = S_IFDIR | mode; op->create.reason = afs_edit_dir_for_mkdir; + op->mtime = current_time(dir); op->ops = &afs_mkdir_operation; return afs_do_sync_operation(op); } @@ -1616,6 +1617,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode, op->dentry = dentry; op->create.mode = S_IFREG | mode; op->create.reason = afs_edit_dir_for_create; + op->mtime = current_time(dir); op->ops = &afs_create_operation; return afs_do_sync_operation(op); @@ -1745,6 +1747,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry, op->ops = &afs_symlink_operation; op->create.reason = afs_edit_dir_for_symlink; op->create.symlink = content; + op->mtime = current_time(dir); return afs_do_sync_operation(op); error: -- 2.39.2