Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1637189

Re: [PATCH] ceph: Check that the new inode size is within limits in ceph_fallocate()

Path csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod
From "Yan, Zheng" <ukernel@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ceph: Check that the new inode size is within limits in ceph_fallocate()
Date Mon, 08 May 2017 04:20:01 +0200
Message-ID <tEGrf-64W-3@gated-at.bofh.it> (permalink)
References <tDPmV-4Oe-3@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GtvRdlTgYP+OZzJKk0oADduCAVaKJy2ovYcOCK6N9g4=; b=hvpbTH0x/W6pcJ2OmO8rFG618MQpKAXsWHsgko2PkM2x+82WOIzadiwtYyZMQfATGk xf4BUe5VWXvS8wAVWFUNiinFz+EmYNxE/KLZrp1lkzG1KvPBD5ItrNkinE/pLSv3WTgY B4TxZK0DPdNifddvnfTuh1D5mmusN1yxFB1R0Nqc92aEhhJ+ybJOIcLNoXc2inpYIREk 2JZ5CYfrpyN6WL4OBBm8MHIwNBP88kGJtxDMSP4NjEHuEtettRgbJhpU3vOay79powl5 XPMF+xkuj7Fb3Ig9yvSse3YuGRuA60uSQ6GxFSFQ0gL/x6RifCMeBTzeT81M0UPpBqPP 8vhA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GtvRdlTgYP+OZzJKk0oADduCAVaKJy2ovYcOCK6N9g4=; b=Dhz9yCfe692Sa4Eafi4Pwtj1kngsdqGi+vvSNoXdrYnmpEEr7TGYr2EETccr2A4uMk QtCC+hUSfDrSc/v+axuuHRgXm7qFOsLM3ousiIqGOAM/t7BWtLwO7qUIIjok7FMBod7Z bY/oP955AX+/V6REYJxkVlONcZRziSX8YhQVhczFW/9q3vmlzdmeXEikWE4eaTpZKjCG qggAigDy5jVga7JvuA0874I02VYWDiE9xjwm1bNHGnqXpAudKObh6Muyqh7ShkWczaFw oMBl6mxNyJA1Ggemz4BQE7AOIaknURTUhUXfDwVigaAZrzAOFFjm2xUJh/IDXwSikEik 4n/Q==
X-Gm-Message-State AN3rC/6Z/YsYypsLS2AAAmj79INpz3wt2mUOCEso26ncQvIUJRHC1W3p lbQsW0flUdqQjOnVlt3spxXVnWc8fQ==
X-Received by 10.31.210.1 with SMTP id j1mr9571707vkg.150.1494209499594; Sun, 07 May 2017 19:11:39 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 38
Organization linux.* mail to news gateway
X-Original-Cc "Yan, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>, Ilya Dryomov <idryomov@gmail.com>, ceph-devel <ceph-devel@vger.kernel.org>, linux-kernel@vger.kernel.org
X-Original-Date Mon, 8 May 2017 10:11:38 +0800
X-Original-Message-ID <CAAM7YA=2KT6wpD-u6mftYPaanz63uWNbwrBoPCAso_QzDrkVpQ@mail.gmail.com>
X-Original-References <20170505172844.18374-1-lhenriques@suse.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1637189

Show key headers only | View raw


On Sat, May 6, 2017 at 1:28 AM, Luis Henriques <lhenriques@suse.com> wrote:
> Currently the ceph client doesn't respect the rlimit in fallocate.  This
> means that a user can allocate a file with size > RLIMIT_FSIZE.  This
> patch adds the call to inode_newsize_ok() to verify filesystem limits and
> ulimits.  This should make ceph successfully run xfstest generic/228.
>
> Signed-off-by: Luis Henriques <lhenriques@suse.com>
> ---
>  fs/ceph/file.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 26cc95421cca..bc5809d4d2d4 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -1636,8 +1636,12 @@ static long ceph_fallocate(struct file *file, int mode,
>         }
>
>         size = i_size_read(inode);
> -       if (!(mode & FALLOC_FL_KEEP_SIZE))
> +       if (!(mode & FALLOC_FL_KEEP_SIZE)) {
>                 endoff = offset + length;
> +               ret = inode_newsize_ok(inode, endoff);
> +               if (ret)
> +                       goto unlock;
> +       }
>
>         if (fi->fmode & CEPH_FILE_MODE_LAZY)
>                 want = CEPH_CAP_FILE_BUFFER | CEPH_CAP_FILE_LAZYIO;
> --

Applied, thanks

Yan, Zheng

> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] ceph: Check that the new inode size is within limits in ceph_fallocate() Luis Henriques <lhenriques@suse.com> - 2017-05-05 19:40 +0200
  Re: [PATCH] ceph: Check that the new inode size is within limits in ceph_fallocate() "Yan, Zheng" <ukernel@gmail.com> - 2017-05-08 04:20 +0200

csiph-web