[PATCH] Staging: pohmelfs: Fix a build error

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

 



Build tested only, sorry.

Signed-off-by: Alessio Igor Bogani <abogani@xxxxxxxxxx>
---
 drivers/staging/pohmelfs/inode.c |   72 +++++++++++++++++++++----------------
 1 files changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c
index cd25811..82d238a 100644
--- a/drivers/staging/pohmelfs/inode.c
+++ b/drivers/staging/pohmelfs/inode.c
@@ -1275,7 +1275,8 @@ static void pohmelfs_put_super(struct super_block *sb)
 	struct pohmelfs_inode *pi;
 	unsigned int count;
 	unsigned int in_drop_list = 0;
-	struct inode *inode, *tmp;
+	struct inode *inode, *next_i;
+	int i;
 
 	dprintk("%s.\n", __func__);
 
@@ -1290,11 +1291,11 @@ static void pohmelfs_put_super(struct super_block *sb)
 		dprintk("%s: ino: %llu, pi: %p, inode: %p, count: %u.\n",
 				__func__, pi->ino, pi, inode, count);
 
-		if (atomic_read(&inode->i_count) != count) {
+		if (inode->i_count != count) {
 			printk("%s: ino: %llu, pi: %p, inode: %p, count: %u, i_count: %d.\n",
 					__func__, pi->ino, pi, inode, count,
-					atomic_read(&inode->i_count));
-			count = atomic_read(&inode->i_count);
+					inode->i_count);
+			count = inode->i_count;
 			in_drop_list++;
 		}
 
@@ -1302,40 +1303,49 @@ static void pohmelfs_put_super(struct super_block *sb)
 			iput(&pi->vfs_inode);
 	}
 
-	list_for_each_entry_safe(inode, tmp, &sb->s_inodes, i_sb_list) {
-		pi = POHMELFS_I(inode);
-
-		dprintk("%s: ino: %llu, pi: %p, inode: %p, i_count: %u.\n",
-				__func__, pi->ino, pi, inode, atomic_read(&inode->i_count));
+	for_each_possible_cpu(i) {
+		struct list_head *list;
+#ifdef CONFIG_SMP
+		list = per_cpu_ptr(sb->s_inodes, i);
+#else
+		list = &sb->s_inodes;
+#endif
 
-		/*
-		 * These are special inodes, they were created during
-		 * directory reading or lookup, and were not bound to dentry,
-		 * so they live here with reference counter being 1 and prevent
-		 * umount from succeed since it believes that they are busy.
-		 */
-		count = atomic_read(&inode->i_count);
-		if (count) {
-			list_del_init(&inode->i_sb_list);
-			while (count--)
-				iput(&pi->vfs_inode);
+		list_for_each_entry_safe(inode, next_i, list, i_sb_list) {
+			pi = POHMELFS_I(inode);
+
+			dprintk("%s: ino: %llu, pi: %p, inode: %p, i_count: %u.\n",
+					__func__, pi->ino, pi, inode, atomic_read(&inode->i_count));
+
+			/*
+			 * These are special inodes, they were created during
+			 * directory reading or lookup, and were not bound to dentry,
+			 * so they live here with reference counter being 1 and prevent
+			 * umount from succeed since it believes that they are busy.
+			 */
+			count = inode->i_count;
+			if (count) {
+				list_del_init(&inode->i_sb_list);
+				while (count--)
+					iput(&pi->vfs_inode);
+			}
 		}
-	}
 
-	psb->trans_scan_timeout = psb->drop_scan_timeout = 0;
-	cancel_rearming_delayed_work(&psb->dwork);
-	cancel_rearming_delayed_work(&psb->drop_dwork);
-	flush_scheduled_work();
+		psb->trans_scan_timeout = psb->drop_scan_timeout = 0;
+		cancel_rearming_delayed_work(&psb->dwork);
+		cancel_rearming_delayed_work(&psb->drop_dwork);
+		flush_scheduled_work();
 
-	dprintk("%s: stopped workqueues.\n", __func__);
+		dprintk("%s: stopped workqueues.\n", __func__);
 
-	pohmelfs_crypto_exit(psb);
-	pohmelfs_state_exit(psb);
+		pohmelfs_crypto_exit(psb);
+		pohmelfs_state_exit(psb);
 
-	bdi_destroy(&psb->bdi);
+		bdi_destroy(&psb->bdi);
 
-	kfree(psb);
-	sb->s_fs_info = NULL;
+		kfree(psb);
+		sb->s_fs_info = NULL;
+	}
 }
 
 static int pohmelfs_statfs(struct dentry *dentry, struct kstatfs *buf)
-- 
1.7.0.4

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

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux