office at hailoo.com
2009-Sep-25 19:49 UTC
[Lustre-devel] File offsets with multiple clients
When a client obtains a file descriptor to a file on a Lustre file system, is the file offset pointer shared among any connected clients, or is it only meaningful to a single client? For example, given the file "foo.txt" on a Lustre file system, suppose there are 2 clients with an open file descriptor to "foo.txt". If Client1 calls lseek and then write, will this affect the file offset position of Client2? Or is the application responsible for synchronizing file access in this case? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.lustre.org/pipermail/lustre-devel/attachments/20090925/aeffb53c/attachment.html
Hello! On Sep 25, 2009, at 3:49 PM, office at hailoo.com wrote:> When a client obtains a file descriptor to a file on a Lustre file > system, is the file offset pointer shared among any connected > clients, or is it only meaningful to a single client?It''s even stricter than that. the pointer is per file-descriptor (the one you get from open(2) system call).> For example, given the file "foo.txt" on a Lustre file system, > suppose there are 2 clients with an open file descriptor to > "foo.txt". If Client1 calls lseek and then write, will this affect > the file offset position of Client2? Or is the application > responsible for synchronizing file access in this case? >No, since both applications on both clients did separate opens, their current file position pointer is separate. The answer does not change even if both processes were running on the same client. This is by design and is mandated by POSIX. Bye, Oleg