]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
afs: Fix setting of mtime when creating a file/dir/symlink
authorDavid Howells <dhowells@redhat.com>
Wed, 7 Jun 2023 08:47:13 +0000 (09:47 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 09:16:43 +0000 (11:16 +0200)
commit2f77eb2f02cc33513e57f636165c38fab3136940
tree3af8a67c306fc3db35e2c1504dd0534408809161
parentb4efa42b1bd02ff462a161e546e3f85a56916237
afs: Fix setting of mtime when creating a file/dir/symlink

[ 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 <dhowells@redhat.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/dir.c