summaryrefslogtreecommitdiff
path: root/fs/hostfs/hostfs.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-06-07 03:49:18 (GMT)
committerAl Viro <viro@zeniv.linux.org.uk>2010-08-09 20:48:15 (GMT)
commitf8ad850f11e11d10e7de1a16ca53cb193afc9313 (patch)
tree4812193c6be29f41d3de3ae74705e95a9566546c /fs/hostfs/hostfs.h
parentf8d7e1877e5121841bc9a4d284a04dbc13f45bea (diff)
downloadlinux-f8ad850f11e11d10e7de1a16ca53cb193afc9313.tar.xz
try to get rid of races in hostfs open()
In case of mode mismatch, do *not* blindly close the descriptor another openers might be using right now. Open the underlying file with currently sufficient mode, then * if current mode has grown so that it's sufficient for us now, just close our new fd * if current mode has grown and our fd is *not* enough to cover it, close and repeat. * otherwise, install our fd if the file hadn't been opened at all or dup2() our fd over the current one (and close our fd). Critical section is protected by mutex; yes, system-wide. All we do under it is a bunch of comparison and maybe an overwriting dup2() on host. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hostfs/hostfs.h')
-rw-r--r--fs/hostfs/hostfs.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index ea87e22..6bbd75c 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -74,6 +74,7 @@ extern void *open_dir(char *path, int *err_out);
extern char *read_dir(void *stream, unsigned long long *pos,
unsigned long long *ino_out, int *len_out);
extern void close_file(void *stream);
+extern int replace_file(int oldfd, int fd);
extern void close_dir(void *stream);
extern int read_file(int fd, unsigned long long *offset, char *buf, int len);
extern int write_file(int fd, unsigned long long *offset, const char *buf,