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


Groups > linux.kernel > #1636511 > unrolled thread

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

Started byLuis Henriques <lhenriques@suse.com>
First post2017-05-05 19:40 +0200
Last post2017-05-08 04:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromLuis Henriques <lhenriques@suse.com>
Date2017-05-05 19:40 +0200
Subject[PATCH] ceph: Check that the new inode size is within limits in ceph_fallocate()
Message-ID<tDPmV-4Oe-3@gated-at.bofh.it>
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;

[toc] | [next] | [standalone]


#1637189

From"Yan, Zheng" <ukernel@gmail.com>
Date2017-05-08 04:20 +0200
Message-ID<tEGrf-64W-3@gated-at.bofh.it>
In reply to#1636511
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web