mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: use inode mutex to keep atomicity of f2fs_falloc
Date: Tue, 28 Jan 2014 15:00:11 +0900	[thread overview]
Message-ID: <1390888811.25542.54.camel@kjgkr> (raw)
In-Reply-To: <000101cf1bd0$d1f6be70$75e43b50$@samsung.com>

Hi,

2014-01-28 (화), 10:29 +0800, Chao Yu:
> Previously without protection of inode mutex, f2fs_falloc and other data
> correlated operations will interfere with each other.

Could you explain a little bit more what kind of scenarios wrt this?


> So let's use inode mutex to keep atomicity of f2fs_falloc.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/f2fs/file.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 85e91ca..ece380f 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -559,6 +559,8 @@ static long f2fs_fallocate(struct file *file, int mode,
>  	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
>  		return -EOPNOTSUPP;
>  
> +	mutex_lock(&inode->i_mutex);
> +
>  	if (mode & FALLOC_FL_PUNCH_HOLE)
>  		ret = punch_hole(inode, offset, len);
>  	else
> @@ -568,6 +570,9 @@ static long f2fs_fallocate(struct file *file, int mode,
>  		inode->i_mtime = inode->i_ctime = CURRENT_TIME;
>  		mark_inode_dirty(inode);
>  	}
> +
> +	mutex_unlock(&inode->i_mutex);
> +
>  	trace_f2fs_fallocate(inode, mode, offset, len, ret);
>  	return ret;
>  }

-- 
Jaegeuk Kim
Samsung


  reply	other threads:[~2014-01-28  6:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  2:29 Chao Yu
2014-01-28  6:00 ` Jaegeuk Kim [this message]
2014-01-28  8:51   ` 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=1390888811.25542.54.camel@kjgkr \
    --to=jaegeuk.kim@samsung.com \
    --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®