diff options
author | Jan Kara <jack@suse.cz> | 2023-01-25 17:56:06 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2023-01-26 16:46:37 +0100 |
commit | c2efd13a2ed4f29bf9ef14ac2fbb7474084655f8 (patch) | |
tree | 707e9cf056470b44ff8f10434effaa0f253c50d7 /fs/udf/super.c | |
parent | f386c802a6fda8f9fe4a5cf418c49aa84dfc52e4 (diff) | |
download | lwn-c2efd13a2ed4f29bf9ef14ac2fbb7474084655f8.tar.gz lwn-c2efd13a2ed4f29bf9ef14ac2fbb7474084655f8.zip |
udf: Limit file size to 4TB
UDF disk format supports in principle file sizes up to 1<<64-1. However
the file space (including holes) is described by a linked list of
extents, each of which can have at most 1GB. Thus the creation and
handling of extents gets unusably slow beyond certain point. Limit the
file size to 4TB to avoid locking up the kernel too easily.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index df5287c5d659..6304e3c5c3d9 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -86,6 +86,13 @@ enum { #define UDF_MAX_LVID_NESTING 1000 enum { UDF_MAX_LINKS = 0xffff }; +/* + * We limit filesize to 4TB. This is arbitrary as the on-disk format supports + * more but because the file space is described by a linked list of extents, + * each of which can have at most 1GB, the creation and handling of extents + * gets unusably slow beyond certain point... + */ +#define UDF_MAX_FILESIZE (1ULL << 42) /* These are the "meat" - everything else is stuffing */ static int udf_fill_super(struct super_block *, void *, int); @@ -2257,7 +2264,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ret = -ENOMEM; goto error_out; } - sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_maxbytes = UDF_MAX_FILESIZE; sb->s_max_links = UDF_MAX_LINKS; return 0; |