summaryrefslogtreecommitdiffstats
path: root/xlators/performance/io-threads/src/io-threads.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2011-07-15 01:05:16 +0000
committerAnand Avati <avati@gluster.com>2011-07-16 12:47:13 -0700
commit1742383787355241d5aaa4b2bdd92d089ef2d508 (patch)
tree3ed16ed357595ec32d8cd2712fac3d2a1085eb50 /xlators/performance/io-threads/src/io-threads.c
parentf50e5eb7777ee31701f5d757ffa8de2c238b5e50 (diff)
posix: perform readdir filling in locked region
When two application threads share an open dir fd (DIR *) and issue readdirs, storage/posix will receive separate readdir fops in separate threads in parallel. This has two-fold issues 1. In the following pair of operations - entry = readdir(dir) and strcpy (gf_dirent->name, entry->d_name) @entry is a static buffer in libc which can get reused by another thread to get filled with a longer name. This can cause the second operation to overflow the buffer as the allocation was for the smaller name. 2. In the following pair of operations - seekdir (dir, offset) and entry = readdir(dir) If two threads are executing these sequence in parallel in separate threads, then one of them will end up reading wrong/unexpected entries. It would be sufficient to fix 1. by using readdir_r but that still keeps the second race open. Hence the patch moves all the set of operations to a locked region which solves both races. Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3171 (Crash in server) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3171
Diffstat (limited to 'xlators/performance/io-threads/src/io-threads.c')
0 files changed, 0 insertions, 0 deletions