Whamcloud - gitweb
LU-10765 hsm: fix source_fd type in hsm_copyaction_private 80/58980/3
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 25 Apr 2025 22:12:13 +0000 (18:12 -0400)
committerOleg Drokin <green@whamcloud.com>
Wed, 7 May 2025 21:14:07 +0000 (21:14 +0000)
commitf33ff18431e8ac01519bb1b3d48ddc2f2f59a2e4
treefc9ea1300dffca66e5d4c79e649f774a7473c8c2
parent28c477a87a22b58056d6f371786043e872057d0f
LU-10765 hsm: fix source_fd type in hsm_copyaction_private

The source_fd field in struct hsm_copyaction_private was defined as
__u32 (unsigned), but was being used with -1 to indicate an invalid
file descriptor. This mismatch caused the error handling code to
incorrectly check if source_fd < 0, which is impossible for an
unsigned value, potentially leading to file descriptor leaks.

Change the type of source_fd from __u32 to __s32 to match how it's
used and to be consistent with data_fd which is already __s32.

Test-Parameters: trivial
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I41d74642d9906075ec7eda670e4c390d55fed297
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58980
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/liblustreapi_hsm.c