kernel_optimize_test/fs/fuse
Maxim Patlasov 14c14414d1 fuse: hold i_mutex in fuse_file_fallocate()
Changing size of a file on server and local update (fuse_write_update_size)
should be always protected by inode->i_mutex. Otherwise a race like this is
possible:

1. Process 'A' calls fallocate(2) to extend file (~FALLOC_FL_KEEP_SIZE).
fuse_file_fallocate() sends FUSE_FALLOCATE request to the server.
2. Process 'B' calls ftruncate(2) shrinking the file. fuse_do_setattr()
sends shrinking FUSE_SETATTR request to the server and updates local i_size
by i_size_write(inode, outarg.attr.size).
3. Process 'A' resumes execution of fuse_file_fallocate() and calls
fuse_write_update_size(inode, offset + length). But 'offset + length' was
obsoleted by ftruncate from previous step.

Changed in v2 (thanks Brian and Anand for suggestions):
 - made relation between mutex_lock() and fuse_set_nowrite(inode) more
   explicit and clear.
 - updated patch description to use ftruncate(2) in example

Signed-off-by: Maxim V. Patlasov <MPatlasov@parallels.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
2013-06-18 01:39:03 +02:00
..
control.c fs: Limit sys_mount to only request filesystem modules. 2013-03-03 19:36:31 -08:00
cuse.c Merge branch 'akpm' (incoming from Andrew) 2013-05-07 20:49:51 -07:00
dev.c Merge branch 'akpm' (incoming from Andrew) 2013-05-07 20:49:51 -07:00
dir.c fuse: fix readdirplus Oops in fuse_dentry_revalidate 2013-06-03 14:40:22 +02:00
file.c fuse: hold i_mutex in fuse_file_fallocate() 2013-06-18 01:39:03 +02:00
fuse_i.h fuse: add flag to turn on async direct IO 2013-05-01 14:37:21 +02:00
inode.c fuse: fix readdirplus Oops in fuse_dentry_revalidate 2013-06-03 14:40:22 +02:00
Kconfig fuse: Move CUSE Kconfig entry from fs/Kconfig into fs/fuse/Kconfig 2013-01-17 13:08:45 +01:00
Makefile CUSE: implement CUSE - Character device in Userspace 2009-06-09 11:24:11 +02:00