diff --git a/driver/device-mapper/dm-fs.c b/driver/device-mapper/dm-fs.c index 05906cb38..d46e1035c 100644 --- a/driver/device-mapper/dm-fs.c +++ b/driver/device-mapper/dm-fs.c @@ -79,7 +79,7 @@ int dm_init_fs() if (!(_proc_dir = create_proc_entry(_fs_dir, S_IFDIR, &proc_root))) goto fail; - if (!(_control = create_proc_entry(_control_name, 0, _proc_dir))) + if (!(_control = create_proc_entry(_control_name, S_IFREG, _proc_dir))) goto fail; _control->write_proc = _line_splitter; diff --git a/driver/device-mapper/dm.c b/driver/device-mapper/dm.c index 1d424017e..0602799bc 100644 --- a/driver/device-mapper/dm.c +++ b/driver/device-mapper/dm.c @@ -150,8 +150,13 @@ static int _request_fn(request_queue_t *q, int rw, struct buffer_head *bh); */ static int _init(void) { + int ret; + init_rwsem(&_dev_lock); + if ((ret = dm_init_fs())) + return ret; + if (!dm_std_targets()) return -EIO; /* FIXME: better error value */ @@ -161,7 +166,7 @@ static int _init(void) blksize_size[MAJOR_NR] = _blksize_size; hardsect_size[MAJOR_NR] = _hardsect_size; - if (register_blkdev(MAJOR_NR, _name, &_blk_dops) < 0) { + if (devfs_register_blkdev(MAJOR_NR, _name, &_blk_dops) < 0) { printk(KERN_ERR "%s -- register_blkdev failed\n", _name); return -EIO; } @@ -175,7 +180,9 @@ static int _init(void) static void _fin(void) { - if (unregister_blkdev(MAJOR_NR, _name) < 0) + dm_fin_fs(); + + if (devfs_unregister_blkdev(MAJOR_NR, _name) < 0) printk(KERN_ERR "%s -- unregister_blkdev failed\n", _name); read_ahead[MAJOR_NR] = 0;