fs: don't block write during exec on pre-content watched files
authorAmir Goldstein <amir73il@gmail.com>
Thu, 28 Nov 2024 14:25:32 +0000 (15:25 +0100)
committerJan Kara <jack@suse.cz>
Wed, 11 Dec 2024 16:45:18 +0000 (17:45 +0100)
commit0357ef03c94ef835bd44a0658b8edb672a9dbf51
tree048ac20bb32843d457b0314075e6e2522f0f0a16
parent5121711eb8dbcbed70b1db429a4665f413844164
fs: don't block write during exec on pre-content watched files

Commit 2a010c412853 ("fs: don't block i_writecount during exec") removed
the legacy behavior of getting ETXTBSY on attempt to open and executable
file for write while it is being executed.

This commit was reverted because an application that depends on this
legacy behavior was broken by the change.

We need to allow HSM writing into executable files while executed to
fill their content on-the-fly.

To that end, disable the ETXTBSY legacy behavior for files that are
watched by pre-content events.

This change is not expected to cause regressions with existing systems
which do not have any pre-content event listeners.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20241128142532.465176-1-amir73il@gmail.com
fs/binfmt_elf.c
fs/binfmt_elf_fdpic.c
fs/exec.c
include/linux/fs.h
kernel/fork.c