Skip to content

Commit 17b985d

Browse files
committed
nfs: use locks_inode_context helper
nfs currently doesn't access i_flctx safely. This requires a smp_load_acquire, as the pointer is set via cmpxchg (a release operation). Cc: Trond Myklebust <[email protected]> Cc: Anna Schumaker <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Jeff Layton <[email protected]>
1 parent 98b41ff commit 17b985d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

fs/nfs/delegation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int nfs_delegation_claim_locks(struct nfs4_state *state, const nfs4_state
146146
{
147147
struct inode *inode = state->inode;
148148
struct file_lock *fl;
149-
struct file_lock_context *flctx = inode->i_flctx;
149+
struct file_lock_context *flctx = locks_inode_context(inode);
150150
struct list_head *list;
151151
int status = 0;
152152

fs/nfs/nfs4state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,7 @@ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_
15011501
struct file_lock *fl;
15021502
struct nfs4_lock_state *lsp;
15031503
int status = 0;
1504-
struct file_lock_context *flctx = inode->i_flctx;
1504+
struct file_lock_context *flctx = locks_inode_context(inode);
15051505
struct list_head *list;
15061506

15071507
if (flctx == NULL)

fs/nfs/pagelist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ static unsigned int nfs_coalesce_size(struct nfs_page *prev,
10551055
if (prev) {
10561056
if (!nfs_match_open_context(nfs_req_openctx(req), nfs_req_openctx(prev)))
10571057
return 0;
1058-
flctx = d_inode(nfs_req_openctx(req)->dentry)->i_flctx;
1058+
flctx = locks_inode_context(d_inode(nfs_req_openctx(req)->dentry));
10591059
if (flctx != NULL &&
10601060
!(list_empty_careful(&flctx->flc_posix) &&
10611061
list_empty_careful(&flctx->flc_flock)) &&

fs/nfs/write.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
11851185
{
11861186
struct nfs_open_context *ctx = nfs_file_open_context(file);
11871187
struct nfs_lock_context *l_ctx;
1188-
struct file_lock_context *flctx = file_inode(file)->i_flctx;
1188+
struct file_lock_context *flctx = locks_inode_context(file_inode(file));
11891189
struct nfs_page *req;
11901190
int do_flush, status;
11911191
/*
@@ -1321,7 +1321,7 @@ static int nfs_can_extend_write(struct file *file, struct page *page,
13211321
struct inode *inode, unsigned int pagelen)
13221322
{
13231323
int ret;
1324-
struct file_lock_context *flctx = inode->i_flctx;
1324+
struct file_lock_context *flctx = locks_inode_context(inode);
13251325
struct file_lock *fl;
13261326

13271327
if (file->f_flags & O_DSYNC)

0 commit comments

Comments
 (0)