sys_write() racy for multi-threaded append?

From: Michael K. Edwards
Date: Thu Mar 08 2007 - 18:08:38 EST


from sys_write():

file = fget_light(fd, &fput_needed);
if (file) {
loff_t pos = file_pos_read(file);
ret = vfs_write(file, buf, count, &pos);
file_pos_write(file, pos);
fput_light(file, fput_needed);
}

Surely that's racy when two threads write to the same fd and the first
vfs_write call blocks or is preempted. Or does fget_light take some
per-file lock that I'm not seeing?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/