Re: PROBLEM: in function nfs3_proc_get_root(), fsinfo reply error,but not return.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2012-08-20 at 20:56 +0800, Yuanming Chen wrote:
> 
> 
> 
> 
> 
> 
> 
> [1.] In function nfs3_proc_get_root(), fsinfo reply error,but not
> return. And next, reply getattr success, lead to the function return
> value is success. but in fact ,some iformation got in this function is
> error. 
> 
> 
> [2.] So fsinfo->maxfilesize = 0, when the application program call
> write(),  the function generic_write_checks() in the kernel will be
> called. This function will check the fsinfo->maxfilesize and  raise
> SIGXFSZ singal, lead to the whole process exit.

(Cc: the Linux NFS mailing list for review.)


Hi,

Does the following patch fix the proble?

Cheers
  Trond

8<---------------------------------------------
>From 13f46bbe689cade860aa3021bf635e7e6ea0ec4d Mon Sep 17 00:00:00 2001
From: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
Date: Mon, 20 Aug 2012 12:42:15 -0400
Subject: [PATCH] NFSv3: Ensure that do_proc_get_root() reports errors
 correctly

If the rpc call to NFS3PROC_FSINFO fails, then we need to report that
error so that the mount fails. Otherwise we can end up with a
superblock with completely unusable values for block sizes, maxfilesize,
etc.

Reported-by: Yuanming Chen <hikvision_linux@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
---
 fs/nfs/nfs3proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 0952c79..d6b3b5f 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -69,7 +69,7 @@ do_proc_get_root(struct rpc_clnt *client, struct nfs_fh *fhandle,
 	nfs_fattr_init(info->fattr);
 	status = rpc_call_sync(client, &msg, 0);
 	dprintk("%s: reply fsinfo: %d\n", __func__, status);
-	if (!(info->fattr->valid & NFS_ATTR_FATTR)) {
+	if (status == 0 && !(info->fattr->valid & NFS_ATTR_FATTR)) {
 		msg.rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR];
 		msg.rpc_resp = info->fattr;
 		status = rpc_call_sync(client, &msg, 0);
-- 
1.7.11.4


-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux