提交 b5872b0d 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] knfsd: nfsd4: fix acl xattr length return

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: NJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: NNeil Brown <neilb@suse.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 b905b7b0
...@@ -371,7 +371,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, ...@@ -371,7 +371,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
{ {
ssize_t buflen; ssize_t buflen;
int error;
buflen = vfs_getxattr(dentry, key, NULL, 0); buflen = vfs_getxattr(dentry, key, NULL, 0);
if (buflen <= 0) if (buflen <= 0)
...@@ -381,10 +380,7 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) ...@@ -381,10 +380,7 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
if (!*buf) if (!*buf)
return -ENOMEM; return -ENOMEM;
error = vfs_getxattr(dentry, key, *buf, buflen); return vfs_getxattr(dentry, key, *buf, buflen);
if (error < 0)
return error;
return buflen;
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册