The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2007 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Elliott Hughes | 63a3192 | 2016-06-09 17:41:22 -0700 | [diff] [blame] | 17 | #include "roots.h" |
| 18 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 19 | #include <ctype.h> |
| 20 | #include <fcntl.h> |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 21 | #include <stdlib.h> |
| 22 | #include <sys/mount.h> |
| 23 | #include <sys/stat.h> |
| 24 | #include <sys/types.h> |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 25 | #include <sys/wait.h> |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 26 | #include <unistd.h> |
| 27 | |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 28 | #include <android-base/logging.h> |
Jin Qian | ded2dac | 2017-04-21 14:36:12 -0700 | [diff] [blame] | 29 | #include <android-base/properties.h> |
| 30 | #include <android-base/stringprintf.h> |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 31 | #include <cryptfs.h> |
Tao Bao | de40ba5 | 2016-10-05 23:17:01 -0700 | [diff] [blame] | 32 | #include <ext4_utils/wipe.h> |
Ken Sumrall | f35d1ce | 2013-02-13 12:59:35 -0800 | [diff] [blame] | 33 | #include <fs_mgr.h> |
Tao Bao | de40ba5 | 2016-10-05 23:17:01 -0700 | [diff] [blame] | 34 | |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 35 | #include "common.h" |
Elliott Hughes | 63a3192 | 2016-06-09 17:41:22 -0700 | [diff] [blame] | 36 | #include "mounts.h" |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 37 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 38 | static struct fstab* fstab = nullptr; |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 39 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 40 | extern struct selabel_handle* sehandle; |
Stephen Smalley | 779701d | 2012-02-09 14:13:23 -0500 | [diff] [blame] | 41 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 42 | void load_volume_table() { |
| 43 | fstab = fs_mgr_read_fstab_default(); |
| 44 | if (!fstab) { |
| 45 | LOG(ERROR) << "Failed to read default fstab"; |
| 46 | return; |
| 47 | } |
Doug Zongker | 2810ced | 2011-02-17 15:55:21 -0800 | [diff] [blame] | 48 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 49 | int ret = fs_mgr_add_entry(fstab, "/tmp", "ramdisk", "ramdisk"); |
| 50 | if (ret == -1) { |
| 51 | LOG(ERROR) << "Failed to add /tmp entry to fstab"; |
| 52 | fs_mgr_free_fstab(fstab); |
| 53 | fstab = nullptr; |
| 54 | return; |
| 55 | } |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 56 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 57 | printf("recovery filesystem table\n"); |
| 58 | printf("=========================\n"); |
| 59 | for (int i = 0; i < fstab->num_entries; ++i) { |
| 60 | const Volume* v = &fstab->recs[i]; |
| 61 | printf(" %d %s %s %s %lld\n", i, v->mount_point, v->fs_type, v->blk_device, v->length); |
| 62 | } |
| 63 | printf("\n"); |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | Volume* volume_for_path(const char* path) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 67 | return fs_mgr_get_entry_for_mount_point(fstab, path); |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 68 | } |
| 69 | |
Tao Bao | abb8f77 | 2015-07-30 14:43:27 -0700 | [diff] [blame] | 70 | // Mount the volume specified by path at the given mount_point. |
| 71 | int ensure_path_mounted_at(const char* path, const char* mount_point) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 72 | Volume* v = volume_for_path(path); |
| 73 | if (v == nullptr) { |
| 74 | LOG(ERROR) << "unknown volume for path [" << path << "]"; |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 75 | return -1; |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 76 | } |
| 77 | if (strcmp(v->fs_type, "ramdisk") == 0) { |
| 78 | // The ramdisk is always mounted. |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | if (!scan_mounted_volumes()) { |
| 83 | LOG(ERROR) << "Failed to scan mounted volumes"; |
| 84 | return -1; |
| 85 | } |
| 86 | |
| 87 | if (!mount_point) { |
| 88 | mount_point = v->mount_point; |
| 89 | } |
| 90 | |
| 91 | const MountedVolume* mv = find_mounted_volume_by_mount_point(mount_point); |
| 92 | if (mv != nullptr) { |
| 93 | // Volume is already mounted. |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | mkdir(mount_point, 0755); // in case it doesn't already exist |
| 98 | |
| 99 | if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "squashfs") == 0 || |
| 100 | strcmp(v->fs_type, "vfat") == 0) { |
| 101 | int result = mount(v->blk_device, mount_point, v->fs_type, v->flags, v->fs_options); |
| 102 | if (result == -1 && fs_mgr_is_formattable(v)) { |
| 103 | PLOG(ERROR) << "Failed to mount " << mount_point << "; formatting"; |
| 104 | bool crypt_footer = fs_mgr_is_encryptable(v) && !strcmp(v->key_loc, "footer"); |
| 105 | if (fs_mgr_do_format(v, crypt_footer) == 0) { |
| 106 | result = mount(v->blk_device, mount_point, v->fs_type, v->flags, v->fs_options); |
| 107 | } else { |
| 108 | PLOG(ERROR) << "Failed to format " << mount_point; |
| 109 | return -1; |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | if (result == -1) { |
| 114 | PLOG(ERROR) << "Failed to mount " << mount_point; |
| 115 | return -1; |
| 116 | } |
| 117 | return 0; |
| 118 | } |
| 119 | |
| 120 | LOG(ERROR) << "unknown fs_type \"" << v->fs_type << "\" for " << mount_point; |
| 121 | return -1; |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Tao Bao | abb8f77 | 2015-07-30 14:43:27 -0700 | [diff] [blame] | 124 | int ensure_path_mounted(const char* path) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 125 | // Mount at the default mount point. |
| 126 | return ensure_path_mounted_at(path, nullptr); |
Tao Bao | abb8f77 | 2015-07-30 14:43:27 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 129 | int ensure_path_unmounted(const char* path) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 130 | const Volume* v = volume_for_path(path); |
| 131 | if (v == nullptr) { |
| 132 | LOG(ERROR) << "unknown volume for path [" << path << "]"; |
| 133 | return -1; |
| 134 | } |
| 135 | if (strcmp(v->fs_type, "ramdisk") == 0) { |
| 136 | // The ramdisk is always mounted; you can't unmount it. |
| 137 | return -1; |
| 138 | } |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 139 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 140 | if (!scan_mounted_volumes()) { |
| 141 | LOG(ERROR) << "Failed to scan mounted volumes"; |
| 142 | return -1; |
| 143 | } |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 144 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 145 | MountedVolume* mv = find_mounted_volume_by_mount_point(v->mount_point); |
| 146 | if (mv == nullptr) { |
| 147 | // Volume is already unmounted. |
| 148 | return 0; |
| 149 | } |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 150 | |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 151 | return unmount_mounted_volume(mv); |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 152 | } |
| 153 | |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 154 | static int exec_cmd(const char* path, char* const argv[]) { |
| 155 | int status; |
| 156 | pid_t child; |
| 157 | if ((child = vfork()) == 0) { |
| 158 | execv(path, argv); |
Tao Bao | 3da8801 | 2017-02-03 13:09:23 -0800 | [diff] [blame] | 159 | _exit(EXIT_FAILURE); |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 160 | } |
| 161 | waitpid(child, &status, 0); |
| 162 | if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 163 | LOG(ERROR) << path << " failed with status " << WEXITSTATUS(status); |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 164 | } |
| 165 | return WEXITSTATUS(status); |
| 166 | } |
| 167 | |
Paul Lawrence | d0db337 | 2015-11-05 13:38:40 -0800 | [diff] [blame] | 168 | int format_volume(const char* volume, const char* directory) { |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 169 | Volume* v = volume_for_path(volume); |
| 170 | if (v == NULL) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 171 | LOG(ERROR) << "unknown volume \"" << volume << "\""; |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 172 | return -1; |
| 173 | } |
Doug Zongker | c18eeb8 | 2010-09-21 16:49:26 -0700 | [diff] [blame] | 174 | if (strcmp(v->fs_type, "ramdisk") == 0) { |
| 175 | // you can't format the ramdisk. |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 176 | LOG(ERROR) << "can't format_volume \"" << volume << "\""; |
Doug Zongker | c18eeb8 | 2010-09-21 16:49:26 -0700 | [diff] [blame] | 177 | return -1; |
| 178 | } |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 179 | if (strcmp(v->mount_point, volume) != 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 180 | LOG(ERROR) << "can't give path \"" << volume << "\" to format_volume"; |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 181 | return -1; |
| 182 | } |
| 183 | |
| 184 | if (ensure_path_unmounted(volume) != 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 185 | LOG(ERROR) << "format_volume failed to unmount \"" << v->mount_point << "\""; |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 186 | return -1; |
| 187 | } |
| 188 | |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 189 | if (strcmp(v->fs_type, "ext4") == 0 || strcmp(v->fs_type, "f2fs") == 0) { |
Doug Zongker | f39989a | 2013-12-11 15:40:28 -0800 | [diff] [blame] | 190 | // if there's a key_loc that looks like a path, it should be a |
| 191 | // block device for storing encryption metadata. wipe it too. |
| 192 | if (v->key_loc != NULL && v->key_loc[0] == '/') { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 193 | LOG(INFO) << "wiping " << v->key_loc; |
Doug Zongker | f39989a | 2013-12-11 15:40:28 -0800 | [diff] [blame] | 194 | int fd = open(v->key_loc, O_WRONLY | O_CREAT, 0644); |
| 195 | if (fd < 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 196 | LOG(ERROR) << "format_volume: failed to open " << v->key_loc; |
Doug Zongker | f39989a | 2013-12-11 15:40:28 -0800 | [diff] [blame] | 197 | return -1; |
| 198 | } |
| 199 | wipe_block_device(fd, get_file_size(fd)); |
| 200 | close(fd); |
| 201 | } |
| 202 | |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 203 | ssize_t length = 0; |
| 204 | if (v->length != 0) { |
| 205 | length = v->length; |
| 206 | } else if (v->key_loc != NULL && strcmp(v->key_loc, "footer") == 0) { |
| 207 | length = -CRYPT_FOOTER_OFFSET; |
| 208 | } |
| 209 | int result; |
| 210 | if (strcmp(v->fs_type, "ext4") == 0) { |
Jin Qian | ded2dac | 2017-04-21 14:36:12 -0700 | [diff] [blame] | 211 | static constexpr int block_size = 4096; |
| 212 | int raid_stride = v->logical_blk_size / block_size; |
| 213 | int raid_stripe_width = v->erase_blk_size / block_size; |
| 214 | |
| 215 | // stride should be the max of 8kb and logical block size |
| 216 | if (v->logical_blk_size != 0 && v->logical_blk_size < 8192) { |
| 217 | raid_stride = 8192 / block_size; |
| 218 | } |
| 219 | |
| 220 | const char* mke2fs_argv[] = { "/sbin/mke2fs_static", |
| 221 | "-F", |
| 222 | "-t", |
| 223 | "ext4", |
| 224 | "-b", |
| 225 | nullptr, |
| 226 | nullptr, |
| 227 | nullptr, |
| 228 | nullptr, |
| 229 | nullptr, |
| 230 | nullptr }; |
| 231 | |
| 232 | int i = 5; |
| 233 | std::string block_size_str = std::to_string(block_size); |
| 234 | mke2fs_argv[i++] = block_size_str.c_str(); |
| 235 | |
| 236 | std::string ext_args; |
| 237 | if (v->erase_blk_size != 0 && v->logical_blk_size != 0) { |
| 238 | ext_args = android::base::StringPrintf("stride=%d,stripe-width=%d", raid_stride, |
| 239 | raid_stripe_width); |
| 240 | mke2fs_argv[i++] = "-E"; |
| 241 | mke2fs_argv[i++] = ext_args.c_str(); |
| 242 | } |
| 243 | |
| 244 | mke2fs_argv[i++] = v->blk_device; |
| 245 | |
| 246 | std::string size_str = std::to_string(length / block_size); |
| 247 | if (length != 0) { |
| 248 | mke2fs_argv[i++] = size_str.c_str(); |
| 249 | } |
| 250 | |
| 251 | result = exec_cmd(mke2fs_argv[0], const_cast<char**>(mke2fs_argv)); |
| 252 | if (result == 0 && directory != nullptr) { |
| 253 | const char* e2fsdroid_argv[] = { "/sbin/e2fsdroid_static", |
| 254 | "-e", |
Jin Qian | ded2dac | 2017-04-21 14:36:12 -0700 | [diff] [blame] | 255 | "-f", |
| 256 | directory, |
| 257 | "-a", |
| 258 | volume, |
| 259 | v->blk_device, |
| 260 | nullptr }; |
| 261 | |
| 262 | result = exec_cmd(e2fsdroid_argv[0], const_cast<char**>(e2fsdroid_argv)); |
Tao Bao | 338be53 | 2017-07-11 16:45:04 -0700 | [diff] [blame] | 263 | } |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 264 | } else { /* Has to be f2fs because we checked earlier. */ |
| 265 | if (v->key_loc != NULL && strcmp(v->key_loc, "footer") == 0 && length < 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 266 | LOG(ERROR) << "format_volume: crypt footer + negative length (" << length |
| 267 | << ") not supported on " << v->fs_type; |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 268 | return -1; |
| 269 | } |
| 270 | if (length < 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 271 | LOG(ERROR) << "format_volume: negative length (" << length |
| 272 | << ") not supported on " << v->fs_type; |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 273 | return -1; |
| 274 | } |
Jin Qian | adeb41a | 2017-04-28 16:15:13 -0700 | [diff] [blame] | 275 | char *num_sectors = nullptr; |
| 276 | if (length >= 512 && asprintf(&num_sectors, "%zd", length / 512) <= 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 277 | LOG(ERROR) << "format_volume: failed to create " << v->fs_type |
| 278 | << " command for " << v->blk_device; |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 279 | return -1; |
| 280 | } |
| 281 | const char *f2fs_path = "/sbin/mkfs.f2fs"; |
Jin Qian | adeb41a | 2017-04-28 16:15:13 -0700 | [diff] [blame] | 282 | const char* const f2fs_argv[] = {"mkfs.f2fs", "-t", "-d1", v->blk_device, num_sectors, nullptr}; |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 283 | |
| 284 | result = exec_cmd(f2fs_path, (char* const*)f2fs_argv); |
| 285 | free(num_sectors); |
| 286 | } |
| 287 | if (result != 0) { |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 288 | PLOG(ERROR) << "format_volume: make " << v->fs_type << " failed on " << v->blk_device; |
JP Abgrall | 37aedb3 | 2014-06-16 19:07:39 -0700 | [diff] [blame] | 289 | return -1; |
| 290 | } |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 291 | return 0; |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 292 | } |
Doug Zongker | d4208f9 | 2010-09-20 12:16:13 -0700 | [diff] [blame] | 293 | |
Tianjie Xu | 7b0ad9c | 2016-08-05 18:00:04 -0700 | [diff] [blame] | 294 | LOG(ERROR) << "format_volume: fs_type \"" << v->fs_type << "\" unsupported"; |
The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 295 | return -1; |
| 296 | } |
Doug Zongker | 239ac6a | 2013-08-20 16:03:25 -0700 | [diff] [blame] | 297 | |
Paul Lawrence | d0db337 | 2015-11-05 13:38:40 -0800 | [diff] [blame] | 298 | int format_volume(const char* volume) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 299 | return format_volume(volume, nullptr); |
Paul Lawrence | d0db337 | 2015-11-05 13:38:40 -0800 | [diff] [blame] | 300 | } |
| 301 | |
Doug Zongker | 239ac6a | 2013-08-20 16:03:25 -0700 | [diff] [blame] | 302 | int setup_install_mounts() { |
Tao Bao | 57130c4 | 2017-05-10 12:11:21 -0700 | [diff] [blame] | 303 | if (fstab == nullptr) { |
| 304 | LOG(ERROR) << "can't set up install mounts: no fstab loaded"; |
| 305 | return -1; |
| 306 | } |
| 307 | for (int i = 0; i < fstab->num_entries; ++i) { |
| 308 | const Volume* v = fstab->recs + i; |
| 309 | |
| 310 | // We don't want to do anything with "/". |
| 311 | if (strcmp(v->mount_point, "/") == 0) { |
| 312 | continue; |
| 313 | } |
| 314 | |
| 315 | if (strcmp(v->mount_point, "/tmp") == 0 || strcmp(v->mount_point, "/cache") == 0) { |
| 316 | if (ensure_path_mounted(v->mount_point) != 0) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 317 | LOG(ERROR) << "Failed to mount " << v->mount_point; |
Doug Zongker | 239ac6a | 2013-08-20 16:03:25 -0700 | [diff] [blame] | 318 | return -1; |
Tao Bao | 57130c4 | 2017-05-10 12:11:21 -0700 | [diff] [blame] | 319 | } |
| 320 | } else { |
| 321 | if (ensure_path_unmounted(v->mount_point) != 0) { |
Tao Bao | bb10e58 | 2017-07-22 16:30:34 -0700 | [diff] [blame] | 322 | LOG(ERROR) << "Failed to unmount " << v->mount_point; |
Tao Bao | 57130c4 | 2017-05-10 12:11:21 -0700 | [diff] [blame] | 323 | return -1; |
| 324 | } |
Doug Zongker | 239ac6a | 2013-08-20 16:03:25 -0700 | [diff] [blame] | 325 | } |
Tao Bao | 57130c4 | 2017-05-10 12:11:21 -0700 | [diff] [blame] | 326 | } |
| 327 | return 0; |
Doug Zongker | 239ac6a | 2013-08-20 16:03:25 -0700 | [diff] [blame] | 328 | } |