Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298076
b: refs/heads/master
c: 70d5098
h: refs/heads/master
v: v3
  • Loading branch information
Alexander Stein authored and David Woodhouse committed Mar 26, 2012
1 parent eff7582 commit 514a780
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ff5e1532dd37e1bd8ac72da3f7f0e2b310102fb
refs/heads/master: 70d5098a4b1551864dd7df43f67b7f606a1a6438
1 change: 1 addition & 0 deletions trunk/drivers/mtd/mtd_blkdevs.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
ret = __get_mtd_device(dev->mtd);
if (ret)
goto error_release;
dev->file_mode = mode;

unlock:
dev->open++;
Expand Down
8 changes: 6 additions & 2 deletions trunk/drivers/mtd/mtdblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,12 @@ static int mtdblock_release(struct mtd_blktrans_dev *mbd)
mutex_unlock(&mtdblk->cache_mutex);

if (!--mtdblk->count) {
/* It was the last usage. Free the cache */
mtd_sync(mbd->mtd);
/*
* It was the last usage. Free the cache, but only sync if
* opened for writing.
*/
if (mbd->file_mode & FMODE_WRITE)
mtd_sync(mbd->mtd);
vfree(mtdblk->cache_data);
}

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mtd/blktrans.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct mtd_blktrans_dev {
struct request_queue *rq;
spinlock_t queue_lock;
void *priv;
fmode_t file_mode;
};

struct mtd_blktrans_ops {
Expand Down

0 comments on commit 514a780

Please sign in to comment.