Skip to content

Commit dd2d6b7

Browse files
luis-henrixbrauner
authored andcommitted
fs: drop assert in file_seek_cur_needs_f_lock
The assert in function file_seek_cur_needs_f_lock() can be triggered very easily because there are many users of vfs_llseek() (such as overlayfs) that do their custom locking around llseek instead of relying on fdget_pos(). Just drop the overzealous assertion. Fixes: da06e3c ("fs: don't needlessly acquire f_lock") Suggested-by: Jan Kara <[email protected]> Suggested-by: Mateusz Guzik <[email protected]> Signed-off-by: Luis Henriques <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 0b9d62a commit dd2d6b7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/file.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,8 +1198,12 @@ bool file_seek_cur_needs_f_lock(struct file *file)
11981198
if (!(file->f_mode & FMODE_ATOMIC_POS) && !file->f_op->iterate_shared)
11991199
return false;
12001200

1201-
VFS_WARN_ON_ONCE((file_count(file) > 1) &&
1202-
!mutex_is_locked(&file->f_pos_lock));
1201+
/*
1202+
* Note that we are not guaranteed to be called after fdget_pos() on
1203+
* this file obj, in which case the caller is expected to provide the
1204+
* appropriate locking.
1205+
*/
1206+
12031207
return true;
12041208
}
12051209

0 commit comments

Comments
 (0)