2018-01-12 05:48:04

by Jianhong.Yin

[permalink] [raw]
Subject: [PATCH] exportfs: move ro/rw option back to secinfo_flag_displaymap table

according https://bugzilla.redhat.com/show_bug.cgi?id=1532688#c3
ro/rw options should be in secinfo_flag_displaymap[]

test pass:
'''
[yjh@test ~]$ cat /etc/exports
/export_test 127.0.0.1(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,root_squash,all_squash,sec=krb5,ro,root_squash,no_all_squash,sec=krb5i,rw,root_squash,no_all_squash,sec=krb5p,no_root_squash,no_all_squash)
[yjh@test ~]$ sudo service nfs restart
Redirecting to /bin/systemctl restart nfs.service
[yjh@test ~]$ sudo exportfs -v
/export_test 127.0.0.1(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,all_squash,sec=krb5,ro,secure,root_squash,no_all_squash,sec=krb5i,rw,secure,root_squash,no_all_squash,sec=krb5p,rw,secure,no_root_squash,no_all_squash)
'''

Signed-off-by: Jianhong Yin <[email protected]>
---
support/nfs/exports.c | 1 +
utils/exportfs/exportfs.c | 4 ----
2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index 92bd6e6..b59d187 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -197,6 +197,7 @@ static const struct secinfo_flag_displaymap {
const char *set;
const char *unset;
} secinfo_flag_displaymap[] = {
+ { NFSEXP_READONLY, "ro", "rw" },
{ NFSEXP_INSECURE_PORT, "insecure", "secure" },
{ NFSEXP_ROOTSQUASH, "root_squash", "no_root_squash" },
{ NFSEXP_ALLSQUASH, "all_squash", "no_all_squash" },
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 448f195..cd3c979 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -695,10 +695,6 @@ dump(int verbose, int export_format)
continue;
}
c = '(';
- if (ep->e_flags & NFSEXP_READONLY)
- c = dumpopt(c, "ro");
- else
- c = dumpopt(c, "rw");
if (ep->e_flags & NFSEXP_ASYNC)
c = dumpopt(c, "async");
else
--
2.14.3



2018-01-17 16:11:17

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] exportfs: move ro/rw option back to secinfo_flag_displaymap table



On 01/12/2018 12:47 AM, Jianhong.Yin wrote:
> according https://bugzilla.redhat.com/show_bug.cgi?id=1532688#c3
> ro/rw options should be in secinfo_flag_displaymap[]
>
> test pass:
> '''
> [yjh@test ~]$ cat /etc/exports
> /export_test 127.0.0.1(rw,wdelay,no_root_squash,no_subtree_check,sec=sys,root_squash,all_squash,sec=krb5,ro,root_squash,no_all_squash,sec=krb5i,rw,root_squash,no_all_squash,sec=krb5p,no_root_squash,no_all_squash)
> [yjh@test ~]$ sudo service nfs restart
> Redirecting to /bin/systemctl restart nfs.service
> [yjh@test ~]$ sudo exportfs -v
> /export_test 127.0.0.1(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,all_squash,sec=krb5,ro,secure,root_squash,no_all_squash,sec=krb5i,rw,secure,root_squash,no_all_squash,sec=krb5p,rw,secure,no_root_squash,no_all_squash)
> '''
>
> Signed-off-by: Jianhong Yin <[email protected]>
Committed...

steved.
> ---
> support/nfs/exports.c | 1 +
> utils/exportfs/exportfs.c | 4 ----
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/support/nfs/exports.c b/support/nfs/exports.c
> index 92bd6e6..b59d187 100644
> --- a/support/nfs/exports.c
> +++ b/support/nfs/exports.c
> @@ -197,6 +197,7 @@ static const struct secinfo_flag_displaymap {
> const char *set;
> const char *unset;
> } secinfo_flag_displaymap[] = {
> + { NFSEXP_READONLY, "ro", "rw" },
> { NFSEXP_INSECURE_PORT, "insecure", "secure" },
> { NFSEXP_ROOTSQUASH, "root_squash", "no_root_squash" },
> { NFSEXP_ALLSQUASH, "all_squash", "no_all_squash" },
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index 448f195..cd3c979 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -695,10 +695,6 @@ dump(int verbose, int export_format)
> continue;
> }
> c = '(';
> - if (ep->e_flags & NFSEXP_READONLY)
> - c = dumpopt(c, "ro");
> - else
> - c = dumpopt(c, "rw");
> if (ep->e_flags & NFSEXP_ASYNC)
> c = dumpopt(c, "async");
> else
>