linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: set limit size
@ 2021-06-15  6:41 jzp0409
  2021-06-18  7:10 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: jzp0409 @ 2021-06-15  6:41 UTC (permalink / raw)
  To: miklos; +Cc: linux-fsdevel, edison.jiang

From: "edison.jiang" <jiangzhipeng@yulong.com>

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.

Signed-off-by: edison.jiang <jiangzhipeng@yulong.com>
---
 fs/fuse/inode.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index b0e18b4..f4e54505 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -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 */
 }
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fuse: set limit size
  2021-06-15  6:41 [PATCH] fuse: set limit size jzp0409
@ 2021-06-18  7:10 ` Miklos Szeredi
       [not found]   ` <3a47eade.6096.17a1e87d2f9.Coremail.jzp0409@163.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2021-06-18  7:10 UTC (permalink / raw)
  To: jzp0409; +Cc: linux-fsdevel, edison.jiang

On Tue, 15 Jun 2021 at 08:41, jzp0409 <jzp0409@163.com> wrote:
>
> From: "edison.jiang" <jiangzhipeng@yulong.com>
>
> 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.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] fuse: set limit size
       [not found]   ` <3a47eade.6096.17a1e87d2f9.Coremail.jzp0409@163.com>
@ 2021-06-18  9:55     ` Miklos Szeredi
  0 siblings, 0 replies; 3+ messages in thread
From: Miklos Szeredi @ 2021-06-18  9:55 UTC (permalink / raw)
  To: 蒋志鹏; +Cc: linux-fsdevel, edison.jiang

On Fri, 18 Jun 2021 at 11:51, 蒋志鹏 <jzp0409@163.com> wrote:
>
> At 2021-06-18 15:10:27, "Miklos Szeredi" <miklos@szeredi.hu> wrote:
>
> >On Tue, 15 Jun 2021 at 08:41, jzp0409 <jzp0409@163.com> wrote:
> >>
> >> From: "edison.jiang" <jiangzhipeng@yulong.com>
> >>
> >> 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.
> >
> >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
>
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-18  9:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15  6:41 [PATCH] fuse: set limit size jzp0409
2021-06-18  7:10 ` Miklos Szeredi
     [not found]   ` <3a47eade.6096.17a1e87d2f9.Coremail.jzp0409@163.com>
2021-06-18  9:55     ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).