Revert check for read-only block device added in .38 (#672265)

This commit is contained in:
Chuck Ebbert 2011-02-16 17:04:06 -05:00
parent acd41dbaf4
commit b161e65d96
2 changed files with 40 additions and 0 deletions

View File

@ -738,6 +738,9 @@ Patch12440: bridge-fix-mglist-corruption-that-leads-to-memory-corruption.patch
# rhbz#676860
Patch12441: usb-sierra-add-airprime-direct-ip.patch
# rhbz#672265
Patch12442: revert-block-check-bdev-readonly.patch
%endif
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@ -1358,6 +1361,9 @@ ApplyPatch bridge-fix-mglist-corruption-that-leads-to-memory-corruption.patch
# rhbz#676860
ApplyPatch usb-sierra-add-airprime-direct-ip.patch
# rhbz#672265
ApplyPatch revert-block-check-bdev-readonly.patch
# END OF PATCH APPLICATIONS
%endif
@ -1964,6 +1970,7 @@ fi
* Wed Feb 16 2011 Chuck Ebbert <cebbert@redhat.com>
- Add support for Airprime/Sierra USB IP modem (#676860)
- Make virtio_console built-in on x86_64 (#677713)
- Revert check for read-only block device added in .38 (#672265)
* Tue Feb 15 2011 Kyle McMartin <kmcmartin@redhat.com> 2.6.38-0.rc5.git0.1
- Linux 2.6.38-rc5 (81 minutes later...)

View File

@ -0,0 +1,33 @@
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 <cebbert@redhat.com>
--- 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);