mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH v3 5/6] fat: permit to return phy block number by fibmap in fallocated region
Date: Tue, 04 Feb 2014 15:55:37 +0900	[thread overview]
Message-ID: <8761ovwemu.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <CAKYAXd8K9tO2zyZvHtMRA54=XvWowaA3SVa2H6_R5bnmKgG5Dg@mail.gmail.com> (Namjae Jeon's message of "Tue, 4 Feb 2014 13:03:16 +0900")

Namjae Jeon <linkinjeon@gmail.com> writes:

> 2014-02-04, OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>:
>> 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().
> '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.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2014-02-04  6:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-25  6:31 Namjae Jeon
2014-02-03  4:26 ` OGAWA Hirofumi
2014-02-03 23:13   ` Namjae Jeon
2014-02-04  2:45     ` OGAWA Hirofumi
2014-02-04  4:03       ` Namjae Jeon
2014-02-04  6:55         ` OGAWA Hirofumi [this message]
2014-02-04  7:00           ` Namjae Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761ovwemu.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®