Set s_maxbytes in superblock

By default it is

    s->s_maxbytes = MAX_NON_LFS;

that is to say `((1UL<<31) - 1)`. This tripped us in `sendfile`,
when the upper bound is set to `s_maxbytes`:

    if (!max)
        max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes);

See <https://elixir.bootlin.com/linux/v5.4.249/source/fs/read_write.c#L1443>
This commit is contained in:
Francesco Mazzoli
2023-09-30 11:55:46 +00:00
parent 59237ed673
commit 2dba467266

View File

@@ -341,6 +341,7 @@ static struct dentry* eggsfs_mount(struct file_system_type* fs_type, int flags,
sb->s_time_gran = 1;
sb->s_time_min = 0;
sb->s_time_max = U64_MAX/1000000000ull;
sb->s_maxbytes= MAX_LFS_FILESIZE;
struct inode* root = eggsfs_get_inode(sb, NULL, EGGSFS_ROOT_INODE);
if (IS_ERR(root)) { err = PTR_ERR(root); goto out_sb; }