Skip to content

Commit 77c6753

Browse files
committed
nfsd: use locks_inode_context helper
nfsd currently doesn't access i_flctx safely everywhere. This requires a smp_load_acquire, as the pointer is set via cmpxchg (a release operation). Acked-by: Chuck Lever <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
1 parent 17b985d commit 77c6753

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/nfsd/nfs4state.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4758,7 +4758,7 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
47584758

47594759
static bool nfsd4_deleg_present(const struct inode *inode)
47604760
{
4761-
struct file_lock_context *ctx = smp_load_acquire(&inode->i_flctx);
4761+
struct file_lock_context *ctx = locks_inode_context(inode);
47624762

47634763
return ctx && !list_empty_careful(&ctx->flc_lease);
47644764
}
@@ -5897,7 +5897,7 @@ nfs4_lockowner_has_blockers(struct nfs4_lockowner *lo)
58975897

58985898
list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) {
58995899
nf = stp->st_stid.sc_file;
5900-
ctx = nf->fi_inode->i_flctx;
5900+
ctx = locks_inode_context(nf->fi_inode);
59015901
if (!ctx)
59025902
continue;
59035903
if (locks_owner_has_blockers(ctx, lo))
@@ -7713,7 +7713,7 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
77137713
}
77147714

77157715
inode = locks_inode(nf->nf_file);
7716-
flctx = inode->i_flctx;
7716+
flctx = locks_inode_context(inode);
77177717

77187718
if (flctx && !list_empty_careful(&flctx->flc_posix)) {
77197719
spin_lock(&flctx->flc_lock);

0 commit comments

Comments
 (0)