diff mbox

[2/2] exportfs: do not warn if /etc/exports.d/ does not exist

Message ID 1314890192-11075-2-git-send-email-vapier@gentoo.org (mailing list archive)
State New, archived
Headers show

Commit Message

Mike Frysinger Sept. 1, 2011, 3:16 p.m. UTC
It isn't uncommon for /etc/exports.d/ to not exist, and imo, it's not
that big of a deal as often times, a simple /etc/exports is sufficient.
So silently skip the case where the dir is missing.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 utils/exportfs/exportfs.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Comments

Steve Dickson Sept. 1, 2011, 3:35 p.m. UTC | #1
On 09/01/2011 11:16 AM, Mike Frysinger wrote:
> It isn't uncommon for /etc/exports.d/ to not exist, and imo, it's not
> that big of a deal as often times, a simple /etc/exports is sufficient.
> So silently skip the case where the dir is missing.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Committed...

steved.

> ---
>  utils/exportfs/exportfs.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index 986a272..7432a65 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -529,9 +529,12 @@ export_d_read(const char *dname)
>  
>  
>  	n = scandir(dname, &namelist, NULL, versionsort);
> -	if (n < 0)
> +	if (n < 0) {
> +		if (errno == ENOENT)
> +			/* Silently return */
> +			return;
>  		xlog(L_NOTICE, "scandir %s: %s", dname, strerror(errno));
> -	else if (n == 0)
> +	} else if (n == 0)
>  		return;
>  
>  	for (i = 0; i < n; i++) {
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Masatake YAMATO Sept. 2, 2011, 12:40 a.m. UTC | #2
I've tried this issue in different way:)
Steve, could you see this bug?

      https://bugzilla.redhat.com/show_bug.cgi?id=697006

Masatake YAMATO


On Thu, 01 Sep 2011 11:35:56 -0400, Steve Dickson <SteveD@redhat.com> wrote
> 
> 
> On 09/01/2011 11:16 AM, Mike Frysinger wrote:
>> It isn't uncommon for /etc/exports.d/ to not exist, and imo, it's not
>> that big of a deal as often times, a simple /etc/exports is sufficient.
>> So silently skip the case where the dir is missing.
>> 
>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> Committed...
> 
> steved.
> 
>> ---
>>  utils/exportfs/exportfs.c |    7 +++++--
>>  1 files changed, 5 insertions(+), 2 deletions(-)
>> 
>> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
>> index 986a272..7432a65 100644
>> --- a/utils/exportfs/exportfs.c
>> +++ b/utils/exportfs/exportfs.c
>> @@ -529,9 +529,12 @@ export_d_read(const char *dname)
>>  
>>  
>>  	n = scandir(dname, &namelist, NULL, versionsort);
>> -	if (n < 0)
>> +	if (n < 0) {
>> +		if (errno == ENOENT)
>> +			/* Silently return */
>> +			return;
>>  		xlog(L_NOTICE, "scandir %s: %s", dname, strerror(errno));
>> -	else if (n == 0)
>> +	} else if (n == 0)
>>  		return;
>>  
>>  	for (i = 0; i < n; i++) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Steve Dickson Sept. 2, 2011, 8:52 p.m. UTC | #3
On 09/01/2011 08:40 PM, Masatake YAMATO wrote:
> I've tried this issue in different way:)
> Steve, could you see this bug?
> 
>       https://bugzilla.redhat.com/show_bug.cgi?id=697006
Fair enough....  but the patch in that bz is distro specific, 
means it would have no affect on other distros... With that
said, your patch is a good idea so I will added my todo list

steved.
> 
> Masatake YAMATO
> 
> 
> On Thu, 01 Sep 2011 11:35:56 -0400, Steve Dickson <SteveD@redhat.com> wrote
>>
>>
>> On 09/01/2011 11:16 AM, Mike Frysinger wrote:
>>> It isn't uncommon for /etc/exports.d/ to not exist, and imo, it's not
>>> that big of a deal as often times, a simple /etc/exports is sufficient.
>>> So silently skip the case where the dir is missing.
>>>
>>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>> Committed...
>>
>> steved.
>>
>>> ---
>>>  utils/exportfs/exportfs.c |    7 +++++--
>>>  1 files changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
>>> index 986a272..7432a65 100644
>>> --- a/utils/exportfs/exportfs.c
>>> +++ b/utils/exportfs/exportfs.c
>>> @@ -529,9 +529,12 @@ export_d_read(const char *dname)
>>>  
>>>  
>>>  	n = scandir(dname, &namelist, NULL, versionsort);
>>> -	if (n < 0)
>>> +	if (n < 0) {
>>> +		if (errno == ENOENT)
>>> +			/* Silently return */
>>> +			return;
>>>  		xlog(L_NOTICE, "scandir %s: %s", dname, strerror(errno));
>>> -	else if (n == 0)
>>> +	} else if (n == 0)
>>>  		return;
>>>  
>>>  	for (i = 0; i < n; i++) {
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 986a272..7432a65 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -529,9 +529,12 @@  export_d_read(const char *dname)
 
 
 	n = scandir(dname, &namelist, NULL, versionsort);
-	if (n < 0)
+	if (n < 0) {
+		if (errno == ENOENT)
+			/* Silently return */
+			return;
 		xlog(L_NOTICE, "scandir %s: %s", dname, strerror(errno));
-	else if (n == 0)
+	} else if (n == 0)
 		return;
 
 	for (i = 0; i < n; i++) {