Re: [PATCH] ext2 largefile fixes + [f]truncate() error value fix

From: Andrea Arcangeli (andrea@suse.de)
Date: Sat Nov 18 2000 - 13:40:58 EST


On Sat, Nov 18, 2000 at 05:28:46AM -0500, Alexander Viro wrote:
> + setattr: ext2_notify_change,

:)

> + if (iattr->ia_valid & ATTR_SIZE) {
> + if (iattr->ia_size > inode->i_sb->u.ext2_sb.s_max_size) {
> + retval = -EFBIG;
> + goto out;
> + }
> + }

That's not nearly enough, you should also resurrect all the stuff from
2.2.x, I'm wondering how this code disappeared from 2.4.x (actually the size <0
can't happen of course since the caller is trusted and the SIGXFSZ could
probably be moved to the VFS but the largefile is definitely an ext2 business):

        if (iattr->ia_valid & ATTR_SIZE) {
                loff_t size = iattr->ia_size;
                unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;

                if (size < 0)
                        return -EINVAL;
                if (size > ext2_max_sizes[EXT2_BLOCK_SIZE_BITS(inode->i_sb)])
                        return -EFBIG;
                if (limit != RLIM_INFINITY && size > limit) {
                        send_sig(SIGXFSZ, current, 0);
                        return -EFBIG;
                }

                if (size >> 33) {
                        struct super_block *sb = inode->i_sb;
                        struct ext2_super_block *es = sb->u.ext2_sb.s_es;
                        if (!(es->s_feature_ro_compat &
                              cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE))){
                                /* If this is the first large file
                                 * created, add a flag to the superblock */
                                es->s_feature_ro_compat |=
                                cpu_to_le32(EXT2_FEATURE_RO_COMPAT_LARGE_FILE);
                                mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1);
                        }
                }
        }

and btw the large file feature setting seems missing also from write(2) ext2
in 2.4.x, confirm?

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 21:00:16 EST