Commit 1a0ba9ae authored by Amnon Aaronsohn's avatar Amnon Aaronsohn Committed by Trond Myklebust

NFS: statfs error-handling fix

The nfs statfs function returns a success code on error, and fills the
output buffer with invalid values.  The attached patch makes it return a
correct error code instead.
Signed-off-by: default avatarAmnon Aaronsohn <amnonaar@gmail.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
 (Modified patch to reinstate the dprintk())
parent d585158b
...@@ -204,9 +204,9 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -204,9 +204,9 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
lock_kernel(); lock_kernel();
error = server->nfs_client->rpc_ops->statfs(server, fh, &res); error = server->nfs_client->rpc_ops->statfs(server, fh, &res);
buf->f_type = NFS_SUPER_MAGIC;
if (error < 0) if (error < 0)
goto out_err; goto out_err;
buf->f_type = NFS_SUPER_MAGIC;
/* /*
* Current versions of glibc do not correctly handle the * Current versions of glibc do not correctly handle the
...@@ -233,15 +233,14 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -233,15 +233,14 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_ffree = res.afiles; buf->f_ffree = res.afiles;
buf->f_namelen = server->namelen; buf->f_namelen = server->namelen;
out:
unlock_kernel(); unlock_kernel();
return 0; return 0;
out_err: out_err:
dprintk("%s: statfs error = %d\n", __FUNCTION__, -error); dprintk("%s: statfs error = %d\n", __FUNCTION__, -error);
buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1; unlock_kernel();
goto out; return error;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment