Michael K. Edwards a écrit :
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?

Nothing in the manuals says that write() on same fd should be non racy : In particular file pos might be undefined. There is a reason pwrite() exists.

Kernel doesnt have to enforce thread safety as standard is quite clear.

Only O_APPEND case is specially handled (and NFS might fail to handle this case correctly)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to