summaryrefslogtreecommitdiff
path: root/fs/ceph/locks.c
diff options
context:
space:
mode:
authorJim Schutt <jaschut@sandia.gov>2013-05-15 13:03:35 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-20 11:58:43 -0700
commita169043d55452c50a80673f47ab30763cdba407a (patch)
treec4cde105b6faec43818be6e5c9dc9a801cc40e2c /fs/ceph/locks.c
parentb84a4fc13ba928644833672442d29f6c7dff2622 (diff)
downloadlinux-3.10-a169043d55452c50a80673f47ab30763cdba407a.tar.gz
linux-3.10-a169043d55452c50a80673f47ab30763cdba407a.tar.bz2
linux-3.10-a169043d55452c50a80673f47ab30763cdba407a.zip
ceph: add cpu_to_le32() calls when encoding a reconnect capability
commit c420276a532a10ef59849adc2681f45306166b89 upstream. In his review, Alex Elder mentioned that he hadn't checked that num_fcntl_locks and num_flock_locks were properly decoded on the server side, from a le32 over-the-wire type to a cpu type. I checked, and AFAICS it is done; those interested can consult Locker::_do_cap_update() in src/mds/Locker.cc and src/include/encoding.h in the Ceph server code (git://github.com/ceph/ceph). I also checked the server side for flock_len decoding, and I believe that also happens correctly, by virtue of having been declared __le32 in struct ceph_mds_cap_reconnect, in src/include/ceph_fs.h. Signed-off-by: Jim Schutt <jaschut@sandia.gov> Reviewed-by: Alex Elder <elder@inktank.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ceph/locks.c')
-rw-r--r--fs/ceph/locks.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 80576d05d68..e9960c81e24 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -206,10 +206,12 @@ int ceph_encode_locks(struct inode *inode, struct ceph_pagelist *pagelist,
int err = 0;
int seen_fcntl = 0;
int seen_flock = 0;
+ __le32 nlocks;
dout("encoding %d flock and %d fcntl locks", num_flock_locks,
num_fcntl_locks);
- err = ceph_pagelist_append(pagelist, &num_fcntl_locks, sizeof(u32));
+ nlocks = cpu_to_le32(num_fcntl_locks);
+ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks));
if (err)
goto fail;
for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) {
@@ -229,7 +231,8 @@ int ceph_encode_locks(struct inode *inode, struct ceph_pagelist *pagelist,
goto fail;
}
- err = ceph_pagelist_append(pagelist, &num_flock_locks, sizeof(u32));
+ nlocks = cpu_to_le32(num_flock_locks);
+ err = ceph_pagelist_append(pagelist, &nlocks, sizeof(nlocks));
if (err)
goto fail;
for (lock = inode->i_flock; lock != NULL; lock = lock->fl_next) {