diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-02 21:34:37 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-30 21:35:17 +0200 |
commit | 6ba0c4e5bb08cc929662588aa2015e0ee7ee9376 (patch) | |
tree | dfe3c70b997603f529063fb17c8c1b1154df567b /fs/nfs/inode.c | |
parent | NFS: Convert lookups of the lock context to RCU (diff) | |
download | linux-6ba0c4e5bb08cc929662588aa2015e0ee7ee9376.tar.xz linux-6ba0c4e5bb08cc929662588aa2015e0ee7ee9376.zip |
NFS: Simplify internal check for whether file is open for write
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 09b3b7146ff4..052db41a7f80 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1328,19 +1328,11 @@ static bool nfs_file_has_writers(struct nfs_inode *nfsi) { struct inode *inode = &nfsi->vfs_inode; - assert_spin_locked(&inode->i_lock); - if (!S_ISREG(inode->i_mode)) return false; if (list_empty(&nfsi->open_files)) return false; - /* Note: This relies on nfsi->open_files being ordered with writers - * being placed at the head of the list. - * See nfs_inode_attach_open_context() - */ - return (list_first_entry(&nfsi->open_files, - struct nfs_open_context, - list)->mode & FMODE_WRITE) == FMODE_WRITE; + return inode_is_open_for_write(inode); } static bool nfs_file_has_buffered_writers(struct nfs_inode *nfsi) |