]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: use proper endian conversion for flock_len in reconnect
authorAlex Markuze <amarkuze@redhat.com>
Tue, 28 Apr 2026 07:41:33 +0000 (07:41 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 20 May 2026 00:20:19 +0000 (02:20 +0200)
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.

Remove the now-unused CEPH_I_ERROR_FILELOCK mask define since all callers
use the _BIT form with test_bit/set_bit/clear_bit.

Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
fs/ceph/mds_client.c
fs/ceph/super.h

index 68808e23bd225fa16a670b94bd2b3a9aa5abccb8..38f2ac4688b652d1c27c245a180f75a487148f29 100644 (file)
@@ -4747,8 +4747,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;
 
index cb45a59dbb191a8cf78ab40a0adc1a6702d7efcd..8afc6f3a10dab4e59cbc600ff3e688a48f73c6ee 100644 (file)
@@ -689,7 +689,6 @@ static inline struct inode *ceph_find_inode(struct super_block *sb,
 #define CEPH_I_SEC_INITED              (1 << CEPH_I_SEC_INITED_BIT)
 #define CEPH_I_KICK_FLUSH              (1 << CEPH_I_KICK_FLUSH_BIT)
 #define CEPH_I_FLUSH_SNAPS             (1 << CEPH_I_FLUSH_SNAPS_BIT)
-#define CEPH_I_ERROR_FILELOCK          (1 << CEPH_I_ERROR_FILELOCK_BIT)
 #define CEPH_I_ODIRECT                 (1 << CEPH_I_ODIRECT_BIT)
 #define CEPH_I_ASYNC_CREATE            (1 << CEPH_I_ASYNC_CREATE_BIT)
 #define CEPH_I_SHUTDOWN                        (1 << CEPH_I_SHUTDOWN_BIT)