All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Mi Jinlong <mijinlong@cn.fujitsu.com>,
	NFSv3 list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] mount: avoid po_destroy to modify errno what we really want
Date: Mon, 29 Nov 2010 10:20:50 -0500	[thread overview]
Message-ID: <4CF3C4D2.2060607@RedHat.com> (raw)
In-Reply-To: <9C08C339-281F-4CD4-B8C1-70441869E2F6@oracle.com>



On 11/29/2010 09:45 AM, Chuck Lever wrote:
> 
> On Nov 25, 2010, at 5:07 AM, Mi Jinlong wrote:
> 
>> We should return the errno that was set before po_destroy,
>> rather than the errno that was set at po_destroy.
>>
>> Because the po_destroy function don't affect the return value,
>> this patch just revert the saved errno after po_destroy.
> 
> The only library function used in po_destroy() is free(3).  
> Does free(3) change the value of errno?
Looking at the man page and taking a look a the 
glibc code it appears the answer is no. free(3)
does not set errno.

Bian, what was the problem you were seeing that this
patch fixed? 

steved.

> 
>> Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>
>> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>> ---
>> utils/mount/stropts.c |    8 ++++++--
>> 1 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
>> index 50a1a2a..d554877 100644
>> --- a/utils/mount/stropts.c
>> +++ b/utils/mount/stropts.c
>> @@ -592,7 +592,7 @@ static int nfs_do_mount_v3v2(struct nfsmount_info *mi,
>> 		struct sockaddr *sap, socklen_t salen)
>> {
>> 	struct mount_options *options = po_dup(mi->options);
>> -	int result = 0;
>> +	int result = 0, save = 0;
>>
>> 	if (!options) {
>> 		errno = ENOMEM;
>> @@ -637,7 +637,9 @@ static int nfs_do_mount_v3v2(struct nfsmount_info *mi,
>> 	result = nfs_sys_mount(mi, options);
>>
>> out_fail:
>> +	save = errno;
>> 	po_destroy(options);
>> +	errno = save;
>> 	return result;
>> }
>>
>> @@ -673,7 +675,7 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
>> 		struct sockaddr *sap, socklen_t salen)
>> {
>> 	struct mount_options *options = po_dup(mi->options);
>> -	int result = 0;
>> +	int result = 0, save = 0;
>>
>> 	if (!options) {
>> 		errno = ENOMEM;
>> @@ -724,7 +726,9 @@ static int nfs_do_mount_v4(struct nfsmount_info *mi,
>> 	result = nfs_sys_mount(mi, options);
>>
>> out_fail:
>> +	save = errno;
>> 	po_destroy(options);
>> +	errno = save;
>> 	return result;
>> }
>>
>> -- 
>> 1.7.3.2
>>
>>
>> --
>> 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
> 

  reply	other threads:[~2010-11-29 15:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 10:07 [PATCH] mount: avoid po_destroy to modify errno what we really want Mi Jinlong
2010-11-29 14:45 ` Chuck Lever
2010-11-29 15:20   ` Steve Dickson [this message]
2010-11-30  2:05     ` Bian Naimeng
2010-11-30 15:11       ` Chuck Lever
2010-12-01  1:01         ` Bian Naimeng

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=4CF3C4D2.2060607@RedHat.com \
    --to=steved@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mijinlong@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.