Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate() - v2

2013-06-17 Thread Miklos Szeredi
On Thu, Jun 13, 2013 at 1:46 PM, Brian Foster wrote: > On 06/13/2013 04:16 AM, Maxim Patlasov wrote: >> 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'

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate() - v2

2013-06-17 Thread Miklos Szeredi
On Thu, Jun 13, 2013 at 1:46 PM, Brian Foster bfos...@redhat.com wrote: On 06/13/2013 04:16 AM, Maxim Patlasov wrote: 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

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate() - v2

2013-06-13 Thread Brian Foster
On 06/13/2013 04:16 AM, Maxim Patlasov wrote: > 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). >

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-13 Thread Maxim Patlasov
Anand, Brian, 06/12/2013 11:04 PM, Anand Avati пишет: On 6/11/13 3:59 AM, Maxim Patlasov wrote: -if (mode & FALLOC_FL_PUNCH_HOLE) { +if (lock_inode) mutex_lock(>i_mutex); +if (mode & FALLOC_FL_PUNCH_HOLE) fuse_set_nowrite(inode); -} Just for clarity,

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-13 Thread Maxim Patlasov
Anand, Brian, 06/12/2013 11:04 PM, Anand Avati пишет: On 6/11/13 3:59 AM, Maxim Patlasov wrote: -if (mode FALLOC_FL_PUNCH_HOLE) { +if (lock_inode) mutex_lock(inode-i_mutex); +if (mode FALLOC_FL_PUNCH_HOLE) fuse_set_nowrite(inode); -} Just for

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate() - v2

2013-06-13 Thread Brian Foster
On 06/13/2013 04:16 AM, Maxim Patlasov wrote: 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).

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Anand Avati
On 6/11/13 3:59 AM, Maxim Patlasov wrote: - if (mode & FALLOC_FL_PUNCH_HOLE) { + if (lock_inode) mutex_lock(>i_mutex); + if (mode & FALLOC_FL_PUNCH_HOLE) fuse_set_nowrite(inode); - } Just for clarity, can you make the condition to

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Anand Avati
On 6/12/13 4:40 AM, Brian Foster wrote: On 06/11/2013 06:59 AM, Maxim Patlasov wrote: 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

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Brian Foster
On 06/11/2013 06:59 AM, Maxim Patlasov wrote: > 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). >

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Brian Foster
On 06/11/2013 06:59 AM, Maxim Patlasov wrote: 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).

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Anand Avati
On 6/12/13 4:40 AM, Brian Foster wrote: On 06/11/2013 06:59 AM, Maxim Patlasov wrote: 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

Re: [PATCH] fuse: hold i_mutex in fuse_file_fallocate()

2013-06-12 Thread Anand Avati
On 6/11/13 3:59 AM, Maxim Patlasov wrote: - if (mode FALLOC_FL_PUNCH_HOLE) { + if (lock_inode) mutex_lock(inode-i_mutex); + if (mode FALLOC_FL_PUNCH_HOLE) fuse_set_nowrite(inode); - } Just for clarity, can you make the condition to