All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 005 of 16] knfsd: nfsd: oops exporting nonexistent directory
Date: Mon, 3 Apr 2006 15:18:28 +1000	[thread overview]
Message-ID: <1060403051828.1785@suse.de> (raw)
In-Reply-To: 20060403151452.1567.patches@notabene



Export a directory that does not exist:
	exportfs -orw,fsid=0,insecure,no_subtree_check client:/home/NFS4

Try to mount from client with nfs4. Mount hangs (I'm not sure why -
that's another issue).

While client is hung, back on server

	mkdir /home/NFS4

The server panics in dput. I traced the problem back to svc_export_parse()
calling path_release() even though path_lookup() failed (it happens
to fill in the nameidata structure with a negative dentry - so the test
after out: succeeds).

After patching, an recreating the problem, the client mount still takes
some time before finally exiting with a message "couldn't read
superblock".

Here is a simple patch to resolve this issue:

Signed-Off-By: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/nfsd/export.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff ./fs/nfsd/export.c~current~ ./fs/nfsd/export.c
--- ./fs/nfsd/export.c~current~	2006-04-03 15:12:08.000000000 +1000
+++ ./fs/nfsd/export.c	2006-04-03 15:12:08.000000000 +1000
@@ -422,7 +422,7 @@ static int svc_export_parse(struct cache
 	if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
 		goto out;
 	err = path_lookup(buf, 0, &nd);
-	if (err) goto out;
+	if (err) goto out_no_path;
 
 	exp.h.flags = 0;
 	exp.ex_client = dom;
@@ -475,6 +475,7 @@ static int svc_export_parse(struct cache
  out:
 	if (nd.dentry)
 		path_release(&nd);
+ out_no_path:
 	if (dom)
 		auth_domain_put(dom);
 	kfree(buf);


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

WARNING: multiple messages have this Message-ID (diff)
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: nfs@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 005 of 16] knfsd: nfsd: oops exporting nonexistent directory
Date: Mon, 3 Apr 2006 15:18:28 +1000	[thread overview]
Message-ID: <1060403051828.1785@suse.de> (raw)
In-Reply-To: 20060403151452.1567.patches@notabene



Export a directory that does not exist:
	exportfs -orw,fsid=0,insecure,no_subtree_check client:/home/NFS4

Try to mount from client with nfs4. Mount hangs (I'm not sure why -
that's another issue).

While client is hung, back on server

	mkdir /home/NFS4

The server panics in dput. I traced the problem back to svc_export_parse()
calling path_release() even though path_lookup() failed (it happens
to fill in the nameidata structure with a negative dentry - so the test
after out: succeeds).

After patching, an recreating the problem, the client mount still takes
some time before finally exiting with a message "couldn't read
superblock".

Here is a simple patch to resolve this issue:

Signed-Off-By: Frank Filz <ffilzlnx@us.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./fs/nfsd/export.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff ./fs/nfsd/export.c~current~ ./fs/nfsd/export.c
--- ./fs/nfsd/export.c~current~	2006-04-03 15:12:08.000000000 +1000
+++ ./fs/nfsd/export.c	2006-04-03 15:12:08.000000000 +1000
@@ -422,7 +422,7 @@ static int svc_export_parse(struct cache
 	if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
 		goto out;
 	err = path_lookup(buf, 0, &nd);
-	if (err) goto out;
+	if (err) goto out_no_path;
 
 	exp.h.flags = 0;
 	exp.ex_client = dom;
@@ -475,6 +475,7 @@ static int svc_export_parse(struct cache
  out:
 	if (nd.dentry)
 		path_release(&nd);
+ out_no_path:
 	if (dom)
 		auth_domain_put(dom);
 	kfree(buf);

  parent reply	other threads:[~2006-04-03  5:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03  5:18 [PATCH 000 of 16] knfsd: Introduction NeilBrown
2006-04-03  5:18 ` [PATCH 001 of 16] knfsd: locks: flag NFSv4-owned locks NeilBrown
2006-04-03  5:18   ` NeilBrown
2006-04-03  5:18 ` [PATCH 002 of 16] knfsd: nfsd4: Wrong error handling in nfs4acl NeilBrown
2006-04-03  5:18 ` [PATCH 003 of 16] knfsd: nfsd4: better nfs4acl errors NeilBrown
2006-04-03  5:18   ` NeilBrown
2006-04-03  5:18 ` [PATCH 004 of 16] knfsd: nfsd4: fix acl xattr length return NeilBrown
2006-04-03  5:18 ` NeilBrown [this message]
2006-04-03  5:18   ` [PATCH 005 of 16] knfsd: nfsd: oops exporting nonexistent directory NeilBrown
2006-04-03  5:18 ` [PATCH 006 of 16] knfsd: nfsd: nfsd_setuser doesn't really need to modify rqstp->rq_cred NeilBrown
2006-04-03  5:18   ` NeilBrown
2006-04-03  5:18 ` [PATCH 007 of 16] knfsd: nfsd4: remove nfsd_setuser from putrootfh NeilBrown
2006-04-03  5:18 ` [PATCH 008 of 16] knfsd: nfsd4: fix corruption of returned data when using 64k pages NeilBrown
2006-04-03  5:18 ` [PATCH 009 of 16] knfsd: nfsd4: fix corruption on readdir encoding with " NeilBrown
2006-04-03  5:18   ` NeilBrown
2006-04-03  5:18 ` [PATCH 010 of 16] knfsd: svcrpc: gss: don't call svc_take_page unnecessarily NeilBrown
2006-04-03  5:18   ` NeilBrown
2006-04-03  5:19 ` [PATCH 011 of 16] knfsd: svcrpc: WARN() instead of returning an error from svc_take_page NeilBrown
2006-04-03  5:19   ` NeilBrown
2006-04-03 22:02   ` Ingo Oeser
2006-04-04  2:26     ` [NFS] " J. Bruce Fields
2006-04-03  5:19 ` [PATCH 012 of 16] knfsd: nfsd4: fix laundromat shutdown race NeilBrown
2006-04-03  5:19 ` [PATCH 013 of 16] knfsd: nfsd4: nfsd4_probe_callback cleanup NeilBrown
2006-04-03  5:19 ` [PATCH 014 of 16] knfsd: nfsd4: add missing rpciod_down() NeilBrown
2006-04-03  5:19   ` NeilBrown
2006-04-03  5:19 ` [PATCH 015 of 16] knfsd: nfsd4: limit number of delegations handed out NeilBrown
2006-04-03  5:19 ` [PATCH 016 of 16] knfsd: nfsd4: grant delegations more frequently NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1060403051828.1785@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.