Hi, I wonder how file->f_pos is protected in read()/lseek()/etc. Code from fs/read_write.c: static inline loff_t file_pos_read(struct file *file) { return file->f_pos; } static inline void file_pos_write(struct file *file, loff_t pos) { file->f_pos = pos; } SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count) { ... if (file) { loff_t pos = file_pos_read(file); ^^^^^^^^^^^^^ ret = vfs_read(file, buf, count, &pos); file_pos_write(file, pos); ^^^^^^^^^^^^^^ fput_light(file, fput_needed); } ... } Update of file->f_pos in sys_lseek() is fully done in driver defined lseek(). I don't understand one thing: if driver lseek() is even protected with lock_kernel() how does it protect f_pos from changing from read()? E.g. sys_read() ... pos = file_pos_read() ... /* update pos */ ... sys_lseek() ... { ... file->f_pos = new_pos; ... } file_pos_write(file, pos) ^^^^^^^^^^^^^^^^^^^^^^^^^ file_pos_write() does overwrites current position with old value, without dependence of lock style. Also if driver uses generic_file_llseek() does read()/write()/etc need to lock file->f_dentry->d_inode->i_mutex? I don't see it in some drivers, e.g. in drivers/hid/hid-picolcd.c. Thanks in advance, Vasiliy -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ