2011-02-16 22:23:31

by Chuck Ebbert

[permalink] [raw]
Subject: [Patch] 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.

Signed-off-by: Chuck Ebbert <[email protected]>

--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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);


2011-02-16 22:30:18

by Linus Torvalds

[permalink] [raw]
Subject: Re: [Patch] Revert block_dev read-only check

On Wed, Feb 16, 2011 at 2:19 PM, Chuck Ebbert <[email protected]> wrote:
> 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