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

Merge tag 'nfs-for-5.9-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client bugfixes from Trond Myklebust:
"Highlights include:

- NFSv4.2: copy_file_range needs to invalidate caches on success

- NFSv4.2: Fix security label length not being reset

- pNFS/flexfiles: Ensure we initialise the mirror bsizes correctly
on read

- pNFS/flexfiles: Fix signed/unsigned type issues with mirror
indices"

* tag 'nfs-for-5.9-3' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
pNFS/flexfiles: Be consistent about mirror index types
pNFS/flexfiles: Ensure we initialise the mirror bsizes correctly on read
NFSv4.2: fix client's attribute cache management for copy_file_range
nfs: Fix security label length not being reset

+36 -24
+3
fs/nfs/dir.c
··· 579 579 xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE); 580 580 581 581 do { 582 + if (entry->label) 583 + entry->label->len = NFS4_MAXLABELLEN; 584 + 582 585 status = xdr_decode(desc, entry, &stream); 583 586 if (status != 0) { 584 587 if (status == -EAGAIN)
+22 -21
fs/nfs/flexfilelayout/flexfilelayout.c
··· 715 715 } 716 716 717 717 static void 718 - ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx) 718 + ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, u32 idx) 719 719 { 720 720 struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx); 721 721 ··· 724 724 } 725 725 726 726 static void 727 - ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx) 727 + ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, u32 idx) 728 728 { 729 729 struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx); 730 730 ··· 734 734 735 735 static struct nfs4_pnfs_ds * 736 736 ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg, 737 - int start_idx, int *best_idx, 737 + u32 start_idx, u32 *best_idx, 738 738 bool check_device) 739 739 { 740 740 struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); 741 741 struct nfs4_ff_layout_mirror *mirror; 742 742 struct nfs4_pnfs_ds *ds; 743 743 bool fail_return = false; 744 - int idx; 744 + u32 idx; 745 745 746 746 /* mirrors are initially sorted by efficiency */ 747 747 for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) { ··· 766 766 767 767 static struct nfs4_pnfs_ds * 768 768 ff_layout_choose_any_ds_for_read(struct pnfs_layout_segment *lseg, 769 - int start_idx, int *best_idx) 769 + u32 start_idx, u32 *best_idx) 770 770 { 771 771 return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, false); 772 772 } 773 773 774 774 static struct nfs4_pnfs_ds * 775 775 ff_layout_choose_valid_ds_for_read(struct pnfs_layout_segment *lseg, 776 - int start_idx, int *best_idx) 776 + u32 start_idx, u32 *best_idx) 777 777 { 778 778 return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, true); 779 779 } 780 780 781 781 static struct nfs4_pnfs_ds * 782 782 ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg, 783 - int start_idx, int *best_idx) 783 + u32 start_idx, u32 *best_idx) 784 784 { 785 785 struct nfs4_pnfs_ds *ds; 786 786 ··· 791 791 } 792 792 793 793 static struct nfs4_pnfs_ds * 794 - ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio, int *best_idx) 794 + ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio, 795 + u32 *best_idx) 795 796 { 796 797 struct pnfs_layout_segment *lseg = pgio->pg_lseg; 797 798 struct nfs4_pnfs_ds *ds; ··· 838 837 struct nfs_pgio_mirror *pgm; 839 838 struct nfs4_ff_layout_mirror *mirror; 840 839 struct nfs4_pnfs_ds *ds; 841 - int ds_idx; 840 + u32 ds_idx, i; 842 841 843 842 retry: 844 843 ff_layout_pg_check_layout(pgio, req); ··· 864 863 goto retry; 865 864 } 866 865 867 - mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); 866 + for (i = 0; i < pgio->pg_mirror_count; i++) { 867 + mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); 868 + pgm = &pgio->pg_mirrors[i]; 869 + pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; 870 + } 868 871 869 872 pgio->pg_mirror_idx = ds_idx; 870 - 871 - /* read always uses only one mirror - idx 0 for pgio layer */ 872 - pgm = &pgio->pg_mirrors[0]; 873 - pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; 874 873 875 874 if (NFS_SERVER(pgio->pg_inode)->flags & 876 875 (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR)) ··· 895 894 struct nfs4_ff_layout_mirror *mirror; 896 895 struct nfs_pgio_mirror *pgm; 897 896 struct nfs4_pnfs_ds *ds; 898 - int i; 897 + u32 i; 899 898 900 899 retry: 901 900 ff_layout_pg_check_layout(pgio, req); ··· 1039 1038 static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr) 1040 1039 { 1041 1040 u32 idx = hdr->pgio_mirror_idx + 1; 1042 - int new_idx = 0; 1041 + u32 new_idx = 0; 1043 1042 1044 1043 if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx + 1, &new_idx)) 1045 1044 ff_layout_send_layouterror(hdr->lseg); ··· 1076 1075 struct nfs4_state *state, 1077 1076 struct nfs_client *clp, 1078 1077 struct pnfs_layout_segment *lseg, 1079 - int idx) 1078 + u32 idx) 1080 1079 { 1081 1080 struct pnfs_layout_hdr *lo = lseg->pls_layout; 1082 1081 struct inode *inode = lo->plh_inode; ··· 1150 1149 /* Retry all errors through either pNFS or MDS except for -EJUKEBOX */ 1151 1150 static int ff_layout_async_handle_error_v3(struct rpc_task *task, 1152 1151 struct pnfs_layout_segment *lseg, 1153 - int idx) 1152 + u32 idx) 1154 1153 { 1155 1154 struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx); 1156 1155 ··· 1185 1184 struct nfs4_state *state, 1186 1185 struct nfs_client *clp, 1187 1186 struct pnfs_layout_segment *lseg, 1188 - int idx) 1187 + u32 idx) 1189 1188 { 1190 1189 int vers = clp->cl_nfs_mod->rpc_vers->number; 1191 1190 ··· 1212 1211 } 1213 1212 1214 1213 static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, 1215 - int idx, u64 offset, u64 length, 1214 + u32 idx, u64 offset, u64 length, 1216 1215 u32 *op_status, int opnum, int error) 1217 1216 { 1218 1217 struct nfs4_ff_layout_mirror *mirror; ··· 1810 1809 loff_t offset = hdr->args.offset; 1811 1810 int vers; 1812 1811 struct nfs_fh *fh; 1813 - int idx = hdr->pgio_mirror_idx; 1812 + u32 idx = hdr->pgio_mirror_idx; 1814 1813 1815 1814 mirror = FF_LAYOUT_COMP(lseg, idx); 1816 1815 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
+9 -1
fs/nfs/nfs42proc.c
··· 356 356 357 357 truncate_pagecache_range(dst_inode, pos_dst, 358 358 pos_dst + res->write_res.count); 359 - 359 + spin_lock(&dst_inode->i_lock); 360 + NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE | 361 + NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE | 362 + NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA); 363 + spin_unlock(&dst_inode->i_lock); 364 + spin_lock(&src_inode->i_lock); 365 + NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE | 366 + NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME); 367 + spin_unlock(&src_inode->i_lock); 360 368 status = res->write_res.count; 361 369 out: 362 370 if (args->sync)
+2 -2
include/linux/nfs_xdr.h
··· 1611 1611 __u64 mds_offset; /* Filelayout dense stripe */ 1612 1612 struct nfs_page_array page_array; 1613 1613 struct nfs_client *ds_clp; /* pNFS data server */ 1614 - int ds_commit_idx; /* ds index if ds_clp is set */ 1615 - int pgio_mirror_idx;/* mirror index in pgio layer */ 1614 + u32 ds_commit_idx; /* ds index if ds_clp is set */ 1615 + u32 pgio_mirror_idx;/* mirror index in pgio layer */ 1616 1616 }; 1617 1617 1618 1618 struct nfs_mds_commit_info {