Skip to contentSkip to conversation

Revert block_dev read-only check

PATCH Superseded Chuck Ebbert 2 participants 2 messages Feb 16, 2011 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert block_dev read-only check

This reverts commit 75f1dc0d076d1c1168f2115f1941ea627d38bd5a. The revert could not be done automatically because changes after that commit altered the code too much.

fs/block_dev.c +5 -6
@@ -1215,12 +1215,6 @@ int blkdev_get(struct block_device *bdev
 
 	res = __blkdev_get(bdev, mode, 0);
 
-	/* __blkdev_get() may alter read only status, check it afterwards */
-	if (!res && (mode & FMODE_WRITE) && bdev_read_only(bdev)) {
-		__blkdev_put(bdev, mode, 0);
-		res = -EACCES;
-	}
-
 	if (whole) {
 		/* finish claiming */
 		mutex_lock(&bdev->bd_mutex);
@@ -1298,6 +1292,11 @@ struct block_device *blkdev_get_by_path(
 	if (err)
 		return ERR_PTR(err);
 
+	if ((mode & FMODE_WRITE) && bdev_read_only(bdev)) {
+		blkdev_put(bdev, mode);
+		return ERR_PTR(-EACCES);
+	}
+
 	return bdev;
 }
 EXPORT_SYMBOL(blkdev_get_by_path);
#1 lore raw
Quoted 3 lines · Chuck Ebbert

This reverts commit 75f1dc0d076d1c1168f2115f1941ea627d38bd5a. The revert could not be done automatically because changes after that commit altered the code too much.

I really want to hear about _why_ something is reverted too. I'm not taking patches without explanations. And explaining that it's non-automatic (and why _that_ is), is not explaining why it needed to be reverted in the first place.

Please. Think of the poor people who wonder why..

Linus