OSDN Git Service

Update primary symlinks after mounting.
authorJeff Sharkey <jsharkey@android.com>
Wed, 29 Apr 2015 22:22:23 +0000 (15:22 -0700)
committerJeff Sharkey <jsharkey@android.com>
Thu, 30 Apr 2015 00:22:22 +0000 (17:22 -0700)
Since otherwise we might have a stale path.

Bug: 19993667
Change-Id: I099e3dc0c5aa9ab6820cded4f2ae7fd6bf18ea40

CommandListener.cpp
VolumeManager.cpp

index 5021fb1..ec3739c 100644 (file)
@@ -199,14 +199,14 @@ int CommandListener::VolumeCmd::runCommand(SocketClient *cli,
         int mountFlags = (argc > 3) ? atoi(argv[3]) : 0;
         userid_t mountUserId = (argc > 4) ? atoi(argv[4]) : -1;
 
-        if (mountFlags & android::vold::VolumeBase::MountFlags::kPrimary) {
-            vm->setPrimary(vol);
-        }
-
         vol->setMountFlags(mountFlags);
         vol->setMountUserId(mountUserId);
 
-        return sendGenericOkFail(cli, vol->mount());
+        int res = vol->mount();
+        if (mountFlags & android::vold::VolumeBase::MountFlags::kPrimary) {
+            vm->setPrimary(vol);
+        }
+        return sendGenericOkFail(cli, res);
 
     } else if (cmd == "unmount" && argc > 2) {
         // unmount [volId]
index 5c4f9af..8f73e63 100755 (executable)
@@ -379,6 +379,7 @@ int VolumeManager::linkPrimary(userid_t userId) {
             SLOGW("Failed to unlink %s: %s", target.c_str(), strerror(errno));
         }
     }
+    LOG(DEBUG) << "Linking " << source << " to " << target;
     if (TEMP_FAILURE_RETRY(symlink(source.c_str(), target.c_str()))) {
         SLOGW("Failed to link %s to %s: %s", source.c_str(), target.c_str(),
                 strerror(errno));