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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pr7g3tgr.fsf@devron.myhome.or.jp>
Date:	Wed, 18 Nov 2009 21:31:16 +0900
From:	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To:	Jan Blunck <jblunck@...e.de>
Cc:	linux-fsdevel@...r.kernel.org,
	Linux-Kernel Mailinglist <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>, jkacur@...hat.com,
	Thomas Gleixner <tglx@...utronix.de>,
	Christoph Hellwig <hch@...radead.org>,
	Arnd Bergmann <arnd@...db.de>, matthew@....cx,
	Andi Kleen <andi@...stfloor.org>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH 19/20] ext2: Add ext2_sb_info s_lock spinlock

Jan Blunck <jblunck@...e.de> writes:

> +static void ext2_sync_super(struct super_block *sb,
> +			    struct ext2_super_block *es)
>  {
> +	spin_lock(&EXT2_SB(sb)->s_lock);
>  	es->s_free_blocks_count = cpu_to_le32(ext2_count_free_blocks(sb));
>  	es->s_free_inodes_count = cpu_to_le32(ext2_count_free_inodes(sb));
>  	es->s_wtime = cpu_to_le32(get_seconds());
> +	/* unlock before we do IO */
> +	spin_unlock(&EXT2_SB(sb)->s_lock);
>  	mark_buffer_dirty(EXT2_SB(sb)->s_sbh);
>  	sync_dirty_buffer(EXT2_SB(sb)->s_sbh);
>  	sb->s_dirt = 0;

[...]

>  static int ext2_sync_fs(struct super_block *sb, int wait)
>  {
> -	struct ext2_super_block *es = EXT2_SB(sb)->s_es;
> +	struct ext2_sb_info *sbi = EXT2_SB(sb);
> +	struct ext2_super_block *es = sbi->s_es;
>  
>  	lock_kernel();
> +	spin_lock(&sbi->s_lock);
>  	if (es->s_state & cpu_to_le16(EXT2_VALID_FS)) {
>  		ext2_debug("setting valid to 0\n");
>  		es->s_state &= cpu_to_le16(~EXT2_VALID_FS);
> @@ -1137,9 +1159,11 @@ static int ext2_sync_fs(struct super_block *sb, int wait)
>  		es->s_free_inodes_count =
>  			cpu_to_le32(ext2_count_free_inodes(sb));
>  		es->s_mtime = cpu_to_le32(get_seconds());
> +		spin_unlock(&EXT2_SB(sb)->s_lock);
>  		ext2_sync_super(sb, es);
>  	} else {
>  		ext2_commit_super(sb, es);
> +		spin_unlock(&sbi->s_lock);
>  	}
>  	sb->s_dirt = 0;

[...]

> @@ -1237,6 +1264,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
>  		if (!ext2_setup_super (sb, es, 0))
>  			sb->s_flags &= ~MS_RDONLY;
>  	}
> +	spin_unlock(&EXT2_SB(sb)->s_lock);
>  	ext2_sync_super(sb, es);
>  	unlock_kernel();
>  	return 0;

ext2_setup_super() will call ext2_sync_fs(), so ->s_lock seems to be
recursive in here.

Thanks.
-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
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