All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: handle error cases in move_encrypted_block
Date: Wed, 15 Jul 2015 15:42:48 -0700	[thread overview]
Message-ID: <20150715224248.GA86133@jaegeuk-mac02.mot.com> (raw)
In-Reply-To: <012501d0be9f$3ca52dc0$b5ef8940$@samsung.com>

On Wed, Jul 15, 2015 at 09:39:47AM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Wednesday, July 15, 2015 3:18 AM
> > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > linux-f2fs-devel@lists.sourceforge.net
> > Cc: Jaegeuk Kim
> > Subject: [f2fs-dev] [PATCH 1/2] f2fs: handle error cases in move_encrypted_block
> > 
> > This patch fixes some missing error handlers.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/gc.c | 25 ++++++++++++++++---------
> >  1 file changed, 16 insertions(+), 9 deletions(-)
> > 
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> > index 11046db..db11861 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -556,27 +556,34 @@ static void move_encrypted_block(struct inode *inode, block_t bidx)
> >  	if (!fio.encrypted_page)
> >  		goto put_out;
> > 
> > -	f2fs_submit_page_bio(&fio);
> > -
> > -	/* allocate block address */
> > -	f2fs_wait_on_page_writeback(dn.node_page, NODE);
> > -
> > -	allocate_data_block(fio.sbi, NULL, fio.blk_addr,
> > -					&fio.blk_addr, &sum, CURSEG_COLD_DATA);
> > -	dn.data_blkaddr = fio.blk_addr;
> > +	err = f2fs_submit_page_bio(&fio);
> > +	if (err)
> > +		goto put_page_out;
> 
> f2fs_submit_page_bio will put the page when failed.
> 
> So goto put_out is enough?

Right.
BTW, I realized that this is somewhat wrong, since this function needs to
take care of its page for error cases too.
I wrote a patch dealing with errors of f2fs_submit_page_bio, and submitted
it right ago.

> 
> > 
> >  	/* write page */
> >  	lock_page(fio.encrypted_page);
> > +
> > +	if (unlikely(!PageUptodate(fio.encrypted_page)))
> > +		goto put_page_out;
> > +	if (unlikely(fio.encrypted_page->mapping != META_MAPPING(fio.sbi)))
> > +		goto put_page_out;
> > +
> >  	set_page_writeback(fio.encrypted_page);
> >  	fio.rw = WRITE_SYNC;
> >  	f2fs_submit_page_mbio(&fio);
> > 
> > +	/* allocate block address */
> > +	f2fs_wait_on_page_writeback(dn.node_page, NODE);
> > +	allocate_data_block(fio.sbi, NULL, fio.blk_addr,
> > +					&fio.blk_addr, &sum, CURSEG_COLD_DATA);
> 
> move above f2fs_submit_page_mbio(&fio) to here?

Fixed.

Thanks,

      reply	other threads:[~2015-07-15 22:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 19:18 [PATCH 1/2] f2fs: handle error cases in move_encrypted_block Jaegeuk Kim
2015-07-14 19:18 ` Jaegeuk Kim
2015-07-14 19:18 ` [PATCH 2/2] f2fs: use a page temporarily for encrypted gced page Jaegeuk Kim
2015-07-14 19:18   ` Jaegeuk Kim
2015-07-15  1:43   ` [f2fs-dev] " Chao Yu
2015-07-15  1:39 ` [f2fs-dev] [PATCH 1/2] f2fs: handle error cases in move_encrypted_block Chao Yu
2015-07-15 22:42   ` 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=20150715224248.GA86133@jaegeuk-mac02.mot.com \
    --to=jaegeuk@kernel.org \
    --cc=chao2.yu@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.