diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2017-01-04 09:20:00 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2017-01-04 10:07:33 -0500 |
commit | 63f520e8f6f5f9b1182901b418f11dc531a5ffc8 (patch) | |
tree | 109187f187c22aaa4af7b65003fe1d61debb8d03 /utils/exportfs/exportfs.c | |
parent | b2fa5ca29eef7e8b9ea5cc898a095dbc59f5367f (diff) | |
download | nfs-utils-63f520e8f6f5f9b1182901b418f11dc531a5ffc8.tar.gz nfs-utils-63f520e8f6f5f9b1182901b418f11dc531a5ffc8.tar.xz nfs-utils-63f520e8f6f5f9b1182901b418f11dc531a5ffc8.zip |
exportfs: Make sure pass all valid export flags to nfsd
test_export pass a export flags only marks NFSEXP_FSID,
nfsd may want other flags for export checking.
This patch make sure exportfs pass all other flags to nfsd.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/exportfs/exportfs.c')
-rw-r--r-- | utils/exportfs/exportfs.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c index 15a1583..bacf106 100644 --- a/utils/exportfs/exportfs.c +++ b/utils/exportfs/exportfs.c @@ -473,8 +473,10 @@ static int can_test(void) return 1; } -static int test_export(char *path, int with_fsid) +static int test_export(nfs_export *exp, int with_fsid) { + char *path = exp->m_export.e_path; + int flags = exp->m_export.e_flags | (with_fsid ? NFSEXP_FSID : 0); /* beside max path, buf size should take protocol str into account */ char buf[NFS_MAXPATHLEN+1+64] = { 0 }; char *bp = buf; @@ -487,7 +489,7 @@ static int test_export(char *path, int with_fsid) qword_add(&bp, &len, path); if (len < 1) return 0; - snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0); + snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); if (fd < 0) return 0; @@ -529,12 +531,12 @@ validate_export(nfs_export *exp) if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || fs_has_fsid) { - if ( !test_export(path, 1)) { + if ( !test_export(exp, 1)) { xlog(L_ERROR, "%s does not support NFS export", path); return; } - } else if ( ! test_export(path, 0)) { - if (test_export(path, 1)) + } else if ( !test_export(exp, 0)) { + if (test_export(exp, 1)) xlog(L_ERROR, "%s requires fsid= for NFS export", path); else xlog(L_ERROR, "%s does not support NFS export", path); |