Linux NFS development
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Frank van Maarseveen <frankvm@frankvm.com>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Andre Majorel <aym-xunil-Bi/FLWfhfolQFI55V6+gNQ@public.gmane.org>,
	linux-nfs@vger.kernel.org
Subject: Re: atimes not updated over NFS
Date: Tue, 29 Jan 2008 20:51:55 +0100	[thread overview]
Message-ID: <20080129195155.GS15220@kernel.dk> (raw)
In-Reply-To: <20080129194508.GG28032@fieldses.org>

On Tue, Jan 29 2008, J. Bruce Fields wrote:
> On Tue, Jan 29, 2008 at 07:30:42PM +0100, Jens Axboe wrote:
> > On Tue, Jan 29 2008, J. Bruce Fields wrote:
> > > On Tue, Jan 29, 2008 at 09:34:02AM +0100, Jens Axboe wrote:
> > > > On Mon, Jan 28 2008, J. Bruce Fields wrote:
> > > > > On Mon, Jan 28, 2008 at 09:59:40PM -0500, bfields wrote:
> > > > > > On Tue, Jan 22, 2008 at 12:17:17PM -0500, bfields wrote:
> > > > > > > On Mon, Jan 21, 2008 at 04:09:25PM -0500, bfields wrote:
> > > > > > > > On Mon, Jan 21, 2008 at 10:02:30PM +0100, Frank van Maarseveen wrote:
> > > > > > > > > 2.6.22.10:
> > > > > > > > > 	t
> > > > > > > > > 	t + 2
> > > > > > > > > 	t + 2
> > > > > > > > > 
> > > > > > > > > (same behavior)
> > > > > > > > > 
> > > > > > > > > 2.6.23.12:
> > > > > > > > > 	t
> > > > > > > > > 	t
> > > > > > > > > 	t
> > > > > > > > > 
> > > > > > > > > definately not good. "cat" on the server updates atime again.
> > > > > > > > 
> > > > > > > > Yes, that looks like a server bug, and this:...
> > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Trying a different combination of kernels:
> > > > > > > > > 
> > > > > > > > > server 2.6.23.12, client 2.6.22.10:
> > > > > > > > > 	t
> > > > > > > > > 	t
> > > > > > > > > 	t
> > > > > > > > > 
> > > > > > > > > server 2.6.22.10, client 2.6.23.12:
> > > > > > > > > 	t
> > > > > > > > > 	t + 2
> > > > > > > > > 	t + 2
> > > > > > > > 
> > > > > > > > ...confirms that since the results appear to depend only on the server
> > > > > > > > version, not on the client version.
> > > > > > > 
> > > > > > > And I can confirm this here on 2.6.24-rc8 (+ a few patches).
> > > > > > > Unfortunately, I don't have any suggestion better right now than
> > > > > > > bisecting....
> > > > > > 
> > > > > > It looks like this happened in the switch from sendfile to sparse.
> > > > > 							     ^^^^^^
> > > > > 							err, splice
> > > > > 
> > > > > > Jens, any advice?  What happened was nfsd reads stopped updating the
> > > > > > atime after the following commit.
> > > > > 
> > > > > Erm, sorry, wrong commit--it's the following one that touches nfsd,
> > > > > below.
> > > > 
> > > > Probably because do_generic_mapping_read() does a file_accessed() on the
> > > > input file. Does this fixup current -git?
> > > 
> > > No, nfsd is calling splice_direct_to_actor(), not do_splice_direct().
> > 
> > Ah doh, this instead then. Should work for both types.
> > 
> > diff --git a/fs/splice.c b/fs/splice.c
> > index 0a0b79b..504a096 100644
> > --- a/fs/splice.c
> > +++ b/fs/splice.c
> > @@ -1052,8 +1052,10 @@ out_release:
> >  	/*
> >  	 * If we transferred some data, return the number of bytes:
> >  	 */
> > -	if (bytes > 0)
> > +	if (bytes > 0) {
> > +		file_accessed(in);
> >  		return bytes;
> > +	}
> >  
> >  	return ret;
> 
> Hm.  It's still missing a case.  I've confirmed that the following fixes
> the problem.  (Or maybe it would be better to have them "goto" a common
> out with the file_accessed() check?)

Indeed it is, insert standard disclaimer here on the evil of multiple
returns. So can we agree that this then fixes both cases?

diff --git a/fs/splice.c b/fs/splice.c
index 0a0b79b..1577a73 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1031,7 +1031,11 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 			goto out_release;
 	}
 
+done:
 	pipe->nrbufs = pipe->curbuf = 0;
+	if (bytes > 0)
+		file_accessed(in);
+
 	return bytes;
 
 out_release:
@@ -1047,16 +1051,11 @@ out_release:
 			buf->ops = NULL;
 		}
 	}
-	pipe->nrbufs = pipe->curbuf = 0;
-
-	/*
-	 * If we transferred some data, return the number of bytes:
-	 */
-	if (bytes > 0)
-		return bytes;
 
-	return ret;
+	if (!bytes)
+		bytes = ret;
 
+	goto done;
 }
 EXPORT_SYMBOL(splice_direct_to_actor);
 

-- 
Jens Axboe


  reply	other threads:[~2008-01-29 19:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 10:13 atimes not updated over NFS Andre Majorel
     [not found] ` <20080109101313.GG9212-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2008-01-09 15:27   ` Trond Myklebust
     [not found]     ` <1199892437.11141.2.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-09 22:37       ` Andre Majorel
     [not found]         ` <20080109223748.GH9212-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2008-01-09 23:23           ` Trond Myklebust
     [not found]             ` <1199920996.7638.3.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-09 23:31               ` Trond Myklebust
2008-01-09 23:51               ` Andre Majorel
     [not found]                 ` <20080109235153.GI9212-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2008-01-14  8:34                   ` Frank van Maarseveen
2008-01-14 15:43                     ` Trond Myklebust
     [not found]                       ` <1200325393.7470.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-14 17:51                         ` Frank van Maarseveen
2008-01-21 19:06                           ` J. Bruce Fields
2008-01-21 19:31                             ` Trond Myklebust
     [not found]                               ` <1200943865.25562.56.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-21 21:02                                 ` Frank van Maarseveen
2008-01-21 21:09                                   ` J. Bruce Fields
2008-01-22 17:17                                     ` J. Bruce Fields
2008-01-29  2:59                                       ` J. Bruce Fields
2008-01-29  4:14                                         ` J. Bruce Fields
2008-01-29  8:34                                           ` Jens Axboe
2008-01-29 18:27                                             ` J. Bruce Fields
2008-01-29 18:30                                               ` Jens Axboe
2008-01-29 19:45                                                 ` J. Bruce Fields
2008-01-29 19:51                                                   ` Jens Axboe [this message]
2008-01-29 20:09                                                     ` J. Bruce Fields
2008-01-29 20:12                                                       ` Jens Axboe
2008-01-29 20:37                                                 ` Andre Majorel
     [not found]                                                   ` <20080129203713.GS17213-956IwFboN44acnK+F/IuxqxOck334EZe@public.gmane.org>
2008-01-30 11:23                                                     ` Jens Axboe
2008-01-30 12:13                                                       ` Andre Majorel

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=20080129195155.GS15220@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=aym-xunil-Bi/FLWfhfolQFI55V6+gNQ@public.gmane.org \
    --cc=bfields@fieldses.org \
    --cc=frankvm@frankvm.com \
    --cc=linux-nfs@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox