From: Steve Dickson <SteveD@redhat.com>
To: Yongcheng Yang <yoyang@redhat.com>, linux-nfs@vger.kernel.org
Cc: Yongcheng Yang <yongcheng.yang@gmail.com>
Subject: Re: [PATCH] exportfs: Deal with path's trailing "/" in unexportfs_parsed()
Date: Sat, 12 Dec 2015 07:12:50 -0500 [thread overview]
Message-ID: <566C0F42.1090207@RedHat.com> (raw)
In-Reply-To: <1449481577-19927-1-git-send-email-yoyang@redhat.com>
On 12/07/2015 04:46 AM, Yongcheng Yang wrote:
> From: Yongcheng Yang <yongcheng.yang@gmail.com>
>
> When unexport directory, it's possible that the specified path ends with
> a '/'. So we need to deal with it to find the matched entry.
>
> If not, there will be error like "Could not find '*:/some_path/' to unexport."
>
> Signed-off-by: Yongcheng Yang <yongcheng.yang@gmail.com>
Committed...
steved.
> ---
> utils/exportfs/exportfs.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index c7a79a6..a9151ff 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -405,8 +405,17 @@ unexportfs_parsed(char *hname, char *path, int verbose)
> hname = ai->ai_canonname;
> }
>
> + /*
> + * It's possible the specified path ends with a '/'. But
> + * the entry from exportlist won't has the trailing '/',
> + * so need to deal with it.
> + */
> + size_t nlen = strlen(path);
> + while (path[nlen - 1] == '/')
> + nlen--;
> +
> for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
> - if (path && strcmp(path, exp->m_export.e_path))
> + if (path && strncmp(path, exp->m_export.e_path, nlen))
> continue;
> if (htype != exp->m_client->m_type)
> continue;
>
prev parent reply other threads:[~2015-12-12 12:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 9:46 [PATCH] exportfs: Deal with path's trailing "/" in unexportfs_parsed() Yongcheng Yang
2015-12-12 12:12 ` Steve Dickson [this message]
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=566C0F42.1090207@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=yongcheng.yang@gmail.com \
--cc=yoyang@redhat.com \
/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