mirror of https://lore.kernel.org/lkml/
 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/3] f2fs: flush symlink path to avoid broken symlink after POR
Date: Thu, 16 Apr 2015 09:51:26 -0700	[thread overview]
Message-ID: <20150416165126.GA20085@jaegeuk-mac02.mot.com> (raw)
In-Reply-To: <000001d07830$e0787b60$a1697220$@samsung.com>

Hi Chao,

On Thu, Apr 16, 2015 at 06:33:29PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Thursday, April 16, 2015 3:31 PM
> > 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/3] f2fs: flush symlink path to avoid broken symlink after POR
> > 
> > This patch tries to avoid broken symlink case after POR in best effort.
> > This results in performance regression.
> > But, if f2fs has inline_data and the target path is under 3KB-sized long,
> > the page would be stored in its inode_block, so that there would be no
> > performance regression.
> > 
> > Note that, if user wants to keep this file atomically, it needs to trigger
> > dir->fsync.
> > And, there is still a hole to produce broken symlink.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/namei.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> > index 8055e30..5d990d8 100644
> > --- a/fs/f2fs/namei.c
> > +++ b/fs/f2fs/namei.c
> > @@ -324,6 +324,17 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
> >  	d_instantiate(dentry, inode);
> >  	unlock_new_inode(inode);
> > 
> > +	/*
> > +	 * Let's flush symlink data in order to avoid broken symlink as much as
> > +	 * possible. Nevertheless, fsyncing is the best way, but there is no
> > +	 * way to get a file descriptor in order to flush that.
> > +	 *
> > +	 * Note that, it needs to do dir->fsync to make this recoverable.
> > +	 * If the symlink path is stored into inline_data, there is no
> > +	 * performance regression.
> > +	 */
> > +	filemap_write_and_wait_range(inode->i_mapping, 0, symlen);
> 
> One minor thing.
> 
> filemap_write_and_wait_range(inode->i_mapping, 0, symlen - 1);
> 
> Because we don't need to write out data exceed isize here.

Thank you for the review.
I fixed this and merged.

Thanks,

> 
> Thanks,
> 
> > +
> >  	if (IS_DIRSYNC(dir))
> >  		f2fs_sync_fs(sbi->sb, 1);
> >  	return err;
> > --
> > 2.1.1
> > 
> > 
> > ------------------------------------------------------------------------------
> > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> > Develop your own process in accordance with the BPMN 2 standard
> > Learn Process modeling best practices with Bonita BPM through live exercises
> > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2015-04-16 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16  7:30 Jaegeuk Kim
2015-04-16  7:30 ` [PATCH 2/3] f2fs: avoid abnormal behavior on broken symlink Jaegeuk Kim
2015-04-16  7:30 ` [PATCH 3/3] f2fs: pass checkpoint reason on roll-forward recovery Jaegeuk Kim
2015-04-16 10:33 ` [f2fs-dev] [PATCH 1/3] f2fs: flush symlink path to avoid broken symlink after POR Chao Yu
2015-04-16 16:51   ` 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=20150416165126.GA20085@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 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®