linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: heyunlei <heyunlei@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: fix a problem of a truncated inmem page
Date: Fri, 17 Mar 2017 10:36:25 +0800	[thread overview]
Message-ID: <c510b9a4-5c6c-e2f5-e17a-576eb490da3d@huawei.com> (raw)
In-Reply-To: <20170317021105.GA28214@jaegeuk.local>

Hi Jaegeuk,

On 2017/3/17 10:11, Jaegeuk Kim wrote:
> Hi Yunlei,
>
> I could reproduce this. Could you check the patches that I sent just ago?

I have test it with my test case, it's OK.

Thanks,
>
> Thanks,
>
> On 03/16, Jaegeuk Kim wrote:
>> On 03/15, Yunlei He wrote:
>>> -start atomic write
>>>    -set_page_dirty
>>>       -register_inmem_page
>>> 				<--- truncate or punch hole
>>
>> SQLite bug?
>>
>>> 	  -commit atomic write
>>>
>>> Here, may cause memory reclaim painc for page->mapping is null,
>>> but private is -1.
>>>
>>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>>> ---
>>>  fs/f2fs/data.c    | 8 --------
>>>  fs/f2fs/segment.c | 5 ++++-
>>>  2 files changed, 4 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index 1375fef..a91e479 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -1948,10 +1948,6 @@ void f2fs_invalidate_page(struct page *page, unsigned int offset,
>>>  		}
>>>  	}
>>>
>>> -	/* This is atomic written page, keep Private */
>>> -	if (IS_ATOMIC_WRITTEN_PAGE(page))
>>> -		return;
>>> -
>>
>> We need to give a kernel message like "atomic writes were broken", and
>> unresitering the page from the inmem page list here to keep consistency
>> between IS_ATOMIC_WRITTEN_PAGE(page) and its link to the inmem list.
>>
>>>  	set_page_private(page, 0);
>>>  	ClearPagePrivate(page);
>>>  }
>>> @@ -1962,10 +1958,6 @@ int f2fs_release_page(struct page *page, gfp_t wait)
>>>  	if (PageDirty(page))
>>>  		return 0;
>>>
>>> -	/* This is atomic written page, keep Private */
>>> -	if (IS_ATOMIC_WRITTEN_PAGE(page))
>>> -		return 0;
>>
>> We should keep this in order not to be invalidated by someone.
>>
>> Thanks,
>>
>>> -
>>>  	set_page_private(page, 0);
>>>  	ClearPagePrivate(page);
>>>  	return 1;
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index 42727e4..bebac9a 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -207,6 +207,9 @@ static int __revoke_inmem_pages(struct inode *inode,
>>>
>>>  		lock_page(page);
>>>
>>> +		if (page->mapping != inode->i_mapping)
>>> +			goto delete;
>>> +
>>>  		if (recover) {
>>>  			struct dnode_of_data dn;
>>>  			struct node_info ni;
>>> @@ -230,7 +233,7 @@ static int __revoke_inmem_pages(struct inode *inode,
>>>  		set_page_private(page, 0);
>>>  		ClearPagePrivate(page);
>>>  		f2fs_put_page(page, 1);
>>> -
>>> +delete:
>>>  		list_del(&cur->list);
>>>  		kmem_cache_free(inmem_entry_slab, cur);
>>>  		dec_page_count(F2FS_I_SB(inode), F2FS_INMEM_PAGES);
>>> --
>>> 2.10.1
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Linux-f2fs-devel mailing list
>>> Linux-f2fs-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> Linux-f2fs-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
> .
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

      reply	other threads:[~2017-03-17  2:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 12:45 [PATCH] f2fs: fix a problem of a truncated inmem page Yunlei He
2017-03-16  0:13 ` Jaegeuk Kim
2017-03-17  2:11   ` Jaegeuk Kim
2017-03-17  2:36     ` heyunlei [this message]

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=c510b9a4-5c6c-e2f5-e17a-576eb490da3d@huawei.com \
    --to=heyunlei@huawei.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).