From: Kinglong Mee <kinglongmee@gmail.com>
To: Steve Dickson <SteveD@redhat.com>, linux-nfs@vger.kernel.org
Cc: kinglongmee@gmail.com, Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] exportfs: Make sure pass all valid export flags to nfsd
Date: Sat, 31 Dec 2016 21:05:11 +0800 [thread overview]
Message-ID: <c0826298-545e-64a3-b6bb-86413bf9eb39@gmail.com> (raw)
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>
---
utils/exportfs/exportfs.c | 12 +++++++-----
1 file 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);
--
2.9.3
next reply other threads:[~2016-12-31 13:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-31 13:05 Kinglong Mee [this message]
2017-01-04 16:56 ` [PATCH] exportfs: Make sure pass all valid export flags to nfsd Steve Dickson
2017-01-06 21:05 ` J. Bruce Fields
2017-01-07 11:57 ` Kinglong Mee
2017-01-11 14:16 ` J. Bruce Fields
2017-01-15 7:43 ` Kinglong Mee
2017-01-16 16:54 ` J. Bruce Fields
2017-01-18 10:16 ` Kinglong Mee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0826298-545e-64a3-b6bb-86413bf9eb39@gmail.com \
--to=kinglongmee@gmail.com \
--cc=SteveD@redhat.com \
--cc=hch@infradead.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).