diff options
author | Christian Brauner <brauner@kernel.org> | 2023-08-06 14:49:35 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-08-06 15:08:36 +0200 |
commit | 7d84d1b9af6366aa9df1b523bdb7e002372e38d0 (patch) | |
tree | 450616a5bc325b21b528fa6928294e69f8ffe733 | |
parent | vfs: get rid of old '->iterate' directory operation (diff) | |
download | linux-7d84d1b9af6366aa9df1b523bdb7e002372e38d0.tar.xz linux-7d84d1b9af6366aa9df1b523bdb7e002372e38d0.zip |
fs: rely on ->iterate_shared to determine f_pos locking
Now that we removed ->iterate we don't need to check for either
->iterate or ->iterate_shared in file_needs_f_pos_lock(). Simply check
for ->iterate_shared instead. This will tell us whether we need to
unconditionally take the lock. Not just does it allow us to avoid
checking f_inode's mode it also actually clearly shows that we're
locking because of readdir.
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | fs/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/file.c b/fs/file.c index dbca26ef7a01..3fd003a8604f 100644 --- a/fs/file.c +++ b/fs/file.c @@ -1049,7 +1049,7 @@ unsigned long __fdget_raw(unsigned int fd) static inline bool file_needs_f_pos_lock(struct file *file) { return (file->f_mode & FMODE_ATOMIC_POS) && - (file_count(file) > 1 || S_ISDIR(file_inode(file)->i_mode)); + (file_count(file) > 1 || file->f_op->iterate_shared); } unsigned long __fdget_pos(unsigned int fd) |