diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-05 06:45:44 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-05 06:45:44 +0100 |
commit | bbeba4c35c252b2e961f09ce6ebe76b2cd5e7e3e (patch) | |
tree | 3fb4c0ae65f0c13be884280755cf65314a93ebce /fs | |
parent | Merge branch 'drm-gem-update' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
parent | [PATCH] fix bogus argument of blkdev_put() in pktcdvd (diff) | |
download | linux-bbeba4c35c252b2e961f09ce6ebe76b2cd5e7e3e.tar.xz linux-bbeba4c35c252b2e961f09ce6ebe76b2cd5e7e3e.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev:
[PATCH] fix bogus argument of blkdev_put() in pktcdvd
[PATCH 2/2] documnt FMODE_ constants
[PATCH 1/2] kill FMODE_NDELAY_NOW
[PATCH] clean up blkdev_get a little bit
[PATCH] Fix block dev compat ioctl handling
[PATCH] kill obsolete temporary comment in swsusp_close()
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index db831efbdbbd..99e0ae1a4c78 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1135,12 +1135,15 @@ static int blkdev_open(struct inode * inode, struct file * filp) if (res) return res; - if (!(filp->f_mode & FMODE_EXCL)) - return 0; + if (filp->f_mode & FMODE_EXCL) { + res = bd_claim(bdev, filp); + if (res) + goto out_blkdev_put; + } - if (!(res = bd_claim(bdev, filp))) - return 0; + return 0; + out_blkdev_put: blkdev_put(bdev, filp->f_mode); return res; } @@ -1203,8 +1206,16 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg) { struct block_device *bdev = I_BDEV(file->f_mapping->host); fmode_t mode = file->f_mode; + + /* + * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have + * to updated it before every ioctl. + */ if (file->f_flags & O_NDELAY) - mode |= FMODE_NDELAY_NOW; + mode |= FMODE_NDELAY; + else + mode &= ~FMODE_NDELAY; + return blkdev_ioctl(bdev, mode, cmd, arg); } |