btrfs-progs: close all fs_devices before exit in some commands
authorZhao Lei <zhaolei@cn.fujitsu.com>
Mon, 24 Aug 2015 08:45:03 +0000 (16:45 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 31 Aug 2015 17:25:13 +0000 (19:25 +0200)
commitec1fc69d3945f67684a2c15969dfb309ed967168
tree478a9c43eec1586aca8cf9c04ae86c9ec4a047c6
parentb0f760c91aa9de9a853545f36dc063f6ef5e9008
btrfs-progs: close all fs_devices before exit in some commands

mkfs creates more than one fs_devices in fs_uuids.
1: one is for file system being created
2: others are created in test_dev_for_mkfs in order to check mount point
   test_dev_for_mkfs()-> ... -> btrfs_scan_one_device()

Current code only closes 1, and this patch also closes in case 2.

Similar problem exist in other tools, eg.::

 cmd-check.c: the function is:
 cmd_check()->check_mounted()-> ... -> btrfs_scan_one_device()
 ...

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c
cmds-device.c
cmds-replace.c
mkfs.c