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: <502CC52D.20003@gmail.com>
Date:	Thu, 16 Aug 2012 12:02:21 +0200
From:	Marco Stornelli <marco.stornelli@...il.com>
To:	bharrosh@...asas.com, bhalevy@...ian.com, jack@...e.cz,
	Andrew Morton <akpm@...ux-foundation.org>,
	adilger.kernel@...ger.ca, tytso@....edu,
	hirofumi@...l.parknet.co.jp, mikulas@...ax.karlin.mff.cuni.cz,
	Al Viro <viro@...IV.linux.org.uk>, hch@...radead.org,
	dushistov@...l.ru, osd-dev@...n-osd.org,
	Linux Kernel <linux-kernel@...r.kernel.org>,
	linux-ext4@...r.kernel.org,
	Linux FS Devel <linux-fsdevel@...r.kernel.org>
Subject: [PATCH 4/8] ext4: remove lock/unlock super

From: Marco Stornelli <marco.stornelli@...il.com>

Replaced lock and unlock super with a new fs mutex s_lock.

Signed-off-by: Marco Stornelli <marco.stornelli@...il.com>
---

diff -Nurp linux-3.6-rc1-orig/fs/ext4/ext4.h linux-3.6-rc1/fs/ext4/ext4.h
--- linux-3.6-rc1-orig/fs/ext4/ext4.h	2012-08-16 09:37:31.000000000 +0200
+++ linux-3.6-rc1/fs/ext4/ext4.h	2012-08-16 09:50:40.000000000 +0200
@@ -1293,6 +1293,8 @@ struct ext4_sb_info {
 	/* Reference to checksum algorithm driver via cryptoapi */
 	struct crypto_shash *s_chksum_driver;
 
+	struct mutex s_lock;
+
 	/* Precomputed FS UUID checksum for seeding other checksums */
 	__u32 s_csum_seed;
 };
diff -Nurp linux-3.6-rc1-orig/fs/ext4/super.c linux-3.6-rc1/fs/ext4/super.c
--- linux-3.6-rc1-orig/fs/ext4/super.c	2012-08-16 09:37:32.000000000 +0200
+++ linux-3.6-rc1/fs/ext4/super.c	2012-08-16 09:54:30.000000000 +0200
@@ -861,7 +861,7 @@ static void ext4_put_super(struct super_
 	flush_workqueue(sbi->dio_unwritten_wq);
 	destroy_workqueue(sbi->dio_unwritten_wq);
 
-	lock_super(sb);
+	mutex_lock(&sbi->s_lock);
 	if (sbi->s_journal) {
 		err = jbd2_journal_destroy(sbi->s_journal);
 		sbi->s_journal = NULL;
@@ -928,7 +928,7 @@ static void ext4_put_super(struct super_
 	 * Now that we are completely done shutting down the
 	 * superblock, we need to actually destroy the kobject.
 	 */
-	unlock_super(sb);
+	mutex_unlock(&sbi->s_lock);
 	kobject_put(&sbi->s_kobj);
 	wait_for_completion(&sbi->s_kobj_unregister);
 	if (sbi->s_chksum_driver)
@@ -3718,6 +3718,7 @@ static int ext4_fill_super(struct super_
 	sbi->s_gdb_count = db_count;
 	get_random_bytes(&sbi->s_next_generation, sizeof(u32));
 	spin_lock_init(&sbi->s_next_gen_lock);
+	mutex_init(&sbi->s_lock);
 
 	init_timer(&sbi->s_err_report);
 	sbi->s_err_report.function = print_daily_error_info;
@@ -4519,11 +4520,11 @@ static int ext4_unfreeze(struct super_bl
 	if (sb->s_flags & MS_RDONLY)
 		return 0;
 
-	lock_super(sb);
+	mutex_lock(&EXT4_SB(sb)->s_lock);
 	/* Reset the needs_recovery flag before the fs is unlocked. */
 	EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
 	ext4_commit_super(sb, 1);
-	unlock_super(sb);
+	mutex_unlock(&EXT4_SB(sb)->s_lock);
 	return 0;
 }
 
@@ -4559,7 +4560,7 @@ static int ext4_remount(struct super_blo
 	char *orig_data = kstrdup(data, GFP_KERNEL);
 
 	/* Store the original options */
-	lock_super(sb);
+	mutex_lock(&sbi->s_lock);
 	old_sb_flags = sb->s_flags;
 	old_opts.s_mount_opt = sbi->s_mount_opt;
 	old_opts.s_mount_opt2 = sbi->s_mount_opt2;
@@ -4701,7 +4702,7 @@ static int ext4_remount(struct super_blo
 	if (sbi->s_journal == NULL)
 		ext4_commit_super(sb, 1);
 
-	unlock_super(sb);
+	mutex_unlock(&sbi->s_lock);
 #ifdef CONFIG_QUOTA
 	/* Release old quota file names */
 	for (i = 0; i < MAXQUOTAS; i++)
@@ -4715,7 +4716,7 @@ static int ext4_remount(struct super_blo
 					EXT4_FEATURE_RO_COMPAT_QUOTA)) {
 			err = ext4_enable_quotas(sb);
 			if (err) {
-				lock_super(sb);
+				mutex_lock(&sbi->s_lock);
 				goto restore_opts;
 			}
 		}
@@ -4744,7 +4745,7 @@ restore_opts:
 		sbi->s_qf_names[i] = old_opts.s_qf_names[i];
 	}
 #endif
-	unlock_super(sb);
+	mutex_unlock(&sbi->s_lock);
 	kfree(orig_data);
 	return err;
 }


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