summaryrefslogtreecommitdiffstats
path: root/drivers/block/rd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/rd.c')
-rw-r--r--drivers/block/rd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/block/rd.c b/drivers/block/rd.c
index ffd6abd6d5a0..940bfd7951e5 100644
--- a/drivers/block/rd.c
+++ b/drivers/block/rd.c
@@ -186,7 +186,8 @@ static int ramdisk_writepages(struct address_space *mapping,
*/
static int ramdisk_set_page_dirty(struct page *page)
{
- SetPageDirty(page);
+ if (!TestSetPageDirty(page))
+ return 1;
return 0;
}
@@ -310,12 +311,12 @@ static int rd_ioctl(struct inode *inode, struct file *file,
* cache
*/
error = -EBUSY;
- down(&bdev->bd_sem);
+ mutex_lock(&bdev->bd_mutex);
if (bdev->bd_openers <= 2) {
truncate_inode_pages(bdev->bd_inode->i_mapping, 0);
error = 0;
}
- up(&bdev->bd_sem);
+ mutex_unlock(&bdev->bd_mutex);
return error;
}