mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
nfsd: use locks_inode_context helper
[ Upstream commit 77c67530e1 ]
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 <chuck.lever@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c66f9f22e6
commit
e017486dad
@@ -4784,7 +4784,7 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
|
|||||||
|
|
||||||
static bool nfsd4_deleg_present(const struct inode *inode)
|
static bool nfsd4_deleg_present(const struct inode *inode)
|
||||||
{
|
{
|
||||||
struct file_lock_context *ctx = smp_load_acquire(&inode->i_flctx);
|
struct file_lock_context *ctx = locks_inode_context(inode);
|
||||||
|
|
||||||
return ctx && !list_empty_careful(&ctx->flc_lease);
|
return ctx && !list_empty_careful(&ctx->flc_lease);
|
||||||
}
|
}
|
||||||
@@ -5944,7 +5944,7 @@ nfs4_lockowner_has_blockers(struct nfs4_lockowner *lo)
|
|||||||
|
|
||||||
list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) {
|
list_for_each_entry(stp, &lo->lo_owner.so_stateids, st_perstateowner) {
|
||||||
nf = stp->st_stid.sc_file;
|
nf = stp->st_stid.sc_file;
|
||||||
ctx = nf->fi_inode->i_flctx;
|
ctx = locks_inode_context(nf->fi_inode);
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
continue;
|
continue;
|
||||||
if (locks_owner_has_blockers(ctx, lo))
|
if (locks_owner_has_blockers(ctx, lo))
|
||||||
@@ -7761,7 +7761,7 @@ check_for_locks(struct nfs4_file *fp, struct nfs4_lockowner *lowner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
inode = locks_inode(nf->nf_file);
|
inode = locks_inode(nf->nf_file);
|
||||||
flctx = inode->i_flctx;
|
flctx = locks_inode_context(inode);
|
||||||
|
|
||||||
if (flctx && !list_empty_careful(&flctx->flc_posix)) {
|
if (flctx && !list_empty_careful(&flctx->flc_posix)) {
|
||||||
spin_lock(&flctx->flc_lock);
|
spin_lock(&flctx->flc_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user