From patchwork Tue Sep 6 13:33:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 1126372 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p86DXsBB008619 for ; Tue, 6 Sep 2011 13:33:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754199Ab1IFNdv (ORCPT ); Tue, 6 Sep 2011 09:33:51 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54542 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753347Ab1IFNdu (ORCPT ); Tue, 6 Sep 2011 09:33:50 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C679F8B2F9; Tue, 6 Sep 2011 15:33:49 +0200 (CEST) Received: by ds.suse.cz (Postfix, from userid 10065) id 6D87B76192; Tue, 6 Sep 2011 15:33:49 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com, David Sterba Subject: [PATCH -rc6] btrfs: xattr: fix attribute removal Date: Tue, 6 Sep 2011 15:33:45 +0200 Message-Id: <1315316025-11138-1-git-send-email-dsterba@suse.cz> X-Mailer: git-send-email 1.7.6.233.gd79bc Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 06 Sep 2011 13:33:54 +0000 (UTC) An attribute is not removed by 'setfattr -x attr file' and remains visible in attr list. This makes xfstests/062 pass again. Signed-off-by: David Sterba Reviewed-by: Li Zefan --- fs/btrfs/xattr.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index d733b9c..69565e5 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -116,6 +116,12 @@ static int do_setxattr(struct btrfs_trans_handle *trans, if (ret) goto out; btrfs_release_path(path); + + /* + * remove the attribute + */ + if (!value) + goto out; } again: @@ -158,6 +164,9 @@ out: return ret; } +/* + * @value: "" makes the attribute to empty, NULL removes it + */ int __btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode, const char *name, const void *value, size_t size, int flags)