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] [day] [month] [year] [list]
Message-Id: <1350616602-6892-3-git-send-email-herumi@nifty.com>
Date:	Fri, 19 Oct 2012 12:16:42 +0900
From:	MITSUNARI Shigeo <herumi@...ty.com>
To:	linux-fsdevel@...r.kernel.org
Cc:	Alexander Viro <viro@...iv.linux.org.uk>,
	linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
	MITSUNARI Shigeo <herumi@...ty.com>
Subject: [PATCH 2/2] block: fs: move 'bdev->bd_invalidated = 0' into check_disk_size_change() instead of putting the code every time after check_disk_size_change().

The following code appeares in invalidate_partitions(), rescan_partitions() and revalidate_disk().

>check_disk_size_change(disk, bdev);
>bdev->bd_invalidted = 0;

check_disk_size_change() is called from only those three functions.
so how about setting bdev->bd_invalidated = 0 in check_disk_size_change()?

Signed-off-by: MITSUNARI Shigeo <herumi@...ty.com>
---
 block/partition-generic.c |    2 --
 fs/block_dev.c            |    2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/block/partition-generic.c b/block/partition-generic.c
index f1d1451..6a65169 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -429,7 +429,6 @@ rescan:
 	if (disk->fops->revalidate_disk)
 		disk->fops->revalidate_disk(disk);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
 		return 0;
 	if (IS_ERR(state)) {
@@ -542,7 +541,6 @@ int invalidate_partitions(struct gendisk *disk, struct block_device *bdev)
 
 	set_capacity(disk, 0);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	/* tell userspace that the media / partition table may have changed */
 	kobject_uevent(&disk_to_dev(disk)->kobj, KOBJ_CHANGE);
 
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2577cf4..ef0189b 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1022,6 +1022,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev)
 		i_size_write(bdev->bd_inode, disk_size);
 		flush_disk(bdev, false);
 	}
+	bdev->bd_invalidated = 0;
 }
 EXPORT_SYMBOL(check_disk_size_change);
 
@@ -1047,7 +1048,6 @@ int revalidate_disk(struct gendisk *disk)
 
 	mutex_lock(&bdev->bd_mutex);
 	check_disk_size_change(disk, bdev);
-	bdev->bd_invalidated = 0;
 	mutex_unlock(&bdev->bd_mutex);
 	bdput(bdev);
 	return ret;
-- 
1.7.9.5

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