linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yan, Zheng" <ukernel@gmail.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: Sage Weil <sage@inktank.com>,
	ceph-devel <ceph-devel@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ceph: remove redundant code for max file size verification
Date: Thu, 18 Sep 2014 09:11:26 +0800	[thread overview]
Message-ID: <CAAM7YAkZun780YD+mqieuNj2uF6-oBo=ohg0GkdapJehwxDnBw@mail.gmail.com> (raw)
In-Reply-To: <00fd01cfd259$81ef7530$85ce5f90$@samsung.com>

On Wed, Sep 17, 2014 at 5:26 PM, Chao Yu <chao2.yu@samsung.com> wrote:
> Both ceph_update_writeable_page and ceph_setattr will verify file size
> with max size ceph supported.
> There are two caller for ceph_update_writeable_page, ceph_write_begin and
> ceph_page_mkwrite. For ceph_write_begin, we have already verified the size in
> generic_write_checks of ceph_write_iter; for ceph_page_mkwrite, we have no
> chance to change file size when mmap. Likewise we have already verified the size
> in inode_change_ok when we call ceph_setattr.
> So let's remove the redundant code for max file size verification.
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
>  fs/ceph/addr.c  | 9 ---------
>  fs/ceph/inode.c | 6 ------
>  2 files changed, 15 deletions(-)
>
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 90b3954..18c06bb 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1076,12 +1076,6 @@ retry_locked:
>         /* past end of file? */
>         i_size = inode->i_size;   /* caller holds i_mutex */
>
> -       if (i_size + len > inode->i_sb->s_maxbytes) {
> -               /* file is too big */
> -               r = -EINVAL;
> -               goto fail;
> -       }
> -
>         if (page_off >= i_size ||
>             (pos_in_page == 0 && (pos+len) >= i_size &&
>              end_in_page - pos_in_page != PAGE_CACHE_SIZE)) {
> @@ -1099,9 +1093,6 @@ retry_locked:
>         if (r < 0)
>                 goto fail_nosnap;
>         goto retry_locked;
> -
> -fail:
> -       up_read(&mdsc->snap_rwsem);
>  fail_nosnap:
>         unlock_page(page);
>         return r;
> diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
> index 04c89c2..25c242e 100644
> --- a/fs/ceph/inode.c
> +++ b/fs/ceph/inode.c
> @@ -1813,10 +1813,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
>         if (ia_valid & ATTR_SIZE) {
>                 dout("setattr %p size %lld -> %lld\n", inode,
>                      inode->i_size, attr->ia_size);
> -               if (attr->ia_size > inode->i_sb->s_maxbytes) {
> -                       err = -EINVAL;
> -                       goto out;
> -               }
>                 if ((issued & CEPH_CAP_FILE_EXCL) &&
>                     attr->ia_size > inode->i_size) {
>                         inode->i_size = attr->ia_size;
> @@ -1896,8 +1892,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
>         if (mask & CEPH_SETATTR_SIZE)
>                 __ceph_do_pending_vmtruncate(inode);
>         return err;
> -out:
> -       spin_unlock(&ci->i_ceph_lock);
>  out_put:
>         ceph_mdsc_put_request(req);
>         return err;
> --
> 2.0.1.474.g72c7794
>
>

Reviewed-by: Yan, Zheng <zyan@redhat.com>

I added  this to testing branch of client-client.

Thanks
Yan, Zheng


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

      reply	other threads:[~2014-09-18  1:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17  9:26 [PATCH] ceph: remove redundant code for max file size verification Chao Yu
2014-09-18  1:11 ` Yan, Zheng [this message]

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='CAAM7YAkZun780YD+mqieuNj2uF6-oBo=ohg0GkdapJehwxDnBw@mail.gmail.com' \
    --to=ukernel@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=chao2.yu@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@inktank.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).