bug in old-cache handling in mountd.
Subsystems (2)
PATCH 1/1 bug in old-cache handling in mountd.
Hi,
there is a bug in the old-cache behaviour of mountd. Hopefully no-one is using this but you never know....
The bug was reported to redhat
https://bugzilla.redhat.com/show_bug.cgi?id=164186
It was fixed incorrectly and never (that I recall) reported upstream. :-(
A SLES customer thinks they have hit the same problem, which is why I'm looking at it. (They shouldn't really hit it because that version of sles uses 'new_cache' but maybe nfsdfs was disabled somehow - don't know yet).
Anyway, when mountd gets a mount request, it tells the kernel about it and remembers that it told the kernel so it doesn't have to tell the kernel again.
It is possible that "exportfs -r" will tell the kernel to forget that information if the client has since unmounted.
So mountd really needs to tell the kernel even if it thinks the kernel should already know.
The following patch does this if the kernel refuses to provide a valid filehandle.
Does RHEL3 use old-cache or new-cache ??
Thanks,
NeilBrown
From: NeilBrown <[email protected]>
Subject: retry export if getfh fails.
mountd tries to avoid telling the kernel to export something when the kernel already knows to do that.
However sometimes (exportfs -r) the kernel can be told to forget something without mountd realising.
So if mountd finds that it cannot get a valid filehandle, make sure it really has been exported to the kernel.
This only applies if the nfsd filesystem is not mounted.
utils/mountd/mountd.c +10 -1
@@ -467,8 +467,12 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,return NULL ; } }else { -if (exp->m_exported<1 ) +int did_export =0 ; + retry: +if (exp->m_exported<1 ) {export_export (exp); + did_export =1 ; + }if (!exp->m_xtabent)xtab_append (exp);
@@ -482,6 +486,11 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret, fh =getfh_old ((struct sockaddr *) sin, stb.st_dev, stb.st_ino); } +if (fh ==NULL && !did_export) { + exp->m_exported =0 ; + goto retry; + } +if (fh ==NULL ) {xlog (L_WARNING ,"getfh failed: %s" ,strerror (errno)); *error =NFSERR_ACCES ;
A message that is not in the archive (sent off-list or not yet received): 18975.16159.264056.854413-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org
Quoted 23 lines · Neil Brown
Hi,
there is a bug in the old-cache behaviour of mountd. Hopefully no-one is using this but you never know....The bug was reported to redhat
https://bugzilla.redhat.com/show_bug.cgi?id=164186It was fixed incorrectly and never (that I recall) reported upstream. :-(
A SLES customer thinks they have hit the same problem, which is why I'm looking at it. (They shouldn't really hit it because that version of sles uses '
new_cache' but maybe nfsdfs was disabled somehow - don't know yet).Anyway, when mountd gets a mount request, it tells the kernel about it and remembers that it told the kernel so it doesn't have to tell the kernel again.
It is possible that "exportfs -r" will tell the kernel to forget that information if the client has since unmounted.
So mountd really needs to tell the kernel even if it thinks the kernel should already know.
Quoted 4 lines
The following patch does this if the kernel refuses to provide a valid filehandle.
Does RHEL3 use old-cache or new-cache ??
The new cache, if it exists...
Committed..
steved.
Quoted 26 lines · On Wednesday June 3, [email protected] wrote:
Quoted 23 lines · Neil Brown
Hi,
there is a bug in the old-cache behaviour of mountd. Hopefully no-one is using this but you never know....The bug was reported to redhat
https://bugzilla.redhat.com/show_bug.cgi?id=164186It was fixed incorrectly and never (that I recall) reported upstream. :-(
A SLES customer thinks they have hit the same problem, which is why I'm looking at it. (They shouldn't really hit it because that version of sles uses '
new_cache' but maybe nfsdfs was disabled somehow - don't know yet).Anyway, when mountd gets a mount request, it tells the kernel about it and remembers that it told the kernel so it doesn't have to tell the kernel again.
It is possible that "exportfs -r" will tell the kernel to forget that information if the client has since unmounted.
So mountd really needs to tell the kernel even if it thinks the kernel should already know.
Quoted 5 lines
Quoted 4 lines
The following patch does this if the kernel refuses to provide a valid filehandle.
Does RHEL3 use old-cache or new-cache ??
The new cache, if it exists...
That's what I would have thought... which leave me wondering how both your customer and our customer hit the bug... I must be missing something important.
Quoted 2 lines
Committed..
Thanks.
NeilBrown