From patchwork Thu Jul 21 12:17:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venky Shankar X-Patchwork-Id: 9241545 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 86497602F0 for ; Thu, 21 Jul 2016 12:17:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7783826242 for ; Thu, 21 Jul 2016 12:17:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C49027E66; Thu, 21 Jul 2016 12:17:53 +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 0821826242 for ; Thu, 21 Jul 2016 12:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbcGUMRw (ORCPT ); Thu, 21 Jul 2016 08:17:52 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35288 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751596AbcGUMRu (ORCPT ); Thu, 21 Jul 2016 08:17:50 -0400 Received: by mail-pa0-f46.google.com with SMTP id iw10so28710820pac.2 for ; Thu, 21 Jul 2016 05:17:50 -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=/bh0OMkUQUuRzilWWU5D9+vDPofRIUopsX++fJ1CUBI=; b=HLrnZPS516rjDcoeqUiSuwMOonAAQvV24GPq8795vyQz4egY9U7qQml30QuMyQicAh IVFRqa4LS1CtAalNVYjw8Hm2EdB0PlmDFdPDCQGSbNRDpigQOnp1eqc0T2ppCo0bRWOS ru3i3aXhuXNSREsgW1OR/RhTOuJjih20G27UopDHISbi7MqW+rzVlPEUhPMQZmfgnpvL G774rAD1z4ZpeeYzUupIq0hFyaNYfpIw6oX3PnQJ/JdTy2TUArH/W2o+TaTWrgS30TSi R4tkm8dzcPtKercY3qCLDyqPBufI6PCFv8+v+5HtugXXa64EdZ6JqAbyrX12ILfi27uI Ad8w== X-Gm-Message-State: ALyK8tIUZz44Vilxbi8LUbavbtVhgaPY5w8pVLqDZn4tRIzcxdJAhGH8FYg7vpbVNAybT04a X-Received: by 10.66.236.9 with SMTP id uq9mr75015837pac.145.1469103469249; Thu, 21 Jul 2016 05:17:49 -0700 (PDT) Received: from octopus.ceph.octopus.net ([117.202.96.145]) by smtp.gmail.com with ESMTPSA id k29sm12025908pfb.2.2016.07.21.05.17.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Jul 2016 05:17:47 -0700 (PDT) From: Venky Shankar To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com Subject: [PATCH 2/2] ceph: do not return virtual xattrs in listxattr() Date: Thu, 21 Jul 2016 17:47:30 +0530 Message-Id: <1469103450-5255-3-git-send-email-vshankar@redhat.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1469103450-5255-1-git-send-email-vshankar@redhat.com> References: <1469083758-2153-1-git-send-email-vshankar@redhat.com> <1469103450-5255-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 019f784..816c4ef 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;