File bug-474328_retry-export.patch of Package nfs-utils
From: NeilBrown <neilb@suse.de>
References: bnc#474328
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 moutnd 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.
Signed-off-by: NeilBrown <neilb@suse.de>
---
utils/mountd/mountd.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- nfs-utils-1.1.3.orig/utils/mountd/mountd.c
+++ nfs-utils-1.1.3/utils/mountd/mountd.c
@@ -438,7 +438,8 @@ get_rootfh(struct svc_req *rqstp, dirpat
return fh;
} else {
struct nfs_fh_len *fh;
-
+ int retried = 0;
+ retry:
if (exp->m_exported<1)
export_export(exp);
if (!exp->m_xtabent)
@@ -454,6 +455,11 @@ get_rootfh(struct svc_req *rqstp, dirpat
fh = getfh_old ((struct sockaddr *) sin,
stb.st_dev, stb.st_ino);
}
+ if (fh == NULL && ! retried) {
+ retried = 1;
+ exp->m_exported = 0;
+ goto retry;
+ }
if (fh != NULL) {
mountlist_add(inet_ntoa(sin->sin_addr), p);
*error = NFS_OK;