Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1171667ybl; Wed, 4 Dec 2019 18:44:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzrukQDLOaDVC8SqMLnsBTDGs13wnLeFPtLqJszOXbsgKwLTpzc697W28p6XrTksEKUGzBh X-Received: by 2002:a9d:1d07:: with SMTP id m7mr5107015otm.261.1575513890937; Wed, 04 Dec 2019 18:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575513890; cv=none; d=google.com; s=arc-20160816; b=vVjO57jbZ51BbvuP1d1WX06zD1+QQ0u+mX2VFj6+e8c/1lHn3Jno9hm88B1+V9rP4R nKlaJ0lGQUd3p9mHXp//JCuXhKK1U2bJG+sJPjcjEXsZgGv1QX/2CXjNP7qYUEWvcxwD +7Khh/pzWgs6p55hjg+dZcD8y739anl6cMSa/N/xzm6LyZvEpfZSfHHdOGV4bLuro6t6 X/f5+p9xmVf8TMWTqu84daLisFBWGBgtfcfvJ4qNsSGsL5FZQeqNsfFRBu7M8FTwIwm5 a5w2fZuktC2FOcHeTJQfbKrmsv6r2G4vRfC6c9LzF/CX/AjxpcVvbS6ayrNN6e7m5LXQ swCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vSYXq7k3D7T0dUleEUNaJBpJRJeTNo0CbEMieQSFYHs=; b=c1C2jEYNN0xWkImiTUjWaVyYGL2r+4Pl1xOdasmjc5cBFFO5Rov8Za6+gmYBR8eSt9 A3MuqgUgy+/sHj1K5QyHrSEL8U6wLOWwRor0ovsPc8yTUP2JGwPsvM+N5ua2HwV/3ABe wQGkeX9SJY+P2DpJ3le1xwP2vREz14tYeUEgkxdH3Q5S2vZlClJJqIsbypnqeiEqkdbb xGfOZwXkBx9xEiuk8Ia04S2h3mMQzHh5ewgc16Oy4h2FseMCldTz/T7SFtUCbtDuJT/c OKV8wnJnMCB0ANHSI6EjS21qF/slIIxBYjQmqlIXqaqbUlXCD+seQveKaJNriac5FG8R jmog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OAlH3TSV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d22si4344968ote.229.2019.12.04.18.44.38; Wed, 04 Dec 2019 18:44:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OAlH3TSV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbfLECnA (ORCPT + 99 others); Wed, 4 Dec 2019 21:43:00 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:41663 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728548AbfLECm7 (ORCPT ); Wed, 4 Dec 2019 21:42:59 -0500 Received: by mail-io1-f68.google.com with SMTP id z26so1966955iot.8; Wed, 04 Dec 2019 18:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vSYXq7k3D7T0dUleEUNaJBpJRJeTNo0CbEMieQSFYHs=; b=OAlH3TSVK/Ihtm0+HajQjItGYfwrIRCBBjFV/Jq4zFcQ4UILqZZ9O01MdQdPHTO94K RXkSag1msFqS9qcpaCFw3tFi8LKwaRNbNzcCcP+txvSJTZUIZghbvmRKh0QCArK+6vjo aQfdJj+3mDALDsspWeWTX26ZUmvxuU06vQbRezXjJ6wTuQPy7Qvurfu+7xtgTI7lGVhV U5Ub0HJE67O8y9USyAtE2JrAxkf32WGOozmWkSLWsxOo+WiGUShQGn6xUrJFLTYafiZB 4Tt6Oiex20c6VWI9iZ5naBG3HddAx4DcJhCfwi37RXUs8pevPteod4qqWp9uuSipjM1D jsqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vSYXq7k3D7T0dUleEUNaJBpJRJeTNo0CbEMieQSFYHs=; b=dLylXVxn4mN+luOoEI69tsr9RqnmoshavUU772P17YU0i+2P7Ep8xcAk7EPhE04a9L Ziw4J9/YbNHG3V2+/KtCuxRMT/5Ge0KZlsoYSpVgv6Q6xpCAXm86VpQ5vMmXv0fy8bnc TRYLFTVebyX4+Qbqe+Ti5l5PHF6RhjLEpx4JIAgb4rDgxgrs8z43s7lVKFSBU1uG1oDz ImlZgp7j80KkIh+gXDDE4zIawlt7sux/OxqEAQddejr8+o2y39SWB05aUC8eWD3XH5nJ VVBb8b8ttiMMbus6ShE8KKaDj8oJmfFXg6jcMEt7AeKoZbkqvFRVoa5GDCaiXH1U6ggO IOvQ== X-Gm-Message-State: APjAAAVkmi8IrVf/R+T+hu0zx3ztgr0/htm/Vf6yCH/pIRf6MFjrjL6D b3zM4zi2VZHr7El1TTov77DOwXfn7Luuzy/vRbw= X-Received: by 2002:a6b:ab07:: with SMTP id u7mr4543829ioe.27.1575513778857; Wed, 04 Dec 2019 18:42:58 -0800 (PST) MIME-Version: 1.0 References: <20191204031005.2638-1-gmayyyha@gmail.com> <20191204103629.GA22244@hermes.olymp> In-Reply-To: <20191204103629.GA22244@hermes.olymp> From: Yanhu Cao Date: Thu, 5 Dec 2019 10:42:46 +0800 Message-ID: Subject: Re: [PATCH] ceph: check set quota operation support before syncing setxattr. To: Luis Henriques Cc: jlayton@kernel.org, sage@redhat.com, idryomov@gmail.com, ceph-devel , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 4, 2019 at 6:36 PM Luis Henriques 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 conf= use > > 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=C3=ADs > > > > 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 > > --- > > 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 ch= ar *name, > > "during filling trace\n", inode); > > err =3D -EBUSY; > > } else { > > - err =3D ceph_sync_setxattr(inode, name, value, size, flag= s); > > - if (err >=3D 0 && check_realm) { > > + err =3D 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 ch= ar *name, > > err =3D -EOPNOTSUPP; > > spin_unlock(&ci->i_ceph_lock); > > } > > + if (err =3D=3D 0) > > + err =3D ceph_sync_setxattr(inode, name, value, si= ze, flags); > > } > > out: > > ceph_free_cap_flush(prealloc_cf); > > -- > > 2.21.0 (Apple Git-122.2) > >