Skip to content

Commit d6bd1e7

Browse files
Al Virogregkh
authored andcommitted
ufs: set correct ->s_maxsize
commit 6b0d144fa758869bdd652c50aa41aaf601232550 upstream. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4c516df commit d6bd1e7

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

fs/ufs/super.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,23 @@ static void ufs_put_super(struct super_block *sb)
746746
return;
747747
}
748748

749+
static u64 ufs_max_bytes(struct super_block *sb)
750+
{
751+
struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
752+
int bits = uspi->s_apbshift;
753+
u64 res;
754+
755+
if (bits > 21)
756+
res = ~0ULL;
757+
else
758+
res = UFS_NDADDR + (1LL << bits) + (1LL << (2*bits)) +
759+
(1LL << (3*bits));
760+
761+
if (res >= (MAX_LFS_FILESIZE >> uspi->s_bshift))
762+
return MAX_LFS_FILESIZE;
763+
return res << uspi->s_bshift;
764+
}
765+
749766
static int ufs_fill_super(struct super_block *sb, void *data, int silent)
750767
{
751768
struct ufs_sb_info * sbi;
@@ -1212,6 +1229,7 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
12121229
"fast symlink size (%u)\n", uspi->s_maxsymlinklen);
12131230
uspi->s_maxsymlinklen = maxsymlen;
12141231
}
1232+
sb->s_maxbytes = ufs_max_bytes(sb);
12151233
sb->s_max_links = UFS_LINK_MAX;
12161234

12171235
inode = ufs_iget(sb, UFS_ROOTINO);

0 commit comments

Comments
 (0)