Skip to content

Commit 9e97198

Browse files
author
Jens Axboe
committed
splice: fix problem with atime not being updated
A bug report on nfsd that states that since it was switched to use splice instead of sendfile, the atime was no longer being updated on the input file. do_generic_mapping_read() does this when accessing the file, make splice do it for the direct splice handler. Signed-off-by: Jens Axboe <[email protected]>
1 parent 12f32bb commit 9e97198

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/splice.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,11 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
10311031
goto out_release;
10321032
}
10331033

1034+
done:
10341035
pipe->nrbufs = pipe->curbuf = 0;
1036+
if (bytes > 0)
1037+
file_accessed(in);
1038+
10351039
return bytes;
10361040

10371041
out_release:
@@ -1047,16 +1051,11 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
10471051
buf->ops = NULL;
10481052
}
10491053
}
1050-
pipe->nrbufs = pipe->curbuf = 0;
1051-
1052-
/*
1053-
* If we transferred some data, return the number of bytes:
1054-
*/
1055-
if (bytes > 0)
1056-
return bytes;
10571054

1058-
return ret;
1055+
if (!bytes)
1056+
bytes = ret;
10591057

1058+
goto done;
10601059
}
10611060
EXPORT_SYMBOL(splice_direct_to_actor);
10621061

0 commit comments

Comments
 (0)