From patchwork Thu Jul 21 06:49:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 9240979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FB9B6077C for ; Thu, 21 Jul 2016 06:49:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53A0F26253 for ; Thu, 21 Jul 2016 06:49:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 494FA27BFC; Thu, 21 Jul 2016 06:49:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE8CD26253 for ; Thu, 21 Jul 2016 06:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbcGUGt3 (ORCPT ); Thu, 21 Jul 2016 02:49:29 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:34815 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751463AbcGUGt2 (ORCPT ); Thu, 21 Jul 2016 02:49:28 -0400 Received: by mail-pf0-f181.google.com with SMTP id p64so27292250pfb.1 for ; Wed, 20 Jul 2016 23:49:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HpHQil8VbuWyWUt40EHE5Ft2E2m+tozqZ3L1R11X/gY=; b=XBDsxBUO2lp3uEZn+mWd4ODQ+g3NMPkJT9KMsCGzfgOEY1QJbOUKcTFoMgnCceotAC jfO+spRGuZFtpQpEW6s+va+sqlPbCzplwXMF4G6oDJkdrmlmmemiTbfGdKmwKXYYx0vp yiAll40MnvoA9QkHAF1RTcqmsgVTPinmA9UvjzA+fc+SPq+ns7NNfa3MdpWWm3idA+eZ nVY531E+T3Oqwc1UkXz+p+wSFUJj95TsjAAPezhCbq/qBdld5P3rmc9wjDHC8IGtD0BR 1PZi5fzpHYzuUvRTRAsEEyumtTSVz8r44zZFNKEw5QkmXf87SROqW+OALQQFP9y4sPvM ILKg== X-Gm-Message-State: ALyK8tJFQ9CyM9EAdjWaFIucP45IhNUrFOCzrcuyHuMFoas/m0y20tWzBP1Rsy3ibYMrCGE1 X-Received: by 10.98.57.151 with SMTP id u23mr70758768pfj.4.1469083767023; Wed, 20 Jul 2016 23:49:27 -0700 (PDT) Received: from octopus.ceph.octopus.net ([117.202.96.145]) by smtp.gmail.com with ESMTPSA id n9sm8516952paz.13.2016.07.20.23.49.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jul 2016 23:49:26 -0700 (PDT) From: Venky Shankar To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com Subject: [RFC 2/2] ceph: do not return virtual xattrs in listxattr() Date: Thu, 21 Jul 2016 12:19:18 +0530 Message-Id: <1469083758-2153-2-git-send-email-vshankar@redhat.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1469083758-2153-1-git-send-email-vshankar@redhat.com> References: <1469083758-2153-1-git-send-email-vshankar@redhat.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Venky Shankar --- fs/ceph/xattr.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index d0f59cb..3b227aa 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -848,12 +848,8 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) { struct inode *inode = d_inode(dentry); struct ceph_inode_info *ci = ceph_inode(inode); - struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode); - u32 vir_namelen = 0; u32 namelen; int err; - u32 len; - int i; spin_lock(&ci->i_ceph_lock); dout("listxattr %p ver=%lld index_ver=%lld\n", inode, @@ -871,38 +867,19 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size) err = __build_xattrs(inode); if (err < 0) goto out; - /* - * Start with virtual dir xattr names (if any) (including - * terminating '\0' characters for each). - */ - vir_namelen = ceph_vxattrs_name_size(vxattrs); /* adding 1 byte per each variable due to the null termination */ namelen = ci->i_xattrs.names_size + ci->i_xattrs.count; err = -ERANGE; - if (size && vir_namelen + namelen > size) + if (size && namelen > size) goto out; - err = namelen + vir_namelen; + err = namelen; if (size == 0) goto out; names = __copy_xattr_names(ci, names); - /* virtual xattr names, too */ - err = namelen; - if (vxattrs) { - for (i = 0; vxattrs[i].name; i++) { - if (!vxattrs[i].hidden && - !(vxattrs[i].exists_cb && - !vxattrs[i].exists_cb(ci))) { - len = sprintf(names, "%s", vxattrs[i].name); - names += len + 1; - err += len + 1; - } - } - } - out: spin_unlock(&ci->i_ceph_lock); return err;