diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-11-06 14:14:35 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-11-09 16:04:55 +0100 |
| commit | 1448959fe3d013ffdb8302d17e4a8fdad2d2da95 (patch) | |
| tree | 19d0a5e515137f8be6f21c7c07d8892b37814ec8 /include/linux | |
| parent | 8eaa35c6c29ae669949f4b5b0814c3d34c8ed658 (diff) | |
fs: fix the SEEK_CUR f_lock condition
Commit da06e3c51794 ("fs: don't needlessly acquire f_lock") wanted to
skip f_lock for SEEK_CUR on files that already serialize f_pos through
f_pos_lock, i.e. FMODE_ATOMIC_POS files and directories, and keep it
for everything else. The condition it added does the opposite:
file_seek_cur_needs_f_lock() returns false exactly for the files that
never take f_pos_lock and true for the ones that do.
So since v6.15 a SEEK_CUR on a shared block device or on a character
device that uses fixed_size_llseek() updates f_pos without any lock and
two concurrent calls can lose an update, while regular files and
directories pay for a spinlock they don't need.
Invert the condition.
Fixes: da06e3c51794 ("fs: don't needlessly acquire f_lock")
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261106-work-file-seek_f_lock-v1-1-5b9a6c2928d4@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
