diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-01-12 20:13:20 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-01-12 20:13:20 +0100 |
commit | 47f07b2669e74eb957db56befa2237df5afa8474 (patch) | |
tree | 63239fa5b8ff90cae4c817111465b2ea2180d0c3 /sys/src/9/port/portfns.h | |
parent | 4aeefba6811e57afe04a909fe147a29bb419d06b (diff) |
kernel: make the mntcache robust against fileserver like fossil that do not change the qid.vers on wstat
introducing new ctrunc() function that invalidates any caches
for the passed in chan, invoked when handling wstat with a
specified file length or on file creation/truncation.
test program to reproduce the problem:
#include <u.h>
#include <libc.h>
#include <libsec.h>
void
main(int argc, char *argv[])
{
int fd;
Dir *d, nd;
fd = create("xxx", ORDWR, 0666);
write(fd, "1234", 4);
d = dirstat("xxx");
assert(d->length == 4);
nulldir(&nd);
nd.length = 0;
dirwstat("xxx", &nd);
d = dirstat("xxx");
assert(d->length == 0);
fd = open("xxx", OREAD);
assert(read(fd, (void*)&d, 4) == 0);
}
Diffstat (limited to 'sys/src/9/port/portfns.h')
-rw-r--r-- | sys/src/9/port/portfns.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h index 7c7eec461..5564ce0c8 100644 --- a/sys/src/9/port/portfns.h +++ b/sys/src/9/port/portfns.h @@ -41,13 +41,14 @@ void confinit(void); int consactive(void); void (*consdebug)(void); void cpushutdown(void); -void copen(Chan*); +int copen(Chan*); void cclunk(Chan*); Block* concatblock(Block*); Block* copyblock(Block*, int); void copypage(Page*, Page*); void countpagerefs(ulong*, int); int cread(Chan*, uchar*, int, vlong); +void ctrunc(Chan*); void cunmount(Chan*, Chan*); void cupdate(Chan*, uchar*, int, vlong); void cwrite(Chan*, uchar*, int, vlong); |