summaryrefslogtreecommitdiffstats
path: root/fs_mgr/fs_mgr.cpp
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2019-01-16 16:28:21 -0800
committerDaniel Rosenberg <drosen@google.com>2019-01-16 17:24:50 -0800
commit5620c6ce0c6842795631ea7ec95aba5426e7c01c (patch)
tree7c846a8cf18011e1346a9420b2569995e0d56367 /fs_mgr/fs_mgr.cpp
parent97212d36dae1a09a31194d4152e6b42daceeb109 (diff)
downloadsystem_core-5620c6ce0c6842795631ea7ec95aba5426e7c01c.tar.gz
system_core-5620c6ce0c6842795631ea7ec95aba5426e7c01c.tar.bz2
system_core-5620c6ce0c6842795631ea7ec95aba5426e7c01c.zip
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
Diffstat (limited to 'fs_mgr/fs_mgr.cpp')
-rw-r--r--fs_mgr/fs_mgr.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp
index 943fe109c..d25df77ae 100644
--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -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) {