linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Cc: stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: wait writeback before reading data to avoid stale encrypted block
Date: Thu, 8 Nov 2018 12:27:13 -0800	[thread overview]
Message-ID: <20181108202713.GA9862@jaegeuk-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <20181107024639.41771-1-jaegeuk@kernel.org>

Let me drop this, since I missed there was a patch to introdcued this. :)

On 11/06, Jaegeuk Kim wrote:
> If background GC is running very frequently by gc_urgent, the next GC
> can see unwritten data generated by the previous GC, which incurs to write
> stale corrupted data in disk.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/gc.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index a07241fb8537..49fea136a3f3 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -658,6 +658,9 @@ static int ra_data_block(struct inode *inode, pgoff_t index)
>  	fio.page = page;
>  	fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr;
>  
> +	/* wait writeback before reading out */
> +	f2fs_wait_on_block_writeback(inode, dn.data_blkaddr);
> +
>  	fio.encrypted_page = f2fs_pagecache_get_page(META_MAPPING(sbi),
>  					dn.data_blkaddr,
>  					FGP_LOCK | FGP_CREAT, GFP_NOFS);
> @@ -755,6 +758,9 @@ static int move_data_block(struct inode *inode, block_t bidx,
>  	fio.page = page;
>  	fio.new_blkaddr = fio.old_blkaddr = dn.data_blkaddr;
>  
> +	/* wait writeback before reading out */
> +	f2fs_wait_on_block_writeback(inode, fio.old_blkaddr);
> +
>  	if (lfs_mode)
>  		down_write(&fio.sbi->io_order_lock);
>  
> -- 
> 2.19.0.605.g01d371f741-goog

      reply	other threads:[~2018-11-08 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-07  2:46 [PATCH] f2fs: wait writeback before reading data to avoid stale encrypted block Jaegeuk Kim
2018-11-08 20:27 ` Jaegeuk Kim [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=20181108202713.GA9862@jaegeuk-macbookpro.roam.corp.google.com \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).