* [nfs-utils PATCH] conffile: add 'arg' argument to conf_remove_now()
@ 2025-01-02 22:41 Scott Mayhew
2025-01-03 21:34 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Scott Mayhew @ 2025-01-02 22:41 UTC (permalink / raw)
To: steved; +Cc: linux-nfs
Commit 9350a97a added an optional 'arg' to section names, but the logic
to remove configurations wasn't updated to check the 'arg' argument.
This wasn't really a problem until commit 15e17993 updated
conf_parse_line() to call conf_set() with override=1, the end result
being that we'll only remember the last value seen for any given
section/tag combination.
Fixes: 9350a97a ("Added an conditional argument to the Section names")
Fixes: 15e17993 ("conffile: process config.d directory config files.")
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
support/nfs/conffile.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 1e9c22b5..137fac8d 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -169,13 +169,15 @@ static void free_conftrans(struct conf_trans *ct)
* Insert a tag-value combination from LINE (the equal sign is at POS)
*/
static int
-conf_remove_now(const char *section, const char *tag)
+conf_remove_now(const char *section, const char *arg, const char *tag)
{
struct conf_binding *cb, *next;
cb = LIST_FIRST(&conf_bindings[conf_hash (section)]);
for (; cb; cb = next) {
next = LIST_NEXT(cb, link);
+ if (arg && (cb->arg == NULL || strcasecmp(arg, cb->arg) != 0))
+ continue;
if (strcasecmp(cb->section, section) == 0
&& strcasecmp(cb->tag, tag) == 0) {
LIST_REMOVE(cb, link);
@@ -217,7 +219,7 @@ conf_set_now(const char *section, const char *arg, const char *tag,
struct conf_binding *node = 0;
if (override)
- conf_remove_now(section, tag);
+ conf_remove_now(section, arg, tag);
else if (conf_get_section(section, arg, tag)) {
if (!is_default) {
xlog(LOG_INFO, "conf_set: duplicate tag [%s]:%s, ignoring...",
@@ -1254,7 +1256,7 @@ conf_end(int transaction, int commit)
node->is_default);
break;
case CONF_REMOVE:
- conf_remove_now(node->section, node->tag);
+ conf_remove_now(node->section, node->arg, node->tag);
break;
case CONF_REMOVE_SECTION:
conf_remove_section_now(node->section);
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [nfs-utils PATCH] conffile: add 'arg' argument to conf_remove_now()
2025-01-02 22:41 [nfs-utils PATCH] conffile: add 'arg' argument to conf_remove_now() Scott Mayhew
@ 2025-01-03 21:34 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2025-01-03 21:34 UTC (permalink / raw)
To: Scott Mayhew; +Cc: linux-nfs
On 1/2/25 5:41 PM, Scott Mayhew wrote:
> Commit 9350a97a added an optional 'arg' to section names, but the logic
> to remove configurations wasn't updated to check the 'arg' argument.
> This wasn't really a problem until commit 15e17993 updated
> conf_parse_line() to call conf_set() with override=1, the end result
> being that we'll only remember the last value seen for any given
> section/tag combination.
>
> Fixes: 9350a97a ("Added an conditional argument to the Section names")
> Fixes: 15e17993 ("conffile: process config.d directory config files.")
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... (tag: nfs-utils-2-8-3-rc1)
steved.
> ---
> support/nfs/conffile.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
> index 1e9c22b5..137fac8d 100644
> --- a/support/nfs/conffile.c
> +++ b/support/nfs/conffile.c
> @@ -169,13 +169,15 @@ static void free_conftrans(struct conf_trans *ct)
> * Insert a tag-value combination from LINE (the equal sign is at POS)
> */
> static int
> -conf_remove_now(const char *section, const char *tag)
> +conf_remove_now(const char *section, const char *arg, const char *tag)
> {
> struct conf_binding *cb, *next;
>
> cb = LIST_FIRST(&conf_bindings[conf_hash (section)]);
> for (; cb; cb = next) {
> next = LIST_NEXT(cb, link);
> + if (arg && (cb->arg == NULL || strcasecmp(arg, cb->arg) != 0))
> + continue;
> if (strcasecmp(cb->section, section) == 0
> && strcasecmp(cb->tag, tag) == 0) {
> LIST_REMOVE(cb, link);
> @@ -217,7 +219,7 @@ conf_set_now(const char *section, const char *arg, const char *tag,
> struct conf_binding *node = 0;
>
> if (override)
> - conf_remove_now(section, tag);
> + conf_remove_now(section, arg, tag);
> else if (conf_get_section(section, arg, tag)) {
> if (!is_default) {
> xlog(LOG_INFO, "conf_set: duplicate tag [%s]:%s, ignoring...",
> @@ -1254,7 +1256,7 @@ conf_end(int transaction, int commit)
> node->is_default);
> break;
> case CONF_REMOVE:
> - conf_remove_now(node->section, node->tag);
> + conf_remove_now(node->section, node->arg, node->tag);
> break;
> case CONF_REMOVE_SECTION:
> conf_remove_section_now(node->section);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-03 21:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 22:41 [nfs-utils PATCH] conffile: add 'arg' argument to conf_remove_now() Scott Mayhew
2025-01-03 21:34 ` Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox