| Summary: | [exportfs] Validate export entry fail. And when start nfs server, should not export the invalid entry; | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | JianHong Yin <jiyin> |
| Component: | nfs-utils | Assignee: | Steve Dickson <steved> |
| Status: | CLOSED WONTFIX | QA Contact: | Yongcheng Yang <yoyang> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | high | ||
| Version: | 7.0 | CC: | fs-qe, jlayton, yoyang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1007626 | Environment: | |
| Last Closed: | 2014-01-18 16:24:05 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Bug Depends On: | 1007626 | ||
| Bug Blocks: | 1007627 | ||
|
Description
JianHong Yin
2013-09-13 02:17:55 UTC
Debug, and review the code of exportfs,
find that: this is a bug of exportfs(also about kernel):
static int test_export(char *path, int with_fsid)
{
char buf[1024];
int fd, n;
sprintf(buf, "-test-client- %s 3 %d -1 -1 0\n",
path,
with_fsid ? NFSEXP_FSID : 0);
fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY);
if (fd < 0)
return 0;
n = write(fd, buf, strlen(buf));
close(fd);
if (n < 0)
return 0;
return 1;
}
1. if the path is an tmpfs(no uuid), and with_fsid==0,
this function test_export still return 1 (write success). that's wrong.
2. and another problem: validate_export() just generate log and return void.
We think that validate_export() should return an int value to indicate whether the path can export. And in export_all(), should not export the path if invalid;
static void
export_all(int verbose)
{
nfs_export *exp;
int i;
for (i = 0; i < MCL_MAXTYPES; i++) {
for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
if (verbose)
printf("exporting %s:%s\n",
exp->m_client->m_hostname,
exp->m_export.e_path);
exp->m_xtabent = 1;
exp->m_mayexport = 1;
exp->m_changed = 1;
exp->m_warned = 0;
validate_export(exp);
}
}
}
static void <<<- should return int value to indicate whether the path can export
validate_export(nfs_export *exp)
{
#BEGIN
--- exportfs.c 2013-06-06 15:12:58.881567360 +0800
+++ exportfs.c.new 2013-09-14 14:50:56.719877598 +0800
@@ -475,6 +475,9 @@ validate_export(nfs_export *exp)
xlog(L_ERROR, "%s does not support NFS export", path);
return;
+ } else {
+ xlog(L_ERROR, "Assert: test_export() %s fail", path);
+ return;
}
}
#END
this patch could avoid the test_export work fail.
The following error is now logged for file system requiring fsids exportfs[4042]: exportfs: /dev/shm requires fsid= for NFS export This issue is actually that "exportfs" should NOT show the invalid entries. For examples: [root ~]# exportfs -ua [root ~]# exportfs -i *:/not.exist exportfs: Failed to stat /not.exist: No such file or directory [root ~]# echo $? 1 [root ~]# exportfs /not.exist <world> <<<<<<<<<<< Invalid path is exported anyway [root ~]# However, as the rhel6 bug 1007627 and rhel5 bug 1007626 are both closed as WONTFIX, updating this one to be WONTFIX too. Please correct me if there's any concern. |