diff options
author | imp <imp@FreeBSD.org> | 2008-09-28 22:42:29 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2008-09-28 22:42:29 +0000 |
commit | 83045cd47beead80622500100f12d67745f65b94 (patch) | |
tree | f528f4191b701f7a34962ba2dcf7c4e2aa02cbb4 | |
parent | 0de91f430bf941d9f61c958e040420c3b7e3cab0 (diff) | |
download | FreeBSD-src-83045cd47beead80622500100f12d67745f65b94.zip FreeBSD-src-83045cd47beead80622500100f12d67745f65b94.tar.gz |
When a device is read only, fail all non-read BIO requests.
Submitted by: mav@
-rw-r--r-- | sys/dev/mmc/mmcsd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 5c498fa..0c7eeca 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -215,8 +215,15 @@ mmcsd_task(void *arg) MMCSD_UNLOCK(sc); if (!sc->running) break; +// printf("mmc_task: request %p for block %ju\n", bp, bp->bio_pblkno); + if (bp->bio_cmd != BIO_READ && mmc_get_read_only(dev)) { + bp->bio_error = EROFS; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + biodone(bp); + continue; + } MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev); -// printf("mmc_task: request %p for block %lld\n", bp, bp->bio_pblkno); sz = sc->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); // XXX should use read/write_mulit |