diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2018-08-21 09:44:15 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2018-08-23 15:40:57 +0000 |
commit | 370f05546eeedab394ca0d333a6ca6637757f1e3 (patch) | |
tree | e77ffcd621df79251a67413272d1649d841815e2 /libglusterfs/src/stack.c | |
parent | 59e560248771d3b95517a3e12c174e9acbf39585 (diff) |
performance/write-behind: fix fulfill and readdirp race
Current invalidation of stats in wb_readdirp_cbk is prone to races. As
the deleted comment explains,
<snip>
We cannot guarantee integrity of entry->d_stat as there are cached
writes. The stat is most likely stale as it doesn't account the cached
writes. However, checking for non-empty liability list here is not a
fool-proof solution as there can be races like,
1. readdirp is successful on posix
2. sync of cached write is successful on posix
3. write-behind received sync response and removed the request from
liability queue
4. readdirp response is processed at write-behind.
In the above scenario, stat for the file is sent back in readdirp
response but it is stale.
</snip>
The fix is to mark readdirp sessions (tracked in this patch by
non-zero value of "readdirps" on parent inode) and if fulfill
completes when one or more readdirp sessions are in progress, mark the
inode so that wb_readdirp_cbk doesn't send iatts for that in inode in
readdirp response. Note that wb_readdirp_cbk already checks for
presence of a non-empty liability queue and invalidates iatt. Since
the only way a liability queue can shrink is by fulfilling requests in
liability queue, wb_fulfill_cbk indicates wb_readdirp_cbk that a
potential race could've happened b/w readdirp and fulfill.
Change-Id: I12d167bf450648baa64be1cbe1ca0fddf5379521
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
updates: bz#1512691
Diffstat (limited to 'libglusterfs/src/stack.c')
0 files changed, 0 insertions, 0 deletions