All of lore.kernel.org
 help / color / mirror / Atom feed
* 2.6.x NFS and NFSD
@ 2003-07-30 22:51 Wakko Warner
  2003-08-01  3:51 ` Neil Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Wakko Warner @ 2003-07-30 22:51 UTC (permalink / raw)
  To: linux-kernel

Anyone had any luck with either of these?

2.6.x as a server:
I'm using nfs-kernel-server v1.0.5-1 (debian).
Config Ops:
CONFIG_NFSD=m
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V4 is not set
CONFIG_NFSD_TCP=y
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y   << I didn't configure this, where'd it come from?
CONFIG_EXPORTFS=m
CONFIG_SUNRPC=m
This is in /etc/exports:
/ vegeta(rw,no_root_squash,async,nohide)

on the machine vegeta, I mount this machine (kingkai:/ /mnt), cd to /mnt, do
ls, and ls hangs.  client uses kernel 2.4.20 with NFSv3 enabled and it was
mounted v3.

2.6.x as a client:
If the server is using 2.4.x with the kernel nfs server, all's fine except
for nohide.  I have a 2.4.21 alpha machine exporting / and /raid-0 with the
nohide option.  If I mount it to /mnt and cd /mnt/raid-0 there's nothing
there.  On 2.4.20 client this works. (NFSv3 here)

If the server is using the userspace nfs server (I don't like exporting all
those mount points with nohide and this works for me on most machines that I
access occasionally.  I assume userspace is NFSv2. 2.2beta47-12) Kernel
2.6.x will simply say the nfs server is not responding if I do an ls.  If I
copy a file (not using tab completion), it seems to work.

client options:
CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
# CONFIG_NFS_V4 is not set


Now on a positive note, my hp scanjet 5370c works with 2.6.0-test2 great
where as 2.4 it doesn't.  the NFS is holding me back.


P.S.
Vegeta: kernel 2.4.20, userspace nfs, inspiron 8100 1ghz pIII 256mb ram
	NIC: intel 10/100
Kingkai: Kernel 2.6.0-test1, kernel nfs, home build 700mhz pIII 256mb ram
	NIC: 3com 3cr990srv 10/100   MainBoard: MSI MS-6163 v2
Alpha: Kernel 2.4.21, kernel nfs, AlphaServer 1000A 4/266 160mb ram
	NIC: Dec Tulip 10/100

All machines use ext3 as the local filesystem.

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.6.x NFS and NFSD
  2003-07-30 22:51 2.6.x NFS and NFSD Wakko Warner
@ 2003-08-01  3:51 ` Neil Brown
  2003-08-02  1:02   ` Wakko Warner
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Brown @ 2003-08-01  3:51 UTC (permalink / raw)
  To: Wakko Warner; +Cc: linux-kernel

On Wednesday July 30, wakko@animx.eu.org wrote:
> Anyone had any luck with either of these?
> 

some.

> 2.6.x as a server:
> I'm using nfs-kernel-server v1.0.5-1 (debian).
> Config Ops:
> CONFIG_NFSD=m
> CONFIG_NFSD_V3=y
> # CONFIG_NFSD_V4 is not set
> CONFIG_NFSD_TCP=y
> CONFIG_LOCKD=m
> CONFIG_LOCKD_V4=y   << I didn't configure this, where'd it come
> from?

If either NFS_V3 or NFSD_V3, then LOCKD_V4 is automatically added.

> CONFIG_EXPORTFS=m
> CONFIG_SUNRPC=m
> This is in /etc/exports:
> / vegeta(rw,no_root_squash,async,nohide)

"nohide" is incorrect here.
"nohide" applies to a child filesystem and says that if some client
mounts the parent filesystem and looks at the mount point, then the
child should not be hidden (as it normally would be with NFS). As
'/' is never a child, it is meaningless to have "nohide" for it.
It should cause problems  (though it would hurt to remove it and see
if it makes a difference).

> 
> on the machine vegeta, I mount this machine (kingkai:/ /mnt), cd to /mnt, do
> ls, and ls hangs.  client uses kernel 2.4.20 with NFSv3 enabled and it was
> mounted v3.

I have a hunch what this might be, and it'll require fixing both the
kernel and nfs-utils ;-(

Could you try using
   mount -t nfsd nfsd /proc/fs/nfs

before starting the nfs-kernel-server (particularly before starting
mountd or running exportfs).

Also, if you are brave, could you try with the following two patches,
one against linux-2.6.0-test2 and one against nfs-utils.  Then run the
nfs kernel server *without* mounting /proc/fs/nfs first.

Thanks,
NeilBrown

First patch against the kernel.
========================================================================
Make sure sunrpc/cache doesn't confuse writers with readers.

When a sunrpc/cache channel is not open for reading, the
cache doesn't bother making and waiting for up-calls.

However it doesn't currently distingish between open-for-read/write
and open-for-write, so an op-for-write will look like a reader
and will cause inappropriate waiting.

This patch checks if a file is open-for-read and will only register
a file as a reader if it really is one.


 ----------- Diffstat output ------------
 ./net/sunrpc/cache.c |   69 +++++++++++++++++++++++++++------------------------
 1 files changed, 37 insertions(+), 32 deletions(-)

diff ./net/sunrpc/cache.c~current~ ./net/sunrpc/cache.c
--- ./net/sunrpc/cache.c~current~	2003-08-01 13:22:58.000000000 +1000
+++ ./net/sunrpc/cache.c	2003-08-01 13:31:58.000000000 +1000
@@ -738,19 +738,22 @@ cache_ioctl(struct inode *ino, struct fi
 static int
 cache_open(struct inode *inode, struct file *filp)
 {
-	struct cache_reader *rp;
-	struct cache_detail *cd = PDE(inode)->data;
+	struct cache_reader *rp = NULL;
 
-	rp = kmalloc(sizeof(*rp), GFP_KERNEL);
-	if (!rp)
-		return -ENOMEM;
-	rp->page = NULL;
-	rp->offset = 0;
-	rp->q.reader = 1;
-	atomic_inc(&cd->readers);
-	spin_lock(&queue_lock);
-	list_add(&rp->q.list, &cd->queue);
-	spin_unlock(&queue_lock);
+	if (filp->f_mode & FMODE_READ) {
+		struct cache_detail *cd = PDE(inode)->data;
+
+		rp = kmalloc(sizeof(*rp), GFP_KERNEL);
+		if (!rp)
+			return -ENOMEM;
+		rp->page = NULL;
+		rp->offset = 0;
+		rp->q.reader = 1;
+		atomic_inc(&cd->readers);
+		spin_lock(&queue_lock);
+		list_add(&rp->q.list, &cd->queue);
+		spin_unlock(&queue_lock);
+	}
 	filp->private_data = rp;
 	return 0;
 }
@@ -761,29 +764,31 @@ cache_release(struct inode *inode, struc
 	struct cache_reader *rp = filp->private_data;
 	struct cache_detail *cd = PDE(inode)->data;
 
-	spin_lock(&queue_lock);
-	if (rp->offset) {
-		struct cache_queue *cq;
-		for (cq= &rp->q; &cq->list != &cd->queue;
-		     cq = list_entry(cq->list.next, struct cache_queue, list))
-			if (!cq->reader) {
-				container_of(cq, struct cache_request, q)
-					->readers--;
-				break;
-			}
-		rp->offset = 0;
-	}
-	list_del(&rp->q.list);
-	spin_unlock(&queue_lock);
+	if (rp) {
+		spin_lock(&queue_lock);
+		if (rp->offset) {
+			struct cache_queue *cq;
+			for (cq= &rp->q; &cq->list != &cd->queue;
+			     cq = list_entry(cq->list.next, struct cache_queue, list))
+				if (!cq->reader) {
+					container_of(cq, struct cache_request, q)
+						->readers--;
+					break;
+				}
+			rp->offset = 0;
+		}
+		list_del(&rp->q.list);
+		spin_unlock(&queue_lock);
 
-	if (rp->page)
-		kfree(rp->page);
+		if (rp->page)
+			kfree(rp->page);
 
-	filp->private_data = NULL;
-	kfree(rp);
+		filp->private_data = NULL;
+		kfree(rp);
 
-	cd->last_close = get_seconds();
-	atomic_dec(&cd->readers);
+		cd->last_close = get_seconds();
+		atomic_dec(&cd->readers);
+	}
 	return 0;
 }
 


=======================
Second patch, against nfs-utils 1.0.5


=======================================================================
--- ./support/nfs/nfsexport.c	2003/08/01 03:47:47	1.1
+++ ./support/nfs/nfsexport.c	2003/08/01 03:48:19
@@ -93,7 +93,7 @@ nfsexport(struct nfsctl_export *exp)
 {
 	struct nfsctl_arg	arg;
 	int fd;
-	if ((fd=open("/proc/net/rpc/nfsd.fh/channel", O_RDWR))>= 0) {
+	if ((fd=open("/proc/net/rpc/nfsd.fh/channel", O_WRONLY))>= 0) {
 		close(fd);
 		return exp_unexp(exp, 1);
 	}
@@ -108,7 +108,7 @@ nfsunexport(struct nfsctl_export *exp)
 	struct nfsctl_arg	arg;
 
 	int fd;
-	if ((fd=open("/proc/net/rpc/nfsd.fh/channel", O_RDWR))>= 0) {
+	if ((fd=open("/proc/net/rpc/nfsd.fh/channel", O_WRONLY))>= 0) {
 		close(fd);
 		return exp_unexp(exp, 0);
 	}
--- ./utils/mountd/cache.c	2003/08/01 03:46:53	1.1
+++ ./utils/mountd/cache.c	2003/08/01 03:47:02
@@ -320,7 +320,7 @@ int cache_process_req(fd_set *readfds) 
 void cache_export_ent(char *domain, struct exportent *exp)
 {
 
-	FILE *f = fopen("/proc/net/rpc/nfsd.export/channel", "r+");
+	FILE *f = fopen("/proc/net/rpc/nfsd.export/channel", "w");
 	if (!f)
 		return;
 
@@ -340,7 +340,7 @@ void cache_export(nfs_export *exp)
 {
 	FILE *f;
 
-	f = fopen("/proc/net/rpc/auth.unix.ip/channel", "r+");
+	f = fopen("/proc/net/rpc/auth.unix.ip/channel", "w");
 	if (!f)
 		return;
 
@@ -367,6 +367,7 @@ cache_get_filehandle(nfs_export *exp, in
 	FILE *f = fopen("/proc/fs/nfs/filehandle", "r+");
 	char buf[200];
 	char *bp = buf;
+	char *fg;
 	static struct nfs_fh_len fh;
 	if (!f)
 		return NULL;
@@ -376,7 +377,9 @@ cache_get_filehandle(nfs_export *exp, in
 	qword_printint(f, len);	
 	qword_eol(f);
 	
-	if (fgets(buf, sizeof(buf), f) == NULL)
+	fg =fgets(buf, sizeof(buf), f);
+	fclose(f);
+	if (fg == NULL)
 		return NULL;
 	memset(fh.fh_handle, 0, sizeof(fh.fh_handle));
 	fh.fh_size = qword_get(&bp, fh.fh_handle, NFS3_FHSIZE);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.6.x NFS and NFSD
  2003-08-01  3:51 ` Neil Brown
@ 2003-08-02  1:02   ` Wakko Warner
  0 siblings, 0 replies; 3+ messages in thread
From: Wakko Warner @ 2003-08-02  1:02 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-kernel

> > 2.6.x as a server:
> > I'm using nfs-kernel-server v1.0.5-1 (debian).
> > Config Ops:
> > CONFIG_NFSD=m
> > CONFIG_NFSD_V3=y
> > # CONFIG_NFSD_V4 is not set
> > CONFIG_NFSD_TCP=y
> > CONFIG_LOCKD=m
> > CONFIG_LOCKD_V4=y   << I didn't configure this, where'd it come
> > from?
> 
> If either NFS_V3 or NFSD_V3, then LOCKD_V4 is automatically added.

Ok, I see.

> > CONFIG_EXPORTFS=m
> > CONFIG_SUNRPC=m
> > This is in /etc/exports:
> > / vegeta(rw,no_root_squash,async,nohide)
> 
> "nohide" is incorrect here.

previous experience.  IIRC, if I didn't have it on /, I couldn't see /usr,
/raid-0, or others (2.4.x).

> > ls, and ls hangs.  client uses kernel 2.4.20 with NFSv3 enabled and it was
> > mounted v3.
> 
> I have a hunch what this might be, and it'll require fixing both the
> kernel and nfs-utils ;-(
> 
> Could you try using
>    mount -t nfsd nfsd /proc/fs/nfs

This worked.  Of course I also removed nohide from / and added the rest of
my FSs.  There were 4 in all on this test machine. / /usr /usr/src and
/home.  All are exported as above except / has nohide removed.

> before starting the nfs-kernel-server (particularly before starting
> mountd or running exportfs).
> 
> Also, if you are brave, could you try with the following two patches,
> one against linux-2.6.0-test2 and one against nfs-utils.  Then run the
> nfs kernel server *without* mounting /proc/fs/nfs first.

I did not try the patches.  This work around seems to be what I was looking
for.  I'll wait for the patches to be merged.  I did not patch the
nfs-kernel-server either.

I tried 2.6.x as a client to a v2 server running the userland server.  I do
get a ton of nfs not responding messages, but I did a find /mnt/usr on it. 
Doesn't seem to be going into D state this time.

-- 
 Lab tests show that use of micro$oft causes cancer in lab animals

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-08-02  0:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-30 22:51 2.6.x NFS and NFSD Wakko Warner
2003-08-01  3:51 ` Neil Brown
2003-08-02  1:02   ` Wakko Warner

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.