Skip to contentSkip to conversation

fuse: set limit size

PATCH In review jzp0409 2 participants 3 messages Jun 15, 2021 – Jun 18, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

jzp0409

author
#0 lore raw

PATCH 1/1 fuse: set limit size

From: "edison.jiang" <[email protected]>

Android-R /sdcard mount FUSE filesystem type, use "dd" command to filli up /sdcard dir, Android will not boot normal,
becase this system need at least 128M userspace.

Test: open adb port,
adb shell "dd if=dev/zero of=sdcard/ae bs=1024000 count=xxx"

Result: if not limit size,Android system can not boot normal.

---
 fs/fuse/inode.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
fs/fuse/inode.c +15 -0
index b0e18b4..f4e54505 100644
@@ -477,6 +477,21 @@ static void convert_fuse_statfs(struct kstatfs *stbuf, struct fuse_kstatfs *attr
 	stbuf->f_files   = attr->files;
 	stbuf->f_ffree   = attr->ffree;
 	stbuf->f_namelen = attr->namelen;
+#ifdef LIMIT_SDCARD_SIZE
+	u32 data_free_size_th = 128*1024*1024;
+
+	stbuf->f_blocks -= (u32)data_free_size_th/attr->bsize;
+
+	if (stbuf->f_bfree < ((u32)data_free_size_th/attr->bsize))
+		stbuf->f_bfree = 0;
+	else
+		stbuf->f_bfree -= (u32)data_free_size_th/attr->bsize;
+
+	if (stbuf->f_bavail < ((u32)data_free_size_th/attr->bsize))
+		stbuf->f_bavail = 0;
+	else
+		stbuf->f_bavail -= (u32)data_free_size_th/attr->bsize;
+#endif
 	/* fsid is left zero */
 }
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 8 lines · On Tue, 15 Jun 2021 at 08:41, jzp0409 <[email protected]> wrote:

From: "edison.jiang" <[email protected]>

Android-R /sdcard mount FUSE filesystem type, use "dd" command to filli up /sdcard dir, Android will not boot normal,
becase this system need at least 128M userspace.

Quoted 4 lines

Test: open adb port,
adb shell "dd if=dev/zero of=sdcard/ae bs=1024000 count=xxx"

Result: if not limit size,Android system can not boot normal.

Without understanding the specifics, this does not look like a kernel issue at all.

Why can't the fuse server do the limiting?

Thanks,
Miklos

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#3 lore raw
Quoted 20 lines · 蒋志鹏
Quoted 17 lines · Miklos Szeredi
Quoted 8 lines · On Tue, 15 Jun 2021 at 08:41, jzp0409 <[email protected]> wrote:

From: "edison.jiang" <[email protected]>

Android-R /sdcard mount FUSE filesystem type, use "dd" command to filli up /sdcard dir, Android will not boot normal,
becase this system need at least 128M userspace.

Quoted 4 lines

Test: open adb port,
adb shell "dd if=dev/zero of=sdcard/ae bs=1024000 count=xxx"

Result: if not limit size,Android system can not boot normal.

Without understanding the specifics, this does not look like a kernel issue at all.

Quoted 7 lines
Quoted 4 lines

Why can't the fuse server do the limiting?

Thanks,
Miklos

Upstream nevert do the limiting,This leads to the problems I mentioned above。 That's why I want to solve it from kernel.

Upstream of what?

Thanks,
Miklos