[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd8MNy=tp3U26u-5G21ZHcQ8gPRTrrEbAvhZKcvFJJRyZQ@mail.gmail.com>
Date: Tue, 4 Feb 2014 16:00:17 +0900
From: Namjae Jeon <linkinjeon@...il.com>
To: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Cc: akpm@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Namjae Jeon <namjae.jeon@...sung.com>,
Amit Sahrawat <a.sahrawat@...sung.com>
Subject: Re: [PATCH v3 5/6] fat: permit to return phy block number by fibmap
in fallocated region
2014-02-04, OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>:
> Namjae Jeon <linkinjeon@...il.com> writes:
>
>> 2014-02-04, OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>:
>>> Namjae Jeon <linkinjeon@...il.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().
>> 'create' flag will be 1 in write(2) path. ->beyond_isize will only be
>> checked when 'create' flag is 0. Is there any case to be racy by
>> beyond_isize in write(2) path ?
>
> Ah, so instead of write, it will assign physical address to buffers
> beyond i_size for simple read if race? In this case, it is still wrong.
Right. I will fix this case.
Thanks for review!
> --
> OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists