Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pNFS/flexfiles: Fix layoutstat periodic reporting

Putting the periodicity timer in the mirror instances is causing
non-scalable reporting behaviour and missed reporting intervals.
When you recall layouts and/or implement client side mirroring, it
leads to consecutive reports with only a few ms between RPC calls.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Fixes: d0379a5d066a9 ("pNFS/flexfiles: Support server-supplied...")

+5 -5
+4 -4
fs/nfs/flexfilelayout/flexfilelayout.c
··· 37 37 if (ffl) { 38 38 INIT_LIST_HEAD(&ffl->error_list); 39 39 INIT_LIST_HEAD(&ffl->mirrors); 40 + ffl->last_report_time = ktime_get(); 40 41 return &ffl->generic_hdr; 41 42 } else 42 43 return NULL; ··· 641 640 { 642 641 static const ktime_t notime = {0}; 643 642 s64 report_interval = FF_LAYOUTSTATS_REPORT_INTERVAL; 643 + struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout); 644 644 645 645 nfs4_ff_start_busy_timer(&layoutstat->busy_timer, now); 646 646 if (ktime_equal(mirror->start_time, notime)) 647 647 mirror->start_time = now; 648 - if (ktime_equal(mirror->last_report_time, notime)) 649 - mirror->last_report_time = now; 650 648 if (mirror->report_interval != 0) 651 649 report_interval = (s64)mirror->report_interval * 1000LL; 652 650 else if (layoutstats_timer != 0) 653 651 report_interval = (s64)layoutstats_timer * 1000LL; 654 - if (ktime_to_ms(ktime_sub(now, mirror->last_report_time)) >= 652 + if (ktime_to_ms(ktime_sub(now, ffl->last_report_time)) >= 655 653 report_interval) { 656 - mirror->last_report_time = now; 654 + ffl->last_report_time = now; 657 655 return true; 658 656 } 659 657
+1 -1
fs/nfs/flexfilelayout/flexfilelayout.h
··· 84 84 struct nfs4_ff_layoutstat read_stat; 85 85 struct nfs4_ff_layoutstat write_stat; 86 86 ktime_t start_time; 87 - ktime_t last_report_time; 88 87 u32 report_interval; 89 88 }; 90 89 ··· 100 101 struct pnfs_ds_commit_info commit_info; 101 102 struct list_head mirrors; 102 103 struct list_head error_list; /* nfs4_ff_layout_ds_err */ 104 + ktime_t last_report_time; /* Layoutstat report times */ 103 105 }; 104 106 105 107 static inline struct nfs4_flexfile_layout *