mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
bcache: intercept test mode before write
Don't allow writes in test mode. test mode should be more sophisticated than just faking writes, and this should be a last defense for cases where test mode is not being checked correctly.
This commit is contained in:
parent
9b6a62f944
commit
aa833bdd8a
@ -922,6 +922,9 @@ bool dev_write_bytes(struct device *dev, off_t start, size_t len, void *data)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (test_mode())
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!scan_bcache) {
|
if (!scan_bcache) {
|
||||||
if (!dev_open(dev))
|
if (!dev_open(dev))
|
||||||
return false;
|
return false;
|
||||||
@ -955,6 +958,9 @@ bool dev_write_zeros(struct device *dev, off_t start, size_t len)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (test_mode())
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!scan_bcache) {
|
if (!scan_bcache) {
|
||||||
if (!dev_open(dev))
|
if (!dev_open(dev))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user