From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751480AbWDCFUP (ORCPT ); Mon, 3 Apr 2006 01:20:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751477AbWDCFUP (ORCPT ); Mon, 3 Apr 2006 01:20:15 -0400 Received: from mail.suse.de ([195.135.220.2]:39605 "EHLO mx1.suse.de") by vger.kernel.org with ESMTP id S1751476AbWDCFUL (ORCPT ); Mon, 3 Apr 2006 01:20:11 -0400 From: NeilBrown To: Andrew Morton Date: Mon, 3 Apr 2006 15:18:23 +1000 Message-Id: <1060403051823.1771@suse.de> X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org We should be using the length from the second vfs_getxattr, in case it changed. (Note: there's still a small race here; we could end up returning -ENOMEM if the length increased between the first and second call. I don't know whether it's worth spending a lot of effort to fix that.) This makes XFS ACLs usable on NFS exports, which they currently aren't, since XFS appears to be returning a too-large value for vfs_getxattr() when it's passed a NULL buffer. So there's probably an XFS bug here too, though since getxattr with a NULL buffer is usually used to decide how much memory to allocate, it may be a fairly harmless bug in most cases. Signed-off-by: J. Bruce Fields Signed-off-by: Neil Brown ### Diffstat output ./fs/nfsd/vfs.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c --- ./fs/nfsd/vfs.c~current~ 2006-04-03 15:12:07.000000000 +1000 +++ ./fs/nfsd/vfs.c 2006-04-03 15:12:07.000000000 +1000 @@ -371,7 +371,6 @@ out_nfserr: static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) { ssize_t buflen; - int error; buflen = vfs_getxattr(dentry, key, NULL, 0); if (buflen <= 0) @@ -381,10 +380,7 @@ static ssize_t nfsd_getxattr(struct dent if (!*buf) return -ENOMEM; - error = vfs_getxattr(dentry, key, *buf, buflen); - if (error < 0) - return error; - return buflen; + return vfs_getxattr(dentry, key, *buf, buflen); } #endif