diff --git a/fs/file.c b/fs/file.c index dbca26ef7a01..dd49bc77d5cf 100644 --- a/fs/file.c +++ b/fs/file.c @@ -1046,10 +1046,11 @@ unsigned long __fdget_raw(unsigned int fd) * not be, and for directories this is a correctness * issue, not a "POSIX requirement". */ -static inline bool file_needs_f_pos_lock(struct file *file) +static inline bool file_needs_f_pos_lock(const 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 || file->f_op->iterate); } unsigned long __fdget_pos(unsigned int fd)