A folder whose `statfs()` is pending blocks opening its sibling folders and its parent
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with filesystem_info_start() and start_or_stop_io() in libnemo-private/nemo-directory-async.c to see how the per-directory statfs query and the low-priority queue serialize siblings. Then read load_directory() in src/nemo-view.c where NEMO_FILE_ATTRIBUTE_FILESYSTEM_INFO is awaited for the folder and its loaded subfolders. Reproduce with the provided FUSE helper and confirm that only the slow folder waits while its sibling and parent open; no test file is named in the payload.
由索引模型根据 Issue 内容生成。
描述
Distribution
Linux Mint 22.3
Package version
6.6.3
Frequency
Always
Bug description
While the filesystem info query (statfs()) for one folder is pending, Nemo doesn't open that folder's siblings or its parent. When the query returns, all the pending windows appear at once. Folders elsewhere open normally in the meantime, and the UI stays responsive.
I ran into it with an rclone mount on my Desktop. After a network change its statfs() took 5 minutes to answer. For those 5 minutes the folders on the desktop wouldn't open, the mount among them, and a Nemo window wouldn't show the Desktop folder either. Then they all opened together.
Steps to reproduce
- Save this as
slowstatfs.c. It is an empty FUSE filesystem where onlystatfs()is slow:
slowstatfs.c
/* Empty FUSE filesystem where only statfs() is slow.
* gcc slowstatfs.c -o slowstatfs $(pkg-config fuse3 --cflags --libs)
* SLOW=120 ./slowstatfs <mountpoint>
*/
#define FUSE_USE_VERSION 31
#include <fuse.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
static int slow_getattr(const char *path, struct stat *st, struct fuse_file_info *fi)
{
if (strcmp(path, "/") != 0)
return -ENOENT;
memset(st, 0, sizeof *st);
st->st_mode = S_IFDIR | 0755;
st->st_nlink = 2;
return 0;
}
static int slow_readdir(const char *path, void *buf, fuse_fill_dir_t fill, off_t off,
struct fuse_file_info *fi, enum fuse_readdir_flags flags)
{
fill(buf, ".", NULL, 0, 0);
fill(buf, "..", NULL, 0, 0);
return 0;
}
static int slow_statfs(const char *path, struct statvfs *st)
{
sleep(atoi(getenv("SLOW") ? getenv("SLOW") : "120"));
memset(st, 0, sizeof *st);
st->f_bsize = st->f_frsize = 4096;
st->f_namemax = 255;
return 0;
}
static const struct fuse_operations ops = {
.getattr = slow_getattr,
.readdir = slow_readdir,
.statfs = slow_statfs,
};
int main(int argc, char *argv[])
{
return fuse_main(argc, argv, &ops, NULL);
}
- Build and mount it (needs
libfuse3-dev):
gcc slowstatfs.c -o slowstatfs $(pkg-config fuse3 --cflags --libs)
mkdir -p ~/statfs-test/slow ~/statfs-test/a ~/other-test
SLOW=60 ./slowstatfs ~/statfs-test/slow
- Open the folders, a few seconds apart:
nemo ~/statfs-test/slow & # no window
nemo ~/statfs-test/a & # sibling: no window
nemo ~/statfs-test & # parent: no window
nemo ~/other-test & # unrelated folder: opens right away
About 60 s after the first command, the three missing windows appear at once. ls -la ~/statfs-test and stat ~/statfs-test/slow are instant the whole time.
- Unmount with
fusermount3 -uz ~/statfs-test/slow.
Expected behavior
Only the folder whose query is pending should have to wait. Its siblings and its parent should open normally.
Additional information
Time after the first command at which each window appeared, in seconds. The commands were run at 0, 5, 8 and 11 s. Both versions were built from source on Ubuntu 24.04, master at 7df652f:
| Command | 6.6.3 | master |
|---|---|---|
nemo ~/statfs-test/slow (0 s) |
62.5 | 60.7 |
nemo ~/statfs-test/a (5 s) |
62.5 | 60.7 |
nemo ~/statfs-test (8 s) |
62.5 | 60.7 |
nemo ~/other-test (11 s) |
11.4 | 11.2 |
While it waits, Nemo has one thread inside statfs() and its main thread is idle in poll(). strace -f -tt -e trace=statfs on 6.6.3 shows that the sibling's query isn't sent until the slow one returns, and that the parent's own query is answered at once (other calls omitted, PID column dropped, paths shortened, results elided):
06:36:10.081962 statfs("~/statfs-test/slow", <unfinished ...>
06:36:15.872210 statfs("~/statfs-test", {...}) = 0
06:37:10.082529 <... statfs resumed>{...}) = 0
06:37:10.085034 statfs("~/statfs-test/a", {...}) = 0
Two things in the code seem to combine:
filesystem_info_start()runs one query per directory at a time, and while one is pendingstart_or_stop_io()stops at the first file in the low priority queue. That holds back the sibling, whose query goes through the queue of the same parent directory.load_directory()waits forNEMO_FILE_ATTRIBUTE_FILESYSTEM_INFOon the folder and on the subfolders Nemo already has loaded in it before the view finishes loading. That holds back the parent: if I drop that attribute from thenemo_directory_call_when_ready()call, the parent opens right away while the sibling still waits.
This is a different path from the sidebar's synchronous disk space queries behind #3764, which froze the whole window and were removed in a7c6f70893cbf81b5b7ce667a2da185f3618245f. Here the UI keeps working, and master, which has that commit, behaves the same as 6.6.3.
- 主要语言
- C
- 星标
- 1.6k
- 派生
- 387
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 4
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
linuxmint/nemo 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
Copy dialog: Enter key accidentally cancels file copy可能已有人在做 @jackjusko 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
linuxmint/nemo#3838 · 1 条评论 · 2 个 reaction ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
linuxmint/nemo#3805 · 2 条评论 · 1 个 reaction ·
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
389ds/389-ds-base#8152 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
isolation2 lockmodes fails on cassert builds: extra AccessShareLock on partition root可能已有人在做 @tuhaihe 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
apache/cloudberry#2356 ·
维护者通常 2 天内回复
-
难度 1/5 1 小时以内 新手友好度 86/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100