From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 4/4] f2fs: should check the type of end_io after pullback by fscrypto
Date: Tue, 10 Jul 2018 13:43:29 -0700 [thread overview]
Message-ID: <20180710204329.GA79040@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <d09dbae7-8073-1df6-e7ab-a0241c4023ff@kernel.org>
On 07/09, Chao Yu wrote:
> On 2018/7/7 5:09, Jaegeuk Kim wrote:
> > This fixes to get the page type after pullback by fscrypto, since the original
> > page is bounce page but we should need to get control page which is what we
> > originally submitted.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/data.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index c3f9b9baf140..9a0fcec53d0e 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -152,7 +152,6 @@ static void f2fs_write_end_io(struct bio *bio)
> >
> > bio_for_each_segment_all(bvec, bio, i) {
> > struct page *page = bvec->bv_page;
> > - enum count_type type = WB_DATA_TYPE(page);
> >
> > if (IS_DUMMY_WRITTEN_PAGE(page)) {
> > set_page_private(page, (unsigned long)NULL);
> > @@ -169,14 +168,14 @@ static void f2fs_write_end_io(struct bio *bio)
> >
> > if (unlikely(bio->bi_status)) {
> > mapping_set_error(page->mapping, -EIO);
> > - if (type == F2FS_WB_CP_DATA)
> > + if (WB_DATA_TYPE(page) == F2FS_WB_CP_DATA)
> > f2fs_stop_checkpoint(sbi, true);
> > }
> >
> > f2fs_bug_on(sbi, page->mapping == NODE_MAPPING(sbi) &&
> > page->index != nid_of_node(page));
> >
> > - dec_page_count(sbi, type);
> > + dec_page_count(sbi, WB_DATA_TYPE(page));
>
> But we account F2FS_WB_CP_DATA/F2FS_WB_DATA type page based bounce page instead
> of original page.
>
> bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;
>
> /* set submitted = true as a return value */
> fio->submitted = true;
>
> inc_page_count(sbi, WB_DATA_TYPE(bio_page));
>
> Because for encrypted page of regular inode, we should account it with
> F2FS_WB_DATA type:
>
> static bool __is_cp_guaranteed(struct page *page)
> {
> ....
> if (!mapping) <---bounce page's mapping is NULL
> return false;
> }
>
> So we will get F2FS_WB_DATA type from __is_cp_guaranteed below:
>
> enum count_type type = WB_DATA_TYPE(page);
>
> Is there any problem?
Wait a minute.
bio_page = fio->encrypted_page ? fio->encrypted_page : fio->page;
1. fio->encrypted_page
inc_page_count(sbi, F2FS_WB_CP_DATA); // page->mapping == META_MAPPING
In write_end_io(),
type = F2FS_WB_DATA; // page->mapping == NULL
fscrypt_pullback_bio_page(&page);
page = fio->encrypted_page;
dec_page_count(F2FS_WB_DATA);
2. fio->page
inc_page_count(sbi, F2FS_WB_DATA);
In write_end_io(),
type = F2FS_WB_DATA; // page->mapping == NULL
fscrypt_pullback_bio_page(&page);
page = fio->encrypted_page;
dec_page_count(F2FS_WB_DATA);
Thoughts?
next prev parent reply other threads:[~2018-07-10 20:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 21:09 [PATCH 1/4] f2fs: flush journal nat entries for nat_bits during unmount Jaegeuk Kim
2018-07-06 21:09 ` [PATCH 2/4] f2fs: allow wrong configure dio to buffered write Jaegeuk Kim
2018-07-09 14:33 ` [f2fs-dev] " Chao Yu
2018-07-09 20:41 ` Jaegeuk Kim
2018-07-10 5:54 ` Chao Yu
2018-07-12 17:59 ` [f2fs-dev v2] " Jaegeuk Kim
2018-07-13 11:29 ` Chao Yu
2018-07-06 21:09 ` [PATCH 3/4] f2fs: indicate shutdown f2fs to allow unmount successfully Jaegeuk Kim
2018-07-09 14:42 ` [f2fs-dev] " Chao Yu
2018-07-06 21:09 ` [PATCH 4/4] f2fs: should check the type of end_io after pullback by fscrypto Jaegeuk Kim
2018-07-09 14:54 ` [f2fs-dev] " Chao Yu
2018-07-09 20:37 ` Jaegeuk Kim
2018-07-10 20:43 ` Jaegeuk Kim [this message]
2018-07-10 20:53 ` Jaegeuk Kim
2018-07-09 14:23 ` [f2fs-dev] [PATCH 1/4] f2fs: flush journal nat entries for nat_bits during unmount Chao Yu
2018-07-09 20:43 ` Jaegeuk Kim
2018-07-10 6:01 ` Chao Yu
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=20180710204329.GA79040@jaegeuk-macbookpro.roam.corp.google.com \
--to=jaegeuk@kernel.org \
--cc=chao@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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®