[patch] nfs statfs error-handling fix

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Date: Saturday, April 7, 2007 - 10:34 am

Hi,

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.

Thanks,
Amnon

Signed-off-by: Amnon Aaronsohn <amnonaar@gmail.com>
--

--- linux-source-2.6.20-2.6.20/fs/nfs/super.c.orig	2007-04-07 15:19:14.000000000 +0300
+++ linux-source-2.6.20-2.6.20/fs/nfs/super.c	2007-04-07 15:24:35.000000000 +0300
@@ -203,9 +203,9 @@ static int nfs_statfs(struct dentry *den
  	lock_kernel();

  	error = server->nfs_client->rpc_ops->statfs(server, fh, &res);
-	buf->f_type = NFS_SUPER_MAGIC;
  	if (error < 0)
-		goto out_err;
+		goto out;
+	buf->f_type = NFS_SUPER_MAGIC;

  	/*
  	 * Current versions of glibc do not correctly handle the
@@ -234,13 +234,7 @@ static int nfs_statfs(struct dentry *den
  	buf->f_namelen = server->namelen;
   out:
  	unlock_kernel();
-	return 0;
-
- out_err:
-	dprintk("%s: statfs error = %d\n", __FUNCTION__, -error);
-	buf->f_bsize = buf->f_blocks = buf->f_bfree = buf->f_bavail = -1;
-	goto out;
-
+	return error;
  }

  /*
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] nfs statfs error-handling fix, , (Sat Apr 7, 10:34 am)