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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090117023007.20425.67727.stgit@crlf.corp.google.com>
Date:	Fri, 16 Jan 2009 18:30:07 -0800
From:	Mike Waychison <mikew@...gle.com>
To:	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: [PATCH v1 6/8] hugetlbfs drop_inode update

Update hugetlbfs to compile with the new drop_inode callback mechanism that
works with phases.

Signed-off-by: Mike Waychison <mikew@...gle.com>
---

 fs/hugetlbfs/inode.c |   72 +++++++++++++++++++++++++++++---------------------
 1 files changed, 42 insertions(+), 30 deletions(-)

diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 6903d37..986fed4 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -388,46 +388,58 @@ static void hugetlbfs_delete_inode(struct inode *inode)
 	clear_inode(inode);
 }
 
-static void hugetlbfs_forget_inode(struct inode *inode) __releases(inode_lock)
+static int hugetlbfs_forget_inode(struct inode *inode,
+				  enum drop_inode_phase phase)
 {
 	struct super_block *sb = inode->i_sb;
 
-	if (!hlist_unhashed(&inode->i_hash)) {
-		if (!(inode->i_state & (I_DIRTY|I_SYNC)))
-			list_move(&inode->i_list, &inode_unused);
-		inodes_stat.nr_unused++;
-		if (!sb || (sb->s_flags & MS_ACTIVE)) {
-			spin_unlock(&inode_lock);
-			return;
+	switch (phase) {
+	case DIP_START_FREEING:
+		if (!hlist_unhashed(&inode->i_hash)) {
+			if (!(inode->i_state & (I_DIRTY|I_SYNC)))
+				list_move(&inode->i_list, &inode_unused);
+			inodes_stat.nr_unused++;
+			if (!sb || (sb->s_flags & MS_ACTIVE))
+				return 1;
+			inode->i_state |= I_WILL_FREE;
 		}
-		inode->i_state |= I_WILL_FREE;
-		spin_unlock(&inode_lock);
-		/*
-		 * write_inode_now is a noop as we set BDI_CAP_NO_WRITEBACK
-		 * in our backing_dev_info.
-		 */
-		write_inode_now(inode, 1);
-		spin_lock(&inode_lock);
-		inode->i_state &= ~I_WILL_FREE;
-		inodes_stat.nr_unused--;
-		hlist_del_init(&inode->i_hash);
+		break;
+	case DIP_DELETING:
+		if (!hlist_unhashed(&inode->i_hash)) {
+			/*
+			 * write_inode_now is a noop as we set
+			 * BDI_CAP_NO_WRITEBACK in our backing_dev_info.
+			 */
+			write_inode_now(inode, 1);
+		}
+		break;
+	case DIP_UNHASHING:
+		if (!hlist_unhashed(&inode->i_hash)) {
+			inode->i_state &= ~I_WILL_FREE;
+			inodes_stat.nr_unused--;
+			hlist_del_init(&inode->i_hash);
+		}
+		list_del_init(&inode->i_list);
+		list_del_init(&inode->i_sb_list);
+		inode->i_state |= I_FREEING;
+		inodes_stat.nr_inodes--;
+		break;
+	case DIP_DESTROYING:
+		truncate_hugepages(inode, 0);
+		clear_inode(inode);
+		destroy_inode(inode);
+		break;
 	}
-	list_del_init(&inode->i_list);
-	list_del_init(&inode->i_sb_list);
-	inode->i_state |= I_FREEING;
-	inodes_stat.nr_inodes--;
-	spin_unlock(&inode_lock);
-	truncate_hugepages(inode, 0);
-	clear_inode(inode);
-	destroy_inode(inode);
+	return 0;
 }
 
-static void hugetlbfs_drop_inode(struct inode *inode)
+static int hugetlbfs_drop_inode(struct inode *inode,
+				enum drop_inode_phase phase)
 {
 	if (!inode->i_nlink)
-		generic_delete_inode(inode);
+		return generic_delete_inode(inode, phase);
 	else
-		hugetlbfs_forget_inode(inode);
+		return hugetlbfs_forget_inode(inode, phase);
 }
 
 static inline void

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ