From patchwork Tue Feb 11 05:30:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 3624821 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C02BE9F3EA for ; Tue, 11 Feb 2014 05:30:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB4A2201F7 for ; Tue, 11 Feb 2014 05:30:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 170312018E for ; Tue, 11 Feb 2014 05:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751053AbaBKFaL (ORCPT ); Tue, 11 Feb 2014 00:30:11 -0500 Received: from mga03.intel.com ([143.182.124.21]:62079 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750788AbaBKFaI (ORCPT ); Tue, 11 Feb 2014 00:30:08 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga101.ch.intel.com with ESMTP; 10 Feb 2014 21:30:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,823,1384329600"; d="scan'208";a="473204824" Received: from zyan5-mobl.sh.intel.com ([10.239.13.19]) by fmsmga001.fm.intel.com with ESMTP; 10 Feb 2014 21:30:05 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org Cc: sage@inktank.com, "Yan, Zheng" Subject: [PATCH 2/5] ceph: remove zero-size xattr Date: Tue, 11 Feb 2014 13:30:09 +0800 Message-Id: <1392096612-11481-2-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392096612-11481-1-git-send-email-zheng.z.yan@intel.com> References: <1392096612-11481-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Yan, Zheng --- fs/ceph/xattr.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index 28f9793..6ed0e5a 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -12,6 +12,9 @@ #define XATTR_CEPH_PREFIX "ceph." #define XATTR_CEPH_PREFIX_LEN (sizeof (XATTR_CEPH_PREFIX) - 1) +static int __remove_xattr(struct ceph_inode_info *ci, + struct ceph_inode_xattr *xattr); + /* * List of handlers for synthetic system.* attributes. Other * attributes are handled directly. @@ -359,6 +362,12 @@ static int __set_xattr(struct ceph_inode_info *ci, kfree(val); return err; } + if (!val_len) { + if (xattr) + __remove_xattr(ci, xattr); + kfree(name); + return 0; + } } if (!xattr) {