All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: Alexander Viro <viro@math.psu.edu>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	"David S. Miller" <davem@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ext2 largefile fixes + [f]truncate() error value fix
Date: Sat, 18 Nov 2000 19:40:58 +0100	[thread overview]
Message-ID: <20001118194058.C24555@athlon.random> (raw)
In-Reply-To: <Pine.GSO.4.21.0011180503110.19917-100000@weyl.math.psu.edu>
In-Reply-To: <Pine.GSO.4.21.0011180503110.19917-100000@weyl.math.psu.edu>; from viro@math.psu.edu on Sat, Nov 18, 2000 at 05:28:46AM -0500

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/

  parent reply	other threads:[~2000-11-18 19:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-18 10:28 [PATCH] ext2 largefile fixes + [f]truncate() error value fix Alexander Viro
2000-11-18 15:46 ` Andreas Dilger
2000-11-18 22:08   ` Alexander Viro
2000-11-18 18:40 ` Andrea Arcangeli [this message]
2000-11-18 21:55   ` Alexander Viro
2000-11-19  0:33     ` Andrea Arcangeli
2000-11-19  0:46       ` Alexander Viro
2000-11-19  1:01         ` Alan Cox
2000-11-19  1:33           ` Alexander Viro
2000-11-19  1:39             ` Alexander Viro
2000-11-19  1:08         ` Andrea Arcangeli
2000-11-19  1:42           ` Alexander Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20001118194058.C24555@athlon.random \
    --to=andrea@suse.de \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.