Skip to content

Commit 6ba0c4e

Browse files
author
Trond Myklebust
committed
NFS: Simplify internal check for whether file is open for write
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 1db97ea commit 6ba0c4e

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

fs/nfs/inode.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,19 +1328,11 @@ static bool nfs_file_has_writers(struct nfs_inode *nfsi)
13281328
{
13291329
struct inode *inode = &nfsi->vfs_inode;
13301330

1331-
assert_spin_locked(&inode->i_lock);
1332-
13331331
if (!S_ISREG(inode->i_mode))
13341332
return false;
13351333
if (list_empty(&nfsi->open_files))
13361334
return false;
1337-
/* Note: This relies on nfsi->open_files being ordered with writers
1338-
* being placed at the head of the list.
1339-
* See nfs_inode_attach_open_context()
1340-
*/
1341-
return (list_first_entry(&nfsi->open_files,
1342-
struct nfs_open_context,
1343-
list)->mode & FMODE_WRITE) == FMODE_WRITE;
1335+
return inode_is_open_for_write(inode);
13441336
}
13451337

13461338
static bool nfs_file_has_buffered_writers(struct nfs_inode *nfsi)

0 commit comments

Comments
 (0)