lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-id: <013301d16fb1$302a2d20$907e8760$@samsung.com>
Date:	Thu, 25 Feb 2016 17:44:01 +0800
From:	Chao Yu <chao2.yu@...sung.com>
To:	Jaegeuk Kim <jaegeuk@...nel.org>
Cc:	linux-f2fs-devel@...ts.sourceforge.net,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] f2fs: update inode page under cp_rwsem lock

We should update inode page under protection of cp_rwsem lock, otherwise
new dirty inode pages will generated by ->fsync or ->write_inode during
checkpoint, which should not be allowed.

Signed-off-by: Chao Yu <chao2.yu@...sung.com>
---
 fs/f2fs/inode.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index cb269c4..cdfe114 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -295,6 +295,7 @@ retry:
 int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 {
 	struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
+	bool updated;
 
 	if (inode->i_ino == F2FS_NODE_INO(sbi) ||
 			inode->i_ino == F2FS_META_INO(sbi))
@@ -307,7 +308,11 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	 * We need to balance fs here to prevent from producing dirty node pages
 	 * during the urgent cleaning time when runing out of free sections.
 	 */
-	if (update_inode_page(inode))
+	f2fs_lock_op(sbi);
+	updated = update_inode_page(inode);
+	f2fs_unlock_op(sbi);
+
+	if (updated)
 		f2fs_balance_fs(sbi, true);
 	return 0;
 }
-- 
2.7.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ