Re: [EXTERNAL] [PATCH v2 2/7] ceph: use proper endian conversion for flock_len in reconnect

From: Viacheslav Dubeyko

Date: Wed Apr 15 2026 - 15:57:53 EST


On Wed, 2026-04-15 at 17:00 +0000, Alex Markuze wrote:
> Replace the __force __le32 cast with cpu_to_le32() for the flock_len field
> in reconnect_caps_cb(). The old code used a type-system bypass to silence
> sparse; the new form uses the proper endian conversion macro.
>
> Also switch from a raw bitmask test against i_ceph_flags to test_bit() on
> the named CEPH_I_ERROR_FILELOCK_BIT, which is the correct accessor for the
> unsigned long flags field after the bit-position conversion.
>
> Signed-off-by: Alex Markuze <amarkuze@xxxxxxxxxx>
> ---
> fs/ceph/mds_client.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index ccf0d53dde2b..871f0eef468d 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -4693,8 +4693,9 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg)
> rec.v2.issued = cpu_to_le32(cap->issued);
> rec.v2.snaprealm = cpu_to_le64(ci->i_snap_realm->ino);
> rec.v2.pathbase = cpu_to_le64(path_info.vino.ino);
> - rec.v2.flock_len = (__force __le32)
> - ((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1);
> + rec.v2.flock_len = cpu_to_le32(
> + test_bit(CEPH_I_ERROR_FILELOCK_BIT,
> + &ci->i_ceph_flags) ? 0 : 1);
> } else {
> struct timespec64 ts;
>

Makes sense.

Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@xxxxxxx>

Thanks,
Slava.