Skip to content

Commit 7d84d1b

Browse files
committed
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 <[email protected]>
1 parent 3e32715 commit 7d84d1b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ unsigned long __fdget_raw(unsigned int fd)
10491049
static inline bool file_needs_f_pos_lock(struct file *file)
10501050
{
10511051
return (file->f_mode & FMODE_ATOMIC_POS) &&
1052-
(file_count(file) > 1 || S_ISDIR(file_inode(file)->i_mode));
1052+
(file_count(file) > 1 || file->f_op->iterate_shared);
10531053
}
10541054

10551055
unsigned long __fdget_pos(unsigned int fd)

0 commit comments

Comments
 (0)