All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Staubach <staubach@redhat.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-nfs@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/3] enhanced ESTALE error handling
Date: Fri, 18 Jan 2008 11:45:52 -0500	[thread overview]
Message-ID: <4790D7C0.30402@redhat.com> (raw)
In-Reply-To: <20080118161443.GB20490-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>

Matthew Wilcox wrote:
> On Fri, Jan 18, 2008 at 10:36:01AM -0500, Peter Staubach wrote:
>   
>> @@ -1025,12 +1027,27 @@ static int fastcall link_path_walk(const
>>  	mntget(save.mnt);
>>  
>>  	result = __link_path_walk(name, nd);
>> -	if (result == -ESTALE) {
>> +	while (result == -ESTALE) {
>> +		/*
>> +		 * If no progress was made looking up the pathname,
>> +		 * then stop and return ENOENT instead of ESTALE.
>> +		 */
>> +		if (nd->dentry == save.dentry) {
>> +			result = -ENOENT;
>> +			break;
>> +		}
>>  		*nd = save;
>>  		dget(nd->dentry);
>>  		mntget(nd->mnt);
>>  		nd->flags |= LOOKUP_REVAL;
>>  		result = __link_path_walk(name, nd);
>> +		/*
>> +		 * If no progress was made this time, then return
>> +		 * ENOENT instead of ESTALE because no recovery
>> +		 * is possible to recover the stale file handle.
>> +		 */
>> +		if (result == -ESTALE && nd->dentry == save.dentry)
>> +			result = -ENOENT;
>>  	}
>>  
>>  	dput(save.dentry);
>>     
>
> Why do you need both of these tests?  The first one should be enough,
> surely?
>
>   

Yes, good point.

>> @@ -1268,8 +1285,8 @@ int path_lookup_open(int dfd, const char
>>   * @create_mode: create intent flags
>>   */
>>  static int path_lookup_create(int dfd, const char *name,
>> -			      unsigned int lookup_flags, struct nameidata *nd,
>> -			      int open_flags, int create_mode)
>> +		unsigned int lookup_flags, struct nameidata *nd,
>> +		int open_flags, int create_mode)
>>     
>
> Gratuitous reformatting?
>
>   

Elimination of an overly long line?

>> @@ -1712,7 +1729,10 @@ int open_namei(int dfd, const char *path
>>  	int acc_mode, error;
>>  	struct path path;
>>  	struct dentry *dir;
>> -	int count = 0;
>> +	int count;
>> +
>> +top:
>> +	count = 0;
>>  
>>  	acc_mode = ACC_MODE(flag);
>>  
>> @@ -1739,7 +1759,8 @@ int open_namei(int dfd, const char *path
>>  	/*
>>  	 * Create - we need to know the parent.
>>  	 */
>> -	error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode);
>> +	error = path_lookup_create(dfd, pathname, LOOKUP_PARENT, nd,
>> +				flag, mode);
>>  	if (error)
>>  		return error;
>>  
>> @@ -1812,10 +1833,17 @@ ok:
>>  	return 0;
>>  
>>  exit_dput:
>> +	if (error == -ESTALE)
>> +		d_drop(path.dentry);
>>  	dput_path(&path, nd);
>>  exit:
>>  	if (!IS_ERR(nd->intent.open.file))
>>  		release_open_intent(nd);
>> +	if (error == -ESTALE) {
>> +		d_drop(nd->dentry);
>> +		path_release(nd);
>> +		goto top;
>> +	}
>>     
>
> I wonder if a tail-call might not work better here.

"Tail-call"?

    Thanx...

       ps

WARNING: multiple messages have this Message-ID (diff)
From: Peter Staubach <staubach@redhat.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-nfs@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/3] enhanced ESTALE error handling
Date: Fri, 18 Jan 2008 11:45:52 -0500	[thread overview]
Message-ID: <4790D7C0.30402@redhat.com> (raw)
In-Reply-To: <20080118161443.GB20490@parisc-linux.org>

Matthew Wilcox wrote:
> On Fri, Jan 18, 2008 at 10:36:01AM -0500, Peter Staubach wrote:
>   
>> @@ -1025,12 +1027,27 @@ static int fastcall link_path_walk(const
>>  	mntget(save.mnt);
>>  
>>  	result = __link_path_walk(name, nd);
>> -	if (result == -ESTALE) {
>> +	while (result == -ESTALE) {
>> +		/*
>> +		 * If no progress was made looking up the pathname,
>> +		 * then stop and return ENOENT instead of ESTALE.
>> +		 */
>> +		if (nd->dentry == save.dentry) {
>> +			result = -ENOENT;
>> +			break;
>> +		}
>>  		*nd = save;
>>  		dget(nd->dentry);
>>  		mntget(nd->mnt);
>>  		nd->flags |= LOOKUP_REVAL;
>>  		result = __link_path_walk(name, nd);
>> +		/*
>> +		 * If no progress was made this time, then return
>> +		 * ENOENT instead of ESTALE because no recovery
>> +		 * is possible to recover the stale file handle.
>> +		 */
>> +		if (result == -ESTALE && nd->dentry == save.dentry)
>> +			result = -ENOENT;
>>  	}
>>  
>>  	dput(save.dentry);
>>     
>
> Why do you need both of these tests?  The first one should be enough,
> surely?
>
>   

Yes, good point.

>> @@ -1268,8 +1285,8 @@ int path_lookup_open(int dfd, const char
>>   * @create_mode: create intent flags
>>   */
>>  static int path_lookup_create(int dfd, const char *name,
>> -			      unsigned int lookup_flags, struct nameidata *nd,
>> -			      int open_flags, int create_mode)
>> +		unsigned int lookup_flags, struct nameidata *nd,
>> +		int open_flags, int create_mode)
>>     
>
> Gratuitous reformatting?
>
>   

Elimination of an overly long line?

>> @@ -1712,7 +1729,10 @@ int open_namei(int dfd, const char *path
>>  	int acc_mode, error;
>>  	struct path path;
>>  	struct dentry *dir;
>> -	int count = 0;
>> +	int count;
>> +
>> +top:
>> +	count = 0;
>>  
>>  	acc_mode = ACC_MODE(flag);
>>  
>> @@ -1739,7 +1759,8 @@ int open_namei(int dfd, const char *path
>>  	/*
>>  	 * Create - we need to know the parent.
>>  	 */
>> -	error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode);
>> +	error = path_lookup_create(dfd, pathname, LOOKUP_PARENT, nd,
>> +				flag, mode);
>>  	if (error)
>>  		return error;
>>  
>> @@ -1812,10 +1833,17 @@ ok:
>>  	return 0;
>>  
>>  exit_dput:
>> +	if (error == -ESTALE)
>> +		d_drop(path.dentry);
>>  	dput_path(&path, nd);
>>  exit:
>>  	if (!IS_ERR(nd->intent.open.file))
>>  		release_open_intent(nd);
>> +	if (error == -ESTALE) {
>> +		d_drop(nd->dentry);
>> +		path_release(nd);
>> +		goto top;
>> +	}
>>     
>
> I wonder if a tail-call might not work better here.

"Tail-call"?

    Thanx...

       ps

WARNING: multiple messages have this Message-ID (diff)
From: Peter Staubach <staubach-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Trond Myklebust
	<trond.myklebust-41N18TsMXrtuMpJDpNschA@public.gmane.org>,
	linux-fsdevel
	<linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/3] enhanced ESTALE error handling
Date: Fri, 18 Jan 2008 11:45:52 -0500	[thread overview]
Message-ID: <4790D7C0.30402@redhat.com> (raw)
In-Reply-To: <20080118161443.GB20490-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>

Matthew Wilcox wrote:
> On Fri, Jan 18, 2008 at 10:36:01AM -0500, Peter Staubach wrote:
>   
>> @@ -1025,12 +1027,27 @@ static int fastcall link_path_walk(const
>>  	mntget(save.mnt);
>>  
>>  	result = __link_path_walk(name, nd);
>> -	if (result == -ESTALE) {
>> +	while (result == -ESTALE) {
>> +		/*
>> +		 * If no progress was made looking up the pathname,
>> +		 * then stop and return ENOENT instead of ESTALE.
>> +		 */
>> +		if (nd->dentry == save.dentry) {
>> +			result = -ENOENT;
>> +			break;
>> +		}
>>  		*nd = save;
>>  		dget(nd->dentry);
>>  		mntget(nd->mnt);
>>  		nd->flags |= LOOKUP_REVAL;
>>  		result = __link_path_walk(name, nd);
>> +		/*
>> +		 * If no progress was made this time, then return
>> +		 * ENOENT instead of ESTALE because no recovery
>> +		 * is possible to recover the stale file handle.
>> +		 */
>> +		if (result == -ESTALE && nd->dentry == save.dentry)
>> +			result = -ENOENT;
>>  	}
>>  
>>  	dput(save.dentry);
>>     
>
> Why do you need both of these tests?  The first one should be enough,
> surely?
>
>   

Yes, good point.

>> @@ -1268,8 +1285,8 @@ int path_lookup_open(int dfd, const char
>>   * @create_mode: create intent flags
>>   */
>>  static int path_lookup_create(int dfd, const char *name,
>> -			      unsigned int lookup_flags, struct nameidata *nd,
>> -			      int open_flags, int create_mode)
>> +		unsigned int lookup_flags, struct nameidata *nd,
>> +		int open_flags, int create_mode)
>>     
>
> Gratuitous reformatting?
>
>   

Elimination of an overly long line?

>> @@ -1712,7 +1729,10 @@ int open_namei(int dfd, const char *path
>>  	int acc_mode, error;
>>  	struct path path;
>>  	struct dentry *dir;
>> -	int count = 0;
>> +	int count;
>> +
>> +top:
>> +	count = 0;
>>  
>>  	acc_mode = ACC_MODE(flag);
>>  
>> @@ -1739,7 +1759,8 @@ int open_namei(int dfd, const char *path
>>  	/*
>>  	 * Create - we need to know the parent.
>>  	 */
>> -	error = path_lookup_create(dfd,pathname,LOOKUP_PARENT,nd,flag,mode);
>> +	error = path_lookup_create(dfd, pathname, LOOKUP_PARENT, nd,
>> +				flag, mode);
>>  	if (error)
>>  		return error;
>>  
>> @@ -1812,10 +1833,17 @@ ok:
>>  	return 0;
>>  
>>  exit_dput:
>> +	if (error == -ESTALE)
>> +		d_drop(path.dentry);
>>  	dput_path(&path, nd);
>>  exit:
>>  	if (!IS_ERR(nd->intent.open.file))
>>  		release_open_intent(nd);
>> +	if (error == -ESTALE) {
>> +		d_drop(nd->dentry);
>> +		path_release(nd);
>> +		goto top;
>> +	}
>>     
>
> I wonder if a tail-call might not work better here.

"Tail-call"?

    Thanx...

       ps
-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-01-18 16:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-18 15:36 [PATCH 1/3] enhanced ESTALE error handling Peter Staubach
2008-01-18 15:36 ` Peter Staubach
2008-01-18 16:14 ` Matthew Wilcox
     [not found]   ` <20080118161443.GB20490-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
2008-01-18 16:45     ` Peter Staubach [this message]
2008-01-18 16:45       ` Peter Staubach
2008-01-18 16:45       ` Peter Staubach
2008-01-18 17:18       ` J. Bruce Fields
2008-01-18 17:32         ` Peter Staubach
2008-02-01 20:57 ` [PATCH 1/3] enhanced lookup ESTALE error handling (v2) Peter Staubach
2008-03-10 20:23   ` [PATCH 1/3] enhanced lookup ESTALE error handling (v3) Peter Staubach
2008-03-10 20:23     ` Peter Staubach
2008-03-10 21:38     ` Andrew Morton
2008-03-10 21:38       ` Andrew Morton
2008-03-10 22:03       ` Miklos Szeredi
2008-03-10 22:03         ` Miklos Szeredi
     [not found]         ` <E1JYq5I-0000D9-8a-8f8m9JG5TPIdUIPVzhDTVZP2KDSNp7ea@public.gmane.org>
2008-03-10 22:19           ` Dave Hansen
2008-03-10 22:19             ` Dave Hansen
2008-03-10 22:19             ` Dave Hansen
     [not found]             ` <1205187584.8385.6.camel-FpcvD5N4B9G9xGwK5P7XA+TW4wlIGRCZ@public.gmane.org>
2008-03-11  4:12               ` Andrew Morton
2008-03-11  4:12                 ` Andrew Morton
2008-03-11  4:12                 ` Andrew Morton

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=4790D7C0.30402@redhat.com \
    --to=staubach@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=trond.myklebust@fys.uio.no \
    /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.