aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-04-02 08:25:35 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2009-04-02 08:25:35 -0400
commitfc280c9692031ee41545d6bea00bbb7c7dec97a9 (patch)
treebff08b2710b2086698736d66cef403c6e2975ca9 /fs/fuse
parentf4975c67dd9ad8eb47a4c77af0521a2b16ee0197 (diff)
fuse: allow private mappings of "direct_io" files
Allow MAP_PRIVATE mmaps of "direct_io" files. This is necessary for execute support. MAP_SHARED mappings require some sort of coherency between the underlying file and the mapping. With "direct_io" it is difficult to provide this, so for the moment just disallow shared (read-write and read-only) mappings altogether. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/file.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 78a2c8333700..2b25133524a3 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1292,6 +1292,15 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma)
1292 return 0; 1292 return 0;
1293} 1293}
1294 1294
1295static int fuse_direct_mmap(struct file *file, struct vm_area_struct *vma)
1296{
1297 /* Can't provide the coherency needed for MAP_SHARED */
1298 if (vma->vm_flags & VM_MAYSHARE)
1299 return -ENODEV;
1300
1301 return generic_file_mmap(file, vma);
1302}
1303
1295static int convert_fuse_file_lock(const struct fuse_file_lock *ffl, 1304static int convert_fuse_file_lock(const struct fuse_file_lock *ffl,
1296 struct file_lock *fl) 1305 struct file_lock *fl)
1297{ 1306{
@@ -1926,6 +1935,7 @@ static const struct file_operations fuse_direct_io_file_operations = {
1926 .llseek = fuse_file_llseek, 1935 .llseek = fuse_file_llseek,
1927 .read = fuse_direct_read, 1936 .read = fuse_direct_read,
1928 .write = fuse_direct_write, 1937 .write = fuse_direct_write,
1938 .mmap = fuse_direct_mmap,
1929 .open = fuse_open, 1939 .open = fuse_open,
1930 .flush = fuse_flush, 1940 .flush = fuse_flush,
1931 .release = fuse_release, 1941 .release = fuse_release,
@@ -1935,7 +1945,7 @@ static const struct file_operations fuse_direct_io_file_operations = {
1935 .unlocked_ioctl = fuse_file_ioctl, 1945 .unlocked_ioctl = fuse_file_ioctl,
1936 .compat_ioctl = fuse_file_compat_ioctl, 1946 .compat_ioctl = fuse_file_compat_ioctl,
1937 .poll = fuse_file_poll, 1947 .poll = fuse_file_poll,
1938 /* no mmap and splice_read */ 1948 /* no splice_read */
1939}; 1949};
1940 1950
1941static const struct address_space_operations fuse_file_aops = { 1951static const struct address_space_operations fuse_file_aops = {