All of lore.kernel.org
 help / color / mirror / Atom feed
* thread concurrent file operation
@ 2013-01-29 15:35 Karaoui mohamed lamine
  2013-01-29 15:56 ` Tobias Boege
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Karaoui mohamed lamine @ 2013-01-29 15:35 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I was looking at how a syscall read/write was done, and i found this :

   ....
   loff_t pos = file_pos_read(f.file);
   ret = vfs_read(f.file, buf, count, &pos);
   file_pos_write(f.file, pos);
   fdput(f);
   ...

My questions are :

Where did the locking go? I would have imaginated something like :

   ....
   *lock(f);*
   loff_t pos = file_pos_read(f.file);
   ret = vfs_read(f.file, buf, count, &pos);
   file_pos_write(f.file, pos);
   fdput(f);
   *unlock(f);*
   ...

If multiple threads try to read/write at the same time, they could
read/write at the same offset ?

If my understanding are correct, is this POSIX compliant ?


thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130129/82cbbe88/attachment.html 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-02-07 13:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 15:35 thread concurrent file operation Karaoui mohamed lamine
2013-01-29 15:56 ` Tobias Boege
2013-01-29 16:55   ` Valdis.Kletnieks at vt.edu
2013-01-29 17:25   ` Karaoui mohamed lamine
2013-01-29 21:38     ` Valdis.Kletnieks at vt.edu
2013-01-29 16:53 ` Valdis.Kletnieks at vt.edu
     [not found]   ` <CAEEuMqcZFKPnmhbqyzQQJ4DB+tLN=Pbd5fi2oq4qYOeKG6bU7A@mail.gmail.com>
     [not found]     ` <17948.1359482378@turing-police.cc.vt.edu>
     [not found]       ` <CAEEuMqfdTHrYcvFNV72qz9mrw+2b=ABno5tcr0fjY4EAaOkZ-w@mail.gmail.com>
     [not found]         ` <14179.1359507973@turing-police.cc.vt.edu>
     [not found]           ` <CAEEuMqfqgmQr6NA=Akbg9Z48RFNSa5r9bVW7AYH88OEdmJtTwg@mail.gmail.com>
2013-02-07  8:44             ` Karaoui mohamed lamine
2013-02-07 10:23               ` Peter Teoh
2013-02-07 13:49                 ` Karaoui mohamed lamine
2013-02-07 13:49                 ` Peter Teoh
2013-02-06 22:58 ` Jimmy Pan
2013-02-07  2:41 ` Peter Teoh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.