Skip to content

Commit d4e7866

Browse files
committed
ceph: use locks_inode_context helper
ceph currently doesn't access i_flctx safely. This requires a smp_load_acquire, as the pointer is set via cmpxchg (a release operation). Reviewed-by: Xiubo Li <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
1 parent 401a8b8 commit d4e7866

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ceph/locks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void ceph_count_locks(struct inode *inode, int *fcntl_count, int *flock_count)
364364
*fcntl_count = 0;
365365
*flock_count = 0;
366366

367-
ctx = inode->i_flctx;
367+
ctx = locks_inode_context(inode);
368368
if (ctx) {
369369
spin_lock(&ctx->flc_lock);
370370
list_for_each_entry(lock, &ctx->flc_posix, fl_list)
@@ -418,7 +418,7 @@ int ceph_encode_locks_to_buffer(struct inode *inode,
418418
int num_fcntl_locks, int num_flock_locks)
419419
{
420420
struct file_lock *lock;
421-
struct file_lock_context *ctx = inode->i_flctx;
421+
struct file_lock_context *ctx = locks_inode_context(inode);
422422
int err = 0;
423423
int seen_fcntl = 0;
424424
int seen_flock = 0;

0 commit comments

Comments
 (0)