From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeremy Allison Subject: Re: What should listxattr() return if there are no xattrs? Date: Tue, 21 Dec 2010 20:28:04 -0800 Message-ID: <20101222042804.GB4828@jeremy-desktop> References: Reply-To: Jeremy Allison Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, a.gruenbacher@bestbits.at, Wang Sheng-Hui , Michael Kerrisk To: Theodore Ts'o Return-path: Received: from fn.samba.org ([216.83.154.106]:47385 "EHLO lists.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751730Ab0LVE2H (ORCPT ); Tue, 21 Dec 2010 23:28:07 -0500 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Dec 20, 2010 at 08:26:53AM -0500, Theodore Ts'o wrote: > > Wang Sheng-Hui has sent some patches that change listxattr for the extN > file systems to return ENODATA when an inode has no extended attributes > (instead of zero). > > I've noted that neither btrfs nor XFS do this, and would have rejected > the patches on that basis. However, I'll note the man page for the > listxattr(2) syscall is ambiguous: > > On success, a positive number is returned indicating the size of the > extended attribute name list. On failure, -1 is returned and errno is > set appropriately. > > It states that on success a _positive_ number is returned. I've looked > and this wordining is in SGI's man page as well. I suspect the man page > should be corrected to sate that "non-negative" number is returned? Samba calls listxattr() when deciding what EA's are present on a file. Right now examining our code I think we'd survive a return of -1/ENODATA on an absense of EA's, but it's a risky change to make for existing applications. Keeping consistency with btrfs and XFS would seem to be a better idea (IMHO). Jeremy.