LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Yanhu Cao <gmayyyha@gmail.com>
To: Luis Henriques <lhenriques@suse.com>
Cc: jlayton@kernel.org, sage@redhat.com, idryomov@gmail.com,
	ceph-devel <ceph-devel@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ceph: check set quota operation support before syncing setxattr.
Date: Thu, 5 Dec 2019 10:42:46 +0800
Message-ID: <CAB9OAC2vzPy=ELYzDRjBvA6m8T8AvwdJugS2NoCczwD1+Xb36Q@mail.gmail.com> (raw)
In-Reply-To: <20191204103629.GA22244@hermes.olymp>

On Wed, Dec 4, 2019 at 6:36 PM Luis Henriques <lhenriques@suse.com> wrote:
>
> On Wed, Dec 04, 2019 at 11:10:05AM +0800, Yanhu Cao wrote:
> > Environment
> > -----------
> > ceph version: 12.2.*
> > kernel version: 4.19+
> >
> > setfattr quota operation actually sends op to MDS, and settings
> > effective. but kclient outputs 'Operation not supported'. This may confuse
> > users' understandings.
>
> What exactly do you mean by "settings effective"?  There have been
> changes in the way CephFS quotas work in mimic and, if you're using a
> Luminous cluster (12.2.*) the kernel client effectively does *not*
> support quotas -- you'll be able to exceed the quotas you've tried to
> set because the client won't be checking the limits.  Thus, -EOPNOTSUPP
> seems appropriate for this scenario.
>
> I guess that the confusing part is that the xattr is actually set in
> that case, but the kernel client won't be able to use it to validate
> quotas in the filesystem tree because realms won't be created.
>
Yes. we use kcephfs+nfs for CentOS6.*, it does not support ceph-fuse(12.2.*).
The operating system of other applications is CentOS7.*, which uses
ceph-fuse and can get quota settings set by kclient.

Thanks.
BRs

> Cheers,
> --
> Luís
> >
> > If the kernel version and ceph version are not compatible, should check
> > quota operations are supported first, then do sync_setxattr.
> >
> > reference: https://docs.ceph.com/docs/master/cephfs/quota/
> >
> > Signed-off-by: Yanhu Cao <gmayyyha@gmail.com>
> > ---
> >  fs/ceph/xattr.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> > index cb18ee637cb7..189aace75186 100644
> > --- a/fs/ceph/xattr.c
> > +++ b/fs/ceph/xattr.c
> > @@ -1132,8 +1132,8 @@ int __ceph_setxattr(struct inode *inode, const char *name,
> >                                   "during filling trace\n", inode);
> >               err = -EBUSY;
> >       } else {
> > -             err = ceph_sync_setxattr(inode, name, value, size, flags);
> > -             if (err >= 0 && check_realm) {
> > +             err = 0;
> > +             if (check_realm) {
> >                       /* check if snaprealm was created for quota inode */
> >                       spin_lock(&ci->i_ceph_lock);
> >                       if ((ci->i_max_files || ci->i_max_bytes) &&
> > @@ -1142,6 +1142,8 @@ int __ceph_setxattr(struct inode *inode, const char *name,
> >                               err = -EOPNOTSUPP;
> >                       spin_unlock(&ci->i_ceph_lock);
> >               }
> > +             if (err == 0)
> > +                     err = ceph_sync_setxattr(inode, name, value, size, flags);
> >       }
> >  out:
> >       ceph_free_cap_flush(prealloc_cf);
> > --
> > 2.21.0 (Apple Git-122.2)
> >

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04  3:10 Yanhu Cao
2019-12-04 10:36 ` Luis Henriques
2019-12-05  2:42   ` Yanhu Cao [this message]
2019-12-05 10:24     ` Luis Henriques

Reply instructions:

You may reply publically 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='CAB9OAC2vzPy=ELYzDRjBvA6m8T8AvwdJugS2NoCczwD1+Xb36Q@mail.gmail.com' \
    --to=gmayyyha@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=lhenriques@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@redhat.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git