lkml.org 
[lkml]   [2014]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 5/6] fat: permit to return phy block number by fibmap in fallocated region
Date
Namjae Jeon <linkinjeon@gmail.com> writes:

>>> /* fat_get_cluster() assumes the requested blocknr isn't truncated. */
>>> down_read(&MSDOS_I(mapping->host)->truncate_lock);
>>> + /* To get block number beyond file size in fallocated region */
>>> + atomic_set(&MSDOS_I(mapping->host)->beyond_isize, 1);
>>> blocknr = generic_block_bmap(mapping, block, fat_get_block);
>>> + atomic_set(&MSDOS_I(mapping->host)->beyond_isize, 0);
>>> up_read(&MSDOS_I(mapping->host)->truncate_lock);
>>
>> This is racy. While user is using bmap, kernel can allocate new blocks.
>> We should use another function for this.
> I understand that fat can map fallocated blocks in read case while
> user is using bmap.
> But I can not find the case allocate new blocks.
> If I am missing something, Could you please elaborate more ?
> Is it a case of _bmap request returning the block number for block
> allocated in parallel write path ?

->beyond_size is global for inode. So, write(2) path on same inode with
bmap() also can see 1 set by bmap() while another process is using bmap().
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


\
 
 \ /
  Last update: 2014-02-04 04:21    [W:0.044 / U:1.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site