summaryrefslogtreecommitdiff
path: root/libbcache/fs.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-03-01 01:45:15 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-03-08 02:34:33 -0900
commit06b73dbd7ffc0296b2ecea8d3bc55bfeb72d7f2a (patch)
tree1ba37985a18eb2d9a9616ee160c82339e23e2160 /libbcache/fs.c
parent171ee48e57be78f4e95954c99851553fa523bf91 (diff)
Diffstat (limited to 'libbcache/fs.c')
-rw-r--r--libbcache/fs.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/libbcache/fs.c b/libbcache/fs.c
index ab0d972..ec70a3e 100644
--- a/libbcache/fs.c
+++ b/libbcache/fs.c
@@ -1257,13 +1257,17 @@ static struct cache_set *bch_open_as_blockdevs(const char *_dev_name,
if (!c)
goto err_unlock;
- if (!test_bit(BCH_FS_RUNNING, &c->flags)) {
+ mutex_lock(&c->state_lock);
+
+ if (!bch_fs_running(c)) {
+ mutex_unlock(&c->state_lock);
err = "incomplete cache set";
c = NULL;
goto err_unlock;
}
closure_get(&c->cl);
+ mutex_unlock(&c->state_lock);
mutex_unlock(&bch_register_lock);
}
@@ -1291,22 +1295,19 @@ static int bch_remount(struct super_block *sb, int *flags, char *data)
if (ret)
return ret;
- mutex_lock(&bch_register_lock);
-
if (opts.read_only >= 0 &&
opts.read_only != c->opts.read_only) {
const char *err = NULL;
if (opts.read_only) {
- bch_fs_read_only_sync(c);
+ bch_fs_read_only(c);
sb->s_flags |= MS_RDONLY;
} else {
err = bch_fs_read_write(c);
if (err) {
bch_err(c, "error going rw: %s", err);
- ret = -EINVAL;
- goto unlock;
+ return -EINVAL;
}
sb->s_flags &= ~MS_RDONLY;
@@ -1318,9 +1319,6 @@ static int bch_remount(struct super_block *sb, int *flags, char *data)
if (opts.errors >= 0)
c->opts.errors = opts.errors;
-unlock:
- mutex_unlock(&bch_register_lock);
-
return ret;
}
@@ -1449,7 +1447,7 @@ static void bch_kill_sb(struct super_block *sb)
generic_shutdown_super(sb);
if (test_bit(BCH_FS_BDEV_MOUNTED, &c->flags))
- bch_fs_stop_sync(c);
+ bch_fs_stop(c);
else
closure_put(&c->cl);
}
@@ -1464,7 +1462,7 @@ static struct file_system_type bcache_fs_type = {
MODULE_ALIAS_FS("bcache");
-void bch_fs_exit(void)
+void bch_vfs_exit(void)
{
unregister_filesystem(&bcache_fs_type);
if (bch_dio_write_bioset)
@@ -1477,7 +1475,7 @@ void bch_fs_exit(void)
kmem_cache_destroy(bch_inode_cache);
}
-int __init bch_fs_init(void)
+int __init bch_vfs_init(void)
{
int ret = -ENOMEM;
@@ -1504,6 +1502,6 @@ int __init bch_fs_init(void)
return 0;
err:
- bch_fs_exit();
+ bch_vfs_exit();
return ret;
}