summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2016-04-11 11:51:51 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2016-04-15 08:49:47 -0700
commitde5307e46d28aa26ffd6f2048398b6303e134a67 (patch)
treed3dfb485cb2ea31b917d99c3d08c23f19058d2aa /fs
parentff37355886ac2082cee594aa949c08e2cfb33aa0 (diff)
downloadblackbird-obmc-linux-de5307e46d28aa26ffd6f2048398b6303e134a67.tar.gz
blackbird-obmc-linux-de5307e46d28aa26ffd6f2048398b6303e134a67.zip
f2fs: fix dropping inmemory pages in a wrong time
When one reader closes its file while the other writer is doing atomic writes, f2fs_release_file drops atomic data resulting in an empty commit. This patch fixes this wrong commit problem by checking openess of the file. Process0 Process1 open file start atomic write write data read data close file f2fs_release_file() clear atomic data commit atomic write Reported-by: Miao Xie <miaoxie@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 90d1157a09f9..e10eb61d9f62 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1254,6 +1254,14 @@ out:
static int f2fs_release_file(struct inode *inode, struct file *filp)
{
+ /*
+ * f2fs_relase_file is called at every close calls. So we should
+ * not drop any inmemory pages by close called by other process.
+ */
+ if (!(filp->f_mode & FMODE_WRITE) ||
+ atomic_read(&inode->i_writecount) != 1)
+ return 0;
+
/* some remained atomic pages should discarded */
if (f2fs_is_atomic_file(inode))
drop_inmem_pages(inode);
OpenPOWER on IntegriCloud