Pull NFS client fixes from Anna Schumaker: - Fix /proc/PID/io read_bytes accounting - Fix setting NLM file_lock start and end during decoding testargs - Fix timing for setting access cache timestamps * tag 'nfs-for-6.3-2' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFS: Correct timing for assigning access cache timestamp lockd: set file_lock start and end when decoding nlm4 testargs NFS: Fix /proc/PID/io read_bytes for buffered reads
Unified · Split
| @@ -261,7 +261,6 @@ static int decode_nlm4_holder(struct xdr_stream *xdr, struct nlm_res *result) · 260 unmodified lines | ||
| 261 | 261 | u32 exclusive; |
| 262 | 262 | int error; |
| 263 | 263 | __be32 *p; |
| 264 | − s32 end; | |
| 265 | 264 | |
| 266 | 265 | memset(lock, 0, sizeof(*lock)); |
| 267 | 266 | locks_init_lock(fl); |
| @@ -285,13 +284,7 @@ static int decode_nlm4_holder(struct xdr_stream *xdr, struct nlm_res *result) · 17 unmodified lines | ||
| 285 | 284 | fl->fl_type = exclusive != 0 ? F_WRLCK : F_RDLCK; |
| 286 | 285 | p = xdr_decode_hyper(p, &l_offset); |
| 287 | 286 | xdr_decode_hyper(p, &l_len); |
| 288 | − end = l_offset + l_len - 1; | |
| 289 | − | |
| 290 | − fl->fl_start = (loff_t)l_offset; | |
| 291 | − if (l_len == 0 || end < 0) | |
| 292 | − fl->fl_end = OFFSET_MAX; | |
| 293 | − else | |
| 294 | − fl->fl_end = (loff_t)end; | |
| 287 | + nlm4svc_set_file_lock_range(fl, l_offset, l_len); | |
| 295 | 288 | error = 0; |
| 296 | 289 | out: |
| 297 | 290 | return error; |
| @@ -33,6 +33,17 @@ loff_t_to_s64(loff_t offset) · 32 unmodified lines | ||
| 33 | 33 | return res; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | +void nlm4svc_set_file_lock_range(struct file_lock *fl, u64 off, u64 len) | |
| 37 | +{ | |
| 38 | + s64 end = off + len - 1; | |
| 39 | + | |
| 40 | + fl->fl_start = off; | |
| 41 | + if (len == 0 || end < 0) | |
| 42 | + fl->fl_end = OFFSET_MAX; | |
| 43 | + else | |
| 44 | + fl->fl_end = end; | |
| 45 | +} | |
| 46 | + | |
| 36 | 47 | /* |
| 37 | 48 | * NLM file handles are defined by specification to be a variable-length |
| 38 | 49 | * XDR opaque no longer than 1024 bytes. However, this implementation |
| @@ -80,7 +91,7 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock) · 41 unmodified lines | ||
| 80 | 91 | locks_init_lock(fl); |
| 81 | 92 | fl->fl_flags = FL_POSIX; |
| 82 | 93 | fl->fl_type = F_RDLCK; |
| 83 | − | |
| 94 | + nlm4svc_set_file_lock_range(fl, lock->lock_start, lock->lock_len); | |
| 84 | 95 | return true; |
| 85 | 96 | } |
| 86 | 97 | |
| @@ -3089,7 +3089,6 @@ static void nfs_access_add_rbtree(struct inode *inode, · 3088 unmodified lines | ||
| 3089 | 3089 | else |
| 3090 | 3090 | goto found; |
| 3091 | 3091 | } |
| 3092 | − set->timestamp = ktime_get_ns(); | |
| 3093 | 3092 | rb_link_node(&set->rb_node, parent, p); |
| 3094 | 3093 | rb_insert_color(&set->rb_node, root_node); |
| 3095 | 3094 | list_add_tail(&set->lru, &nfsi->access_cache_entry_lru); |
| @@ -3114,6 +3113,7 @@ void nfs_access_add_cache(struct inode *inode, struct nfs_access_entry *set, · 18 unmodified lines | ||
| 3114 | 3113 | cache->fsgid = cred->fsgid; |
| 3115 | 3114 | cache->group_info = get_group_info(cred->group_info); |
| 3116 | 3115 | cache->mask = set->mask; |
| 3116 | + cache->timestamp = ktime_get_ns(); | |
| 3117 | 3117 | |
| 3118 | 3118 | /* The above field assignments must be visible |
| 3119 | 3119 | * before this item appears on the lru. We cannot easily |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/stat.h> |
| 16 | 16 | #include <linux/mm.h> |
| 17 | 17 | #include <linux/slab.h> |
| 18 | +#include <linux/task_io_accounting_ops.h> | |
| 18 | 19 | #include <linux/pagemap.h> |
| 19 | 20 | #include <linux/sunrpc/clnt.h> |
| 20 | 21 | #include <linux/nfs_fs.h> |
| @@ -337,6 +338,7 @@ int nfs_read_folio(struct file *file, struct folio *folio) · 316 unmodified lines | ||
| 337 | 338 | |
| 338 | 339 | trace_nfs_aop_readpage(inode, folio); |
| 339 | 340 | nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); |
| 341 | + task_io_account_read(folio_size(folio)); | |
| 340 | 342 | |
| 341 | 343 | /* |
| 342 | 344 | * Try to flush any pending writes to the file.. |
| @@ -393,6 +395,7 @@ void nfs_readahead(struct readahead_control *ractl) · 50 unmodified lines | ||
| 393 | 395 | |
| 394 | 396 | trace_nfs_aop_readahead(inode, readahead_pos(ractl), nr_pages); |
| 395 | 397 | nfs_inc_stats(inode, NFSIOS_VFSREADPAGES); |
| 398 | + task_io_account_read(readahead_length(ractl)); | |
| 396 | 399 | |
| 397 | 400 | ret = -ESTALE; |
| 398 | 401 | if (NFS_STALE(inode)) |
| @@ -22,6 +22,7 @@ · 21 unmodified lines | ||
| 22 | 22 | #define nlm4_fbig cpu_to_be32(NLM_FBIG) |
| 23 | 23 | #define nlm4_failed cpu_to_be32(NLM_FAILED) |
| 24 | 24 | |
| 25 | +void nlm4svc_set_file_lock_range(struct file_lock *fl, u64 off, u64 len); | |
| 25 | 26 | bool nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); |
| 26 | 27 | bool nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); |
| 27 | 28 | bool nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); |