Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5620c6ce authored by Daniel Rosenberg's avatar Daniel Rosenberg
Browse files

Retry mounts on -EAGAIN

F2fs may return -EAGAIN on mounting with checkpoint=disable. This
signals that the required garbage collection was taking a while, and
that more garbage collection is required, and will be resumed by
attempting to mount again.

Test: Start device with checkpointing set up with an f2fs userdata
      partition that is in need of heavy garbage collection.
      Mount should fail with EAGAIN and retry
Bug: 122917966

Change-Id: I83341f68e5cffa5f1bd569dfb2037ad5d3cbd7a3
parent 97212d36
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -556,9 +556,17 @@ static int __mount(const std::string& source, const std::string& target, const F
    mkdir(target.c_str(), 0755);
    errno = 0;
    unsigned long mountflags = entry.flags;
    int ret = mount(source.c_str(), target.c_str(), entry.fs_type.c_str(), mountflags,
    int ret = 0;
    int save_errno = 0;
    do {
        if (save_errno == EAGAIN) {
            PINFO << "Retrying mount (source=" << source << ",target=" << target
                  << ",type=" << entry.fs_type << ")=" << ret << "(" << save_errno << ")";
        }
        ret = mount(source.c_str(), target.c_str(), entry.fs_type.c_str(), mountflags,
                    entry.fs_options.c_str());
    int save_errno = errno;
        save_errno = errno;
    } while (ret && save_errno == EAGAIN);
    const char* target_missing = "";
    const char* source_missing = "";
    if (save_errno == ENOENT) {