Re: [f2fs-dev] [PATCH] f2fs: use inode mutex to keep atomicity of f2fs_falloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> ---
>  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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux