Commit c0b88a09 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] restoring block size upon umount

get_sb_bdev() stores original block size in ->s_old_blocksize and
kill_block_super() restores it.

This kills 99% of crap with "oh, I've mounted/umounted that device and
its behaviour had changed" (remaining 1% can be dealt in pretty similar
ways; ideally I'd like to see ioctls that get/set block size dead and
gone).
parent 0d9d0576
......@@ -177,7 +177,6 @@ void fat_put_super(struct super_block *sb)
fat_clusters_flush(sb);
}
fat_cache_inval_dev(sb);
set_blocksize (sb->s_dev,BLOCK_SIZE);
if (sbi->nls_disk) {
unload_nls(sbi->nls_disk);
sbi->nls_disk = NULL;
......
......@@ -176,9 +176,6 @@ static void hfs_put_super(struct super_block *sb)
/* release the MDB's resources */
hfs_mdb_put(mdb, sb->s_flags & MS_RDONLY);
/* restore default blocksize for the device */
set_blocksize(sb->s_dev, BLOCK_SIZE);
kfree(sb->u.generic_sbp);
sb->u.generic_sbp = NULL;
}
......@@ -449,7 +446,6 @@ int hfs_fill_super(struct super_block *s, void *data, int silent)
struct hfs_sb_info *sbi;
struct hfs_mdb *mdb;
struct hfs_cat_key key;
kdev_t dev = s->s_dev;
hfs_s32 part_size, part_start;
struct inode *root_inode;
int part;
......@@ -462,7 +458,7 @@ int hfs_fill_super(struct super_block *s, void *data, int silent)
if (!parse_options((char *)data, sbi, &part)) {
hfs_warn("hfs_fs: unable to parse mount options.\n");
goto bail3;
goto bail2;
}
/* set the device driver to 512-byte blocks */
......@@ -530,8 +526,6 @@ int hfs_fill_super(struct super_block *s, void *data, int silent)
bail1:
hfs_mdb_put(mdb, s->s_flags & MS_RDONLY);
bail2:
set_blocksize(dev, BLOCK_SIZE);
bail3:
kfree(sbi);
s->u.generic_sbp = NULL;
return -EINVAL;
......
......@@ -991,7 +991,6 @@ int function2code (hashf_t func)
//
static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
{
int size;
struct inode *root_inode;
int j;
struct reiserfs_transaction_handle th ;
......@@ -1013,9 +1012,6 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
return -EINVAL;
}
size = block_size(s->s_dev);
sb_set_blocksize(s, size);
/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */
if (!read_super_block (s, REISERFS_OLD_DISK_OFFSET_IN_BYTES))
old_format = 1;
......
......@@ -26,6 +26,7 @@
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/acct.h>
#include <linux/blkdev.h>
#include <asm/uaccess.h>
void get_filesystem(struct file_system_type *fs);
......@@ -513,6 +514,8 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
} else {
s->s_flags = flags;
strncpy(s->s_id, bdevname(dev), sizeof(s->s_id));
s->s_old_blocksize = block_size(dev);
sb_set_blocksize(s, s->s_old_blocksize);
error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
if (error) {
up_write(&s->s_umount);
......@@ -535,6 +538,7 @@ void kill_block_super(struct super_block *sb)
{
struct block_device *bdev = sb->s_bdev;
generic_shutdown_super(sb);
set_blocksize(to_kdev_t(bdev->bd_dev), sb->s_old_blocksize);
bd_release(bdev);
blkdev_put(bdev, BDEV_FS);
}
......
......@@ -664,6 +664,7 @@ struct super_block {
kdev_t s_dev;
unsigned long s_blocksize;
unsigned char s_blocksize_bits;
unsigned long s_old_blocksize;
unsigned char s_dirt;
unsigned long long s_maxbytes; /* Max file size */
struct file_system_type *s_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment