mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-06 05:45:29 +02:00
make set_blocksize() fail unless block device is opened exclusive
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
ead083aeee
commit
d18a867958
|
@ -1134,3 +1134,10 @@ superblock of the main block device, i.e., the one stored in sb->s_bdev. Block
|
||||||
device freezing now works for any block device owned by a given superblock, not
|
device freezing now works for any block device owned by a given superblock, not
|
||||||
just the main block device. The get_active_super() helper and bd_fsfreeze_sb
|
just the main block device. The get_active_super() helper and bd_fsfreeze_sb
|
||||||
pointer are gone.
|
pointer are gone.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**mandatory**
|
||||||
|
|
||||||
|
set_blocksize() takes opened struct file instead of struct block_device now
|
||||||
|
and it *must* be opened exclusive.
|
||||||
|
|
|
@ -157,6 +157,9 @@ int set_blocksize(struct file *file, int size)
|
||||||
if (size < bdev_logical_block_size(bdev))
|
if (size < bdev_logical_block_size(bdev))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!file->private_data)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
/* Don't change the size if it is same as current */
|
/* Don't change the size if it is same as current */
|
||||||
if (inode->i_blkbits != blksize_bits(size)) {
|
if (inode->i_blkbits != blksize_bits(size)) {
|
||||||
sync_blockdev(bdev);
|
sync_blockdev(bdev);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user