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

Merge tag 'nfs-for-5.16-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

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

Features:
- NFSv4.1 can always retrieve and cache the ACCESS mode on OPEN
- Optimisations for READDIR and the 'ls -l' style workload
- Further replacements of dprintk() with tracepoints and other
tracing improvements
- Ensure we re-probe NFSv4 server capabilities when the user does a
"mount -o remount"

Bugfixes:
- Fix an Oops in pnfs_mark_request_commit()
- Fix up deadlocks in the commit code
- Fix regressions in NFSv2/v3 attribute revalidation due to the
change_attr_type optimisations
- Fix some dentry verifier races
- Fix some missing dentry verifier settings
- Fix a performance regression in nfs_set_open_stateid_locked()
- SUNRPC was sending multiple SYN calls when re-establishing a TCP
connection.
- Fix multiple NFSv4 issues due to missing sanity checking of server
return values
- Fix a potential Oops when FREE_STATEID races with an unmount

Cleanups:
- Clean up the labelled NFS code
- Remove unused header <linux/pnfs_osd_xdr.h>"

* tag 'nfs-for-5.16-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (84 commits)
NFSv4: Sanity check the parameters in nfs41_update_target_slotid()
NFS: Remove the nfs4_label argument from decode_getattr_*() functions
NFS: Remove the nfs4_label argument from nfs_setsecurity
NFS: Remove the nfs4_label argument from nfs_fhget()
NFS: Remove the nfs4_label argument from nfs_add_or_obtain()
NFS: Remove the nfs4_label argument from nfs_instantiate()
NFS: Remove the nfs4_label from the nfs_setattrres
NFS: Remove the nfs4_label from the nfs4_getattr_res
NFS: Remove the f_label from the nfs4_opendata and nfs_openres
NFS: Remove the nfs4_label from the nfs4_lookupp_res struct
NFS: Remove the label from the nfs4_lookup_res struct
NFS: Remove the nfs4_label from the nfs4_link_res struct
NFS: Remove the nfs4_label from the nfs4_create_res struct
NFS: Remove the nfs4_label from the nfs_entry struct
NFS: Create a new nfs_alloc_fattr_with_label() function
NFS: Always initialise fattr->label in nfs_fattr_alloc()
NFSv4.2: alloc_file_pseudo() takes an open flag, not an f_mode
NFS: Don't allocate nfs_fattr on the stack in __nfs42_ssc_open()
NFSv4: Remove unnecessary 'minor version' check
NFSv4: Fix potential Oops in decode_op_map()
...

+2012 -1815
-3
fs/lockd/clntproc.c
··· 794 794 goto retry_cancel; 795 795 } 796 796 797 - dprintk("lockd: cancel status %u (task %u)\n", 798 - status, task->tk_pid); 799 - 800 797 switch (status) { 801 798 case NLM_LCK_GRANTED: 802 799 case NLM_LCK_DENIED_GRACE_PERIOD:
-2
fs/lockd/svc4proc.c
··· 269 269 */ 270 270 static void nlm4svc_callback_exit(struct rpc_task *task, void *data) 271 271 { 272 - dprintk("lockd: %5u callback returned %d\n", task->tk_pid, 273 - -task->tk_status); 274 272 } 275 273 276 274 static void nlm4svc_callback_release(void *data)
-2
fs/lockd/svcproc.c
··· 301 301 */ 302 302 static void nlmsvc_callback_exit(struct rpc_task *task, void *data) 303 303 { 304 - dprintk("lockd: %5u callback returned %d\n", task->tk_pid, 305 - -task->tk_status); 306 304 } 307 305 308 306 void nlmsvc_release_call(struct nlm_rqst *call)
+3
fs/nfs/callback_proc.c
··· 739 739 kfree(copy); 740 740 spin_unlock(&cps->clp->cl_lock); 741 741 742 + trace_nfs4_cb_offload(&args->coa_fh, &args->coa_stateid, 743 + args->wr_count, args->error, 744 + args->wr_writeverf.committed); 742 745 return 0; 743 746 } 744 747 #endif /* CONFIG_NFS_V4_2 */
+27 -12
fs/nfs/client.c
··· 828 828 /* 829 829 * Probe filesystem information, including the FSID on v2/v3 830 830 */ 831 - int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fattr) 831 + static int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fattr *fattr) 832 832 { 833 833 struct nfs_fsinfo fsinfo; 834 834 struct nfs_client *clp = server->nfs_client; ··· 862 862 863 863 return 0; 864 864 } 865 - EXPORT_SYMBOL_GPL(nfs_probe_fsinfo); 865 + 866 + /* 867 + * Grab the destination's particulars, including lease expiry time. 868 + * 869 + * Returns zero if probe succeeded and retrieved FSID matches the FSID 870 + * we have cached. 871 + */ 872 + int nfs_probe_server(struct nfs_server *server, struct nfs_fh *mntfh) 873 + { 874 + struct nfs_fattr *fattr; 875 + int error; 876 + 877 + fattr = nfs_alloc_fattr(); 878 + if (fattr == NULL) 879 + return -ENOMEM; 880 + 881 + /* Sanity: the probe won't work if the destination server 882 + * does not recognize the migrated FH. */ 883 + error = nfs_probe_fsinfo(server, mntfh, fattr); 884 + 885 + nfs_free_fattr(fattr); 886 + return error; 887 + } 888 + EXPORT_SYMBOL_GPL(nfs_probe_server); 866 889 867 890 /* 868 891 * Copy useful information when duplicating a server record ··· 1048 1025 1049 1026 if (!(fattr->valid & NFS_ATTR_FATTR)) { 1050 1027 error = ctx->nfs_mod->rpc_ops->getattr(server, ctx->mntfh, 1051 - fattr, NULL, NULL); 1028 + fattr, NULL); 1052 1029 if (error < 0) { 1053 1030 dprintk("nfs_create_server: getattr error = %d\n", -error); 1054 1031 goto error; ··· 1081 1058 rpc_authflavor_t flavor) 1082 1059 { 1083 1060 struct nfs_server *server; 1084 - struct nfs_fattr *fattr_fsinfo; 1085 1061 int error; 1086 1062 1087 1063 server = nfs_alloc_server(); ··· 1088 1066 return ERR_PTR(-ENOMEM); 1089 1067 1090 1068 server->cred = get_cred(source->cred); 1091 - 1092 - error = -ENOMEM; 1093 - fattr_fsinfo = nfs_alloc_fattr(); 1094 - if (fattr_fsinfo == NULL) 1095 - goto out_free_server; 1096 1069 1097 1070 /* Copy data from the source */ 1098 1071 server->nfs_client = source->nfs_client; ··· 1104 1087 goto out_free_server; 1105 1088 1106 1089 /* probe the filesystem info for this server filesystem */ 1107 - error = nfs_probe_fsinfo(server, fh, fattr_fsinfo); 1090 + error = nfs_probe_server(server, fh); 1108 1091 if (error < 0) 1109 1092 goto out_free_server; 1110 1093 ··· 1118 1101 nfs_server_insert_lists(server); 1119 1102 server->mount_time = jiffies; 1120 1103 1121 - nfs_free_fattr(fattr_fsinfo); 1122 1104 return server; 1123 1105 1124 1106 out_free_server: 1125 - nfs_free_fattr(fattr_fsinfo); 1126 1107 nfs_free_server(server); 1127 1108 return ERR_PTR(error); 1128 1109 }
+6 -4
fs/nfs/delegation.c
··· 755 755 struct nfs_delegation *delegation; 756 756 757 757 delegation = nfs_start_delegation_return(nfsi); 758 - /* Synchronous recall of any application leases */ 759 - break_lease(inode, O_WRONLY | O_RDWR); 760 - nfs_wb_all(inode); 761 - if (delegation != NULL) 758 + if (delegation != NULL) { 759 + /* Synchronous recall of any application leases */ 760 + break_lease(inode, O_WRONLY | O_RDWR); 761 + if (S_ISREG(inode->i_mode)) 762 + nfs_wb_all(inode); 762 763 return nfs_end_delegation_return(inode, delegation, 1); 764 + } 763 765 return 0; 764 766 } 765 767
+58 -61
fs/nfs/dir.c
··· 78 78 ctx->attr_gencount = nfsi->attr_gencount; 79 79 ctx->dir_cookie = 0; 80 80 ctx->dup_cookie = 0; 81 + ctx->page_index = 0; 81 82 spin_lock(&dir->i_lock); 82 83 if (list_empty(&nfsi->open_files) && 83 84 (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER)) ··· 86 85 NFS_INO_INVALID_DATA | 87 86 NFS_INO_REVAL_FORCED); 88 87 list_add(&ctx->list, &nfsi->open_files); 88 + clear_bit(NFS_INO_FORCE_READDIR, &nfsi->flags); 89 89 spin_unlock(&dir->i_lock); 90 90 return ctx; 91 91 } ··· 413 411 static bool 414 412 nfs_readdir_inode_mapping_valid(struct nfs_inode *nfsi) 415 413 { 416 - if (nfsi->cache_validity & (NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA)) 414 + if (nfsi->cache_validity & (NFS_INO_INVALID_CHANGE | 415 + NFS_INO_INVALID_DATA)) 417 416 return false; 418 417 smp_rmb(); 419 418 return !test_bit(NFS_INO_INVALIDATING, &nfsi->flags); ··· 629 626 if (nfs_server_capable(dir, NFS_CAP_READDIRPLUS) && 630 627 !list_empty(&nfsi->open_files)) { 631 628 set_bit(NFS_INO_ADVISE_RDPLUS, &nfsi->flags); 632 - invalidate_mapping_pages(dir->i_mapping, 633 - nfsi->page_index + 1, -1); 629 + set_bit(NFS_INO_FORCE_READDIR, &nfsi->flags); 634 630 } 635 631 } 636 632 ··· 682 680 nfs_set_verifier(dentry, dir_verifier); 683 681 status = nfs_refresh_inode(d_inode(dentry), entry->fattr); 684 682 if (!status) 685 - nfs_setsecurity(d_inode(dentry), entry->fattr, entry->label); 683 + nfs_setsecurity(d_inode(dentry), entry->fattr); 686 684 goto out; 687 685 } else { 688 686 d_invalidate(dentry); ··· 696 694 goto out; 697 695 } 698 696 699 - inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr, entry->label); 697 + inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr); 700 698 alias = d_splice_alias(inode, dentry); 701 699 d_lookup_done(dentry); 702 700 if (alias) { ··· 732 730 xdr_set_scratch_page(&stream, scratch); 733 731 734 732 do { 735 - if (entry->label) 736 - entry->label->len = NFS4_MAXLABELLEN; 733 + if (entry->fattr->label) 734 + entry->fattr->label->len = NFS4_MAXLABELLEN; 737 735 738 736 status = xdr_decode(desc, entry, &stream); 739 737 if (status != 0) ··· 838 836 return -ENOMEM; 839 837 entry->cookie = nfs_readdir_page_last_cookie(page); 840 838 entry->fh = nfs_alloc_fhandle(); 841 - entry->fattr = nfs_alloc_fattr(); 839 + entry->fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); 842 840 entry->server = NFS_SERVER(inode); 843 841 if (entry->fh == NULL || entry->fattr == NULL) 844 842 goto out; 845 843 846 - entry->label = nfs4_label_alloc(NFS_SERVER(inode), GFP_NOWAIT); 847 - if (IS_ERR(entry->label)) { 848 - status = PTR_ERR(entry->label); 849 - goto out; 850 - } 851 - 852 844 array_size = (dtsize + PAGE_SIZE - 1) >> PAGE_SHIFT; 853 845 pages = nfs_readdir_alloc_pages(array_size); 854 846 if (!pages) 855 - goto out_release_label; 847 + goto out; 856 848 857 849 do { 858 850 unsigned int pglen; ··· 869 873 } while (!status && nfs_readdir_page_needs_filling(page)); 870 874 871 875 nfs_readdir_free_pages(pages, array_size); 872 - out_release_label: 873 - nfs4_label_free(entry->label); 874 876 out: 875 877 nfs_free_fattr(entry->fattr); 876 878 nfs_free_fhandle(entry->fh); ··· 931 937 sizeof(nfsi->cookieverf)); 932 938 } 933 939 res = nfs_readdir_search_array(desc); 934 - if (res == 0) { 935 - nfsi->page_index = desc->page_index; 940 + if (res == 0) 936 941 return 0; 937 - } 938 942 nfs_readdir_page_unlock_and_put_cached(desc); 939 943 return res; 940 944 } ··· 1071 1079 struct nfs_inode *nfsi = NFS_I(inode); 1072 1080 struct nfs_open_dir_context *dir_ctx = file->private_data; 1073 1081 struct nfs_readdir_descriptor *desc; 1082 + pgoff_t page_index; 1074 1083 int res; 1075 1084 1076 1085 dfprintk(FILE, "NFS: readdir(%pD2) starting at cookie %llu\n", ··· 1102 1109 desc->dir_cookie = dir_ctx->dir_cookie; 1103 1110 desc->dup_cookie = dir_ctx->dup_cookie; 1104 1111 desc->duped = dir_ctx->duped; 1112 + page_index = dir_ctx->page_index; 1105 1113 desc->attr_gencount = dir_ctx->attr_gencount; 1106 1114 memcpy(desc->verf, dir_ctx->verf, sizeof(desc->verf)); 1107 1115 spin_unlock(&file->f_lock); 1116 + 1117 + if (test_and_clear_bit(NFS_INO_FORCE_READDIR, &nfsi->flags) && 1118 + list_is_singular(&nfsi->open_files)) 1119 + invalidate_mapping_pages(inode->i_mapping, page_index + 1, -1); 1108 1120 1109 1121 do { 1110 1122 res = readdir_search_pagecache(desc); ··· 1147 1149 dir_ctx->dup_cookie = desc->dup_cookie; 1148 1150 dir_ctx->duped = desc->duped; 1149 1151 dir_ctx->attr_gencount = desc->attr_gencount; 1152 + dir_ctx->page_index = desc->page_index; 1150 1153 memcpy(dir_ctx->verf, desc->verf, sizeof(dir_ctx->verf)); 1151 1154 spin_unlock(&file->f_lock); 1152 1155 ··· 1268 1269 static void nfs_set_verifier_locked(struct dentry *dentry, unsigned long verf) 1269 1270 { 1270 1271 struct inode *inode = d_inode(dentry); 1272 + struct inode *dir = d_inode(dentry->d_parent); 1271 1273 1272 - if (!nfs_verifier_is_delegated(dentry) && 1273 - !nfs_verify_change_attribute(d_inode(dentry->d_parent), verf)) 1274 - goto out; 1274 + if (!nfs_verify_change_attribute(dir, verf)) 1275 + return; 1275 1276 if (inode && NFS_PROTO(inode)->have_delegation(inode, FMODE_READ)) 1276 1277 nfs_set_verifier_delegated(&verf); 1277 - out: 1278 1278 dentry->d_time = verf; 1279 1279 } 1280 1280 ··· 1411 1413 static void nfs_mark_dir_for_revalidate(struct inode *inode) 1412 1414 { 1413 1415 spin_lock(&inode->i_lock); 1414 - nfs_set_cache_invalid(inode, NFS_INO_REVAL_PAGECACHE); 1416 + nfs_set_cache_invalid(inode, NFS_INO_INVALID_CHANGE); 1415 1417 spin_unlock(&inode->i_lock); 1416 1418 } 1417 1419 ··· 1493 1495 { 1494 1496 struct nfs_fh *fhandle; 1495 1497 struct nfs_fattr *fattr; 1496 - struct nfs4_label *label; 1497 1498 unsigned long dir_verifier; 1498 1499 int ret; 1499 1500 1500 1501 ret = -ENOMEM; 1501 1502 fhandle = nfs_alloc_fhandle(); 1502 - fattr = nfs_alloc_fattr(); 1503 - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); 1504 - if (fhandle == NULL || fattr == NULL || IS_ERR(label)) 1503 + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); 1504 + if (fhandle == NULL || fattr == NULL) 1505 1505 goto out; 1506 1506 1507 1507 dir_verifier = nfs_save_change_attribute(dir); 1508 - ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label); 1508 + ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); 1509 1509 if (ret < 0) { 1510 1510 switch (ret) { 1511 1511 case -ESTALE: ··· 1522 1526 if (nfs_refresh_inode(inode, fattr) < 0) 1523 1527 goto out; 1524 1528 1525 - nfs_setsecurity(inode, fattr, label); 1529 + nfs_setsecurity(inode, fattr); 1526 1530 nfs_set_verifier(dentry, dir_verifier); 1527 1531 1528 1532 /* set a readdirplus hint that we had a cache miss */ ··· 1531 1535 out: 1532 1536 nfs_free_fattr(fattr); 1533 1537 nfs_free_fhandle(fhandle); 1534 - nfs4_label_free(label); 1535 1538 1536 1539 /* 1537 1540 * If the lookup failed despite the dentry change attribute being ··· 1716 1721 */ 1717 1722 static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) 1718 1723 { 1719 - if (S_ISDIR(inode->i_mode)) 1720 - /* drop any readdir cache as it could easily be old */ 1721 - nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); 1722 - 1723 1724 if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { 1724 1725 nfs_complete_unlink(dentry, inode); 1725 1726 nfs_drop_nlink(inode); ··· 1750 1759 struct inode *inode = NULL; 1751 1760 struct nfs_fh *fhandle = NULL; 1752 1761 struct nfs_fattr *fattr = NULL; 1753 - struct nfs4_label *label = NULL; 1754 1762 unsigned long dir_verifier; 1755 1763 int error; 1756 1764 ··· 1768 1778 1769 1779 res = ERR_PTR(-ENOMEM); 1770 1780 fhandle = nfs_alloc_fhandle(); 1771 - fattr = nfs_alloc_fattr(); 1781 + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(dir)); 1772 1782 if (fhandle == NULL || fattr == NULL) 1773 - goto out; 1774 - 1775 - label = nfs4_label_alloc(NFS_SERVER(dir), GFP_NOWAIT); 1776 - if (IS_ERR(label)) 1777 1783 goto out; 1778 1784 1779 1785 dir_verifier = nfs_save_change_attribute(dir); 1780 1786 trace_nfs_lookup_enter(dir, dentry, flags); 1781 - error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, label); 1787 + error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); 1782 1788 if (error == -ENOENT) 1783 1789 goto no_entry; 1784 1790 if (error < 0) { 1785 1791 res = ERR_PTR(error); 1786 - goto out_label; 1792 + goto out; 1787 1793 } 1788 - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); 1794 + inode = nfs_fhget(dentry->d_sb, fhandle, fattr); 1789 1795 res = ERR_CAST(inode); 1790 1796 if (IS_ERR(res)) 1791 - goto out_label; 1797 + goto out; 1792 1798 1793 1799 /* Notify readdir to use READDIRPLUS */ 1794 1800 nfs_force_use_readdirplus(dir); ··· 1793 1807 res = d_splice_alias(inode, dentry); 1794 1808 if (res != NULL) { 1795 1809 if (IS_ERR(res)) 1796 - goto out_label; 1810 + goto out; 1797 1811 dentry = res; 1798 1812 } 1799 1813 nfs_set_verifier(dentry, dir_verifier); 1800 - out_label: 1801 - trace_nfs_lookup_exit(dir, dentry, flags, error); 1802 - nfs4_label_free(label); 1803 1814 out: 1815 + trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res)); 1804 1816 nfs_free_fattr(fattr); 1805 1817 nfs_free_fhandle(fhandle); 1806 1818 return res; ··· 2035 2051 2036 2052 struct dentry * 2037 2053 nfs_add_or_obtain(struct dentry *dentry, struct nfs_fh *fhandle, 2038 - struct nfs_fattr *fattr, 2039 - struct nfs4_label *label) 2054 + struct nfs_fattr *fattr) 2040 2055 { 2041 2056 struct dentry *parent = dget_parent(dentry); 2042 2057 struct inode *dir = d_inode(parent); ··· 2046 2063 d_drop(dentry); 2047 2064 2048 2065 if (fhandle->size == 0) { 2049 - error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr, NULL); 2066 + error = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr); 2050 2067 if (error) 2051 2068 goto out_error; 2052 2069 } ··· 2054 2071 if (!(fattr->valid & NFS_ATTR_FATTR)) { 2055 2072 struct nfs_server *server = NFS_SB(dentry->d_sb); 2056 2073 error = server->nfs_client->rpc_ops->getattr(server, fhandle, 2057 - fattr, NULL, NULL); 2074 + fattr, NULL); 2058 2075 if (error < 0) 2059 2076 goto out_error; 2060 2077 } 2061 - inode = nfs_fhget(dentry->d_sb, fhandle, fattr, label); 2078 + inode = nfs_fhget(dentry->d_sb, fhandle, fattr); 2062 2079 d = d_splice_alias(inode, dentry); 2063 2080 out: 2064 2081 dput(parent); ··· 2073 2090 * Code common to create, mkdir, and mknod. 2074 2091 */ 2075 2092 int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, 2076 - struct nfs_fattr *fattr, 2077 - struct nfs4_label *label) 2093 + struct nfs_fattr *fattr) 2078 2094 { 2079 2095 struct dentry *d; 2080 2096 2081 - d = nfs_add_or_obtain(dentry, fhandle, fattr, label); 2097 + d = nfs_add_or_obtain(dentry, fhandle, fattr); 2082 2098 if (IS_ERR(d)) 2083 2099 return PTR_ERR(d); 2084 2100 ··· 2179 2197 d_delete(dentry); 2180 2198 } 2181 2199 2200 + static void nfs_dentry_remove_handle_error(struct inode *dir, 2201 + struct dentry *dentry, int error) 2202 + { 2203 + switch (error) { 2204 + case -ENOENT: 2205 + d_delete(dentry); 2206 + fallthrough; 2207 + case 0: 2208 + nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 2209 + } 2210 + } 2211 + 2182 2212 int nfs_rmdir(struct inode *dir, struct dentry *dentry) 2183 2213 { 2184 2214 int error; ··· 2213 2219 up_write(&NFS_I(d_inode(dentry))->rmdir_sem); 2214 2220 } else 2215 2221 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); 2222 + nfs_dentry_remove_handle_error(dir, dentry, error); 2216 2223 trace_nfs_rmdir_exit(dir, dentry, error); 2217 2224 2218 2225 return error; ··· 2283 2288 } 2284 2289 spin_unlock(&dentry->d_lock); 2285 2290 error = nfs_safe_remove(dentry); 2286 - if (!error || error == -ENOENT) { 2287 - nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 2288 - } else if (need_rehash) 2291 + nfs_dentry_remove_handle_error(dir, dentry, error); 2292 + if (need_rehash) 2289 2293 d_rehash(dentry); 2290 2294 out: 2291 2295 trace_nfs_unlink_exit(dir, dentry, error); ··· 2346 2352 return error; 2347 2353 } 2348 2354 2355 + nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 2356 + 2349 2357 /* 2350 2358 * No big deal if we can't add this page to the page cache here. 2351 2359 * READLINK will get the missing page from the server if needed. ··· 2381 2385 d_drop(dentry); 2382 2386 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); 2383 2387 if (error == 0) { 2388 + nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 2384 2389 ihold(inode); 2385 2390 d_add(dentry, inode); 2386 2391 }
+1 -1
fs/nfs/direct.c
··· 620 620 nfs_unlock_and_release_request(req); 621 621 } 622 622 623 - if (atomic_dec_and_test(&cinfo.mds->rpcs_out)) 623 + if (nfs_commit_end(cinfo.mds)) 624 624 nfs_direct_write_complete(dreq); 625 625 } 626 626
+13 -35
fs/nfs/export.c
··· 64 64 nfs_fh_to_dentry(struct super_block *sb, struct fid *fid, 65 65 int fh_len, int fh_type) 66 66 { 67 - struct nfs4_label *label = NULL; 68 67 struct nfs_fattr *fattr = NULL; 69 68 struct nfs_fh *server_fh = nfs_exp_embedfh(fid->raw); 70 69 size_t fh_size = offsetof(struct nfs_fh, data) + server_fh->size; ··· 78 79 if (fh_len < len || fh_type != len) 79 80 return NULL; 80 81 81 - fattr = nfs_alloc_fattr(); 82 + fattr = nfs_alloc_fattr_with_label(NFS_SB(sb)); 82 83 if (fattr == NULL) { 83 84 dentry = ERR_PTR(-ENOMEM); 84 85 goto out; ··· 94 95 if (inode) 95 96 goto out_found; 96 97 97 - label = nfs4_label_alloc(NFS_SB(sb), GFP_KERNEL); 98 - if (IS_ERR(label)) { 99 - dentry = ERR_CAST(label); 100 - goto out_free_fattr; 101 - } 102 - 103 98 rpc_ops = NFS_SB(sb)->nfs_client->rpc_ops; 104 - ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, label, NULL); 99 + ret = rpc_ops->getattr(NFS_SB(sb), server_fh, fattr, NULL); 105 100 if (ret) { 106 101 dprintk("%s: getattr failed %d\n", __func__, ret); 107 102 trace_nfs_fh_to_dentry(sb, server_fh, fattr->fileid, ret); 108 103 dentry = ERR_PTR(ret); 109 - goto out_free_label; 104 + goto out_free_fattr; 110 105 } 111 106 112 - inode = nfs_fhget(sb, server_fh, fattr, label); 107 + inode = nfs_fhget(sb, server_fh, fattr); 113 108 114 109 out_found: 115 110 dentry = d_obtain_alias(inode); 116 - 117 - out_free_label: 118 - nfs4_label_free(label); 119 111 out_free_fattr: 120 112 nfs_free_fattr(fattr); 121 113 out: ··· 121 131 struct super_block *sb = inode->i_sb; 122 132 struct nfs_server *server = NFS_SB(sb); 123 133 struct nfs_fattr *fattr = NULL; 124 - struct nfs4_label *label = NULL; 125 134 struct dentry *parent; 126 135 struct nfs_rpc_ops const *ops = server->nfs_client->rpc_ops; 127 136 struct nfs_fh fh; ··· 128 139 if (!ops->lookupp) 129 140 return ERR_PTR(-EACCES); 130 141 131 - fattr = nfs_alloc_fattr(); 132 - if (fattr == NULL) { 133 - parent = ERR_PTR(-ENOMEM); 142 + fattr = nfs_alloc_fattr_with_label(server); 143 + if (fattr == NULL) 144 + return ERR_PTR(-ENOMEM); 145 + 146 + ret = ops->lookupp(inode, &fh, fattr); 147 + if (ret) { 148 + parent = ERR_PTR(ret); 134 149 goto out; 135 150 } 136 151 137 - label = nfs4_label_alloc(server, GFP_KERNEL); 138 - if (IS_ERR(label)) { 139 - parent = ERR_CAST(label); 140 - goto out_free_fattr; 141 - } 142 - 143 - ret = ops->lookupp(inode, &fh, fattr, label); 144 - if (ret) { 145 - parent = ERR_PTR(ret); 146 - goto out_free_label; 147 - } 148 - 149 - pinode = nfs_fhget(sb, &fh, fattr, label); 152 + pinode = nfs_fhget(sb, &fh, fattr); 150 153 parent = d_obtain_alias(pinode); 151 - out_free_label: 152 - nfs4_label_free(label); 153 - out_free_fattr: 154 - nfs_free_fattr(fattr); 155 154 out: 155 + nfs_free_fattr(fattr); 156 156 return parent; 157 157 } 158 158
-2
fs/nfs/filelayout/filelayout.c
··· 293 293 { 294 294 struct nfs_pgio_header *hdr = data; 295 295 296 - dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status); 297 - 298 296 if (test_bit(NFS_IOHDR_REDO, &hdr->flags) && 299 297 task->tk_status == 0) { 300 298 nfs41_sequence_done(task, &hdr->res.seq_res);
-2
fs/nfs/flexfilelayout/flexfilelayout.c
··· 1414 1414 { 1415 1415 struct nfs_pgio_header *hdr = data; 1416 1416 1417 - dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status); 1418 - 1419 1417 if (test_bit(NFS_IOHDR_REDO, &hdr->flags) && 1420 1418 task->tk_status == 0) { 1421 1419 nfs4_sequence_done(task, &hdr->res.seq_res);
+2 -2
fs/nfs/flexfilelayout/flexfilelayoutdev.c
··· 378 378 goto noconnect; 379 379 380 380 ds = mirror->mirror_ds->ds; 381 + if (READ_ONCE(ds->ds_clp)) 382 + goto out; 381 383 /* matching smp_wmb() in _nfs4_pnfs_v3/4_ds_connect */ 382 384 smp_rmb(); 383 - if (ds->ds_clp) 384 - goto out; 385 385 386 386 /* FIXME: For now we assume the server sent only one version of NFS 387 387 * to use for the DS.
+8 -13
fs/nfs/getroot.c
··· 80 80 goto out; 81 81 82 82 /* get the actual root for this mount */ 83 - fsinfo.fattr = nfs_alloc_fattr(); 83 + fsinfo.fattr = nfs_alloc_fattr_with_label(server); 84 84 if (fsinfo.fattr == NULL) 85 85 goto out_name; 86 86 87 - fsinfo.fattr->label = nfs4_label_alloc(server, GFP_KERNEL); 88 - if (IS_ERR(fsinfo.fattr->label)) 89 - goto out_fattr; 90 87 error = server->nfs_client->rpc_ops->getroot(server, ctx->mntfh, &fsinfo); 91 88 if (error < 0) { 92 89 dprintk("nfs_get_root: getattr error = %d\n", -error); 93 90 nfs_errorf(fc, "NFS: Couldn't getattr on root"); 94 - goto out_label; 91 + goto out_fattr; 95 92 } 96 93 97 - inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr, NULL); 94 + inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr); 98 95 if (IS_ERR(inode)) { 99 96 dprintk("nfs_get_root: get root inode failed\n"); 100 97 error = PTR_ERR(inode); 101 98 nfs_errorf(fc, "NFS: Couldn't get root inode"); 102 - goto out_label; 99 + goto out_fattr; 103 100 } 104 101 105 102 error = nfs_superblock_set_dummy_root(s, inode); 106 103 if (error != 0) 107 - goto out_label; 104 + goto out_fattr; 108 105 109 106 /* root dentries normally start off anonymous and get spliced in later 110 107 * if the dentry tree reaches them; however if the dentry already ··· 112 115 dprintk("nfs_get_root: get root dentry failed\n"); 113 116 error = PTR_ERR(root); 114 117 nfs_errorf(fc, "NFS: Couldn't get root dentry"); 115 - goto out_label; 118 + goto out_fattr; 116 119 } 117 120 118 121 security_d_instantiate(root, inode); ··· 148 151 !(kflags_out & SECURITY_LSM_NATIVE_LABELS)) 149 152 server->caps &= ~NFS_CAP_SECURITY_LABEL; 150 153 151 - nfs_setsecurity(inode, fsinfo.fattr, fsinfo.fattr->label); 154 + nfs_setsecurity(inode, fsinfo.fattr); 152 155 error = 0; 153 156 154 - out_label: 155 - nfs4_label_free(fsinfo.fattr->label); 156 157 out_fattr: 157 158 nfs_free_fattr(fsinfo.fattr); 158 159 out_name: ··· 160 165 error_splat_root: 161 166 dput(fc->root); 162 167 fc->root = NULL; 163 - goto out_label; 168 + goto out_fattr; 164 169 }
+71 -59
fs/nfs/inode.c
··· 210 210 flags &= ~NFS_INO_INVALID_XATTR; 211 211 if (flags & NFS_INO_INVALID_DATA) 212 212 nfs_fscache_invalidate(inode); 213 - if (inode->i_mapping->nrpages == 0) 214 - flags &= ~(NFS_INO_INVALID_DATA|NFS_INO_DATA_INVAL_DEFER); 215 213 flags &= ~(NFS_INO_REVAL_PAGECACHE | NFS_INO_REVAL_FORCED); 214 + 216 215 nfsi->cache_validity |= flags; 216 + 217 + if (inode->i_mapping->nrpages == 0) 218 + nfsi->cache_validity &= ~(NFS_INO_INVALID_DATA | 219 + NFS_INO_DATA_INVAL_DEFER); 220 + else if (nfsi->cache_validity & NFS_INO_INVALID_DATA) 221 + nfsi->cache_validity &= ~NFS_INO_DATA_INVAL_DEFER; 217 222 } 218 223 EXPORT_SYMBOL_GPL(nfs_set_cache_invalid); 219 224 ··· 355 350 spin_unlock(&inode->i_lock); 356 351 } 357 352 358 - void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, 359 - struct nfs4_label *label) 353 + void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr) 360 354 { 361 355 int error; 362 356 363 - if (label == NULL) 357 + if (fattr->label == NULL) 364 358 return; 365 359 366 360 if ((fattr->valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL) && inode->i_security) { 367 - error = security_inode_notifysecctx(inode, label->label, 368 - label->len); 361 + error = security_inode_notifysecctx(inode, fattr->label->label, 362 + fattr->label->len); 369 363 if (error) 370 364 printk(KERN_ERR "%s() %s %d " 371 365 "security_inode_notifysecctx() %d\n", 372 366 __func__, 373 - (char *)label->label, 374 - label->len, error); 367 + (char *)fattr->label->label, 368 + fattr->label->len, error); 375 369 nfs_clear_label_invalid(inode); 376 370 } 377 371 } 378 372 379 373 struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) 380 374 { 381 - struct nfs4_label *label = NULL; 382 - int minor_version = server->nfs_client->cl_minorversion; 383 - 384 - if (minor_version < 2) 385 - return label; 375 + struct nfs4_label *label; 386 376 387 377 if (!(server->caps & NFS_CAP_SECURITY_LABEL)) 388 - return label; 378 + return NULL; 389 379 390 380 label = kzalloc(sizeof(struct nfs4_label), flags); 391 381 if (label == NULL) ··· 397 397 } 398 398 EXPORT_SYMBOL_GPL(nfs4_label_alloc); 399 399 #else 400 - void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, 401 - struct nfs4_label *label) 400 + void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr) 402 401 { 403 402 } 404 403 #endif ··· 425 426 return inode; 426 427 } 427 428 429 + static void nfs_inode_init_regular(struct nfs_inode *nfsi) 430 + { 431 + atomic_long_set(&nfsi->nrequests, 0); 432 + INIT_LIST_HEAD(&nfsi->commit_info.list); 433 + atomic_long_set(&nfsi->commit_info.ncommit, 0); 434 + atomic_set(&nfsi->commit_info.rpcs_out, 0); 435 + mutex_init(&nfsi->commit_mutex); 436 + } 437 + 438 + static void nfs_inode_init_dir(struct nfs_inode *nfsi) 439 + { 440 + nfsi->cache_change_attribute = 0; 441 + memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 442 + init_rwsem(&nfsi->rmdir_sem); 443 + } 444 + 428 445 /* 429 446 * This is our front-end to iget that looks up inodes by file handle 430 447 * instead of inode number. 431 448 */ 432 449 struct inode * 433 - nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, struct nfs4_label *label) 450 + nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) 434 451 { 435 452 struct nfs_find_desc desc = { 436 453 .fh = fh, ··· 495 480 if (S_ISREG(inode->i_mode)) { 496 481 inode->i_fop = NFS_SB(sb)->nfs_client->rpc_ops->file_ops; 497 482 inode->i_data.a_ops = &nfs_file_aops; 483 + nfs_inode_init_regular(nfsi); 498 484 } else if (S_ISDIR(inode->i_mode)) { 499 485 inode->i_op = NFS_SB(sb)->nfs_client->rpc_ops->dir_inode_ops; 500 486 inode->i_fop = &nfs_dir_operations; 501 487 inode->i_data.a_ops = &nfs_dir_aops; 488 + nfs_inode_init_dir(nfsi); 502 489 /* Deal with crossing mountpoints */ 503 490 if (fattr->valid & NFS_ATTR_FATTR_MOUNTPOINT || 504 491 fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) { ··· 526 509 inode->i_uid = make_kuid(&init_user_ns, -2); 527 510 inode->i_gid = make_kgid(&init_user_ns, -2); 528 511 inode->i_blocks = 0; 529 - memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 530 512 nfsi->write_io = 0; 531 513 nfsi->read_io = 0; 532 514 ··· 579 563 fattr->size != 0) 580 564 nfs_set_cache_invalid(inode, NFS_INO_INVALID_BLOCKS); 581 565 582 - nfs_setsecurity(inode, fattr, label); 566 + nfs_setsecurity(inode, fattr); 583 567 584 568 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode); 585 569 nfsi->attrtimeo_timestamp = now; ··· 648 632 if (S_ISREG(inode->i_mode)) 649 633 nfs_sync_inode(inode); 650 634 651 - fattr = nfs_alloc_fattr(); 635 + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); 652 636 if (fattr == NULL) { 653 637 error = -ENOMEM; 654 638 goto out; ··· 682 666 if (err) 683 667 goto out; 684 668 669 + trace_nfs_size_truncate(inode, offset); 685 670 i_size_write(inode, offset); 686 671 /* Optimisation */ 687 672 if (offset == 0) ··· 1041 1024 ctx->cred = get_cred(filp->f_cred); 1042 1025 else 1043 1026 ctx->cred = get_current_cred(); 1044 - ctx->ll_cred = NULL; 1027 + rcu_assign_pointer(ctx->ll_cred, NULL); 1045 1028 ctx->state = NULL; 1046 1029 ctx->mode = f_mode; 1047 1030 ctx->flags = 0; ··· 1080 1063 put_cred(ctx->cred); 1081 1064 dput(ctx->dentry); 1082 1065 nfs_sb_deactive(sb); 1083 - put_rpccred(ctx->ll_cred); 1066 + put_rpccred(rcu_dereference_protected(ctx->ll_cred, 1)); 1084 1067 kfree(ctx->mdsthreshold); 1085 1068 kfree_rcu(ctx, rcu_head); 1086 1069 } ··· 1192 1175 __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) 1193 1176 { 1194 1177 int status = -ESTALE; 1195 - struct nfs4_label *label = NULL; 1196 1178 struct nfs_fattr *fattr = NULL; 1197 1179 struct nfs_inode *nfsi = NFS_I(inode); 1198 1180 ··· 1213 1197 } 1214 1198 1215 1199 status = -ENOMEM; 1216 - fattr = nfs_alloc_fattr(); 1200 + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); 1217 1201 if (fattr == NULL) 1218 1202 goto out; 1219 1203 1220 1204 nfs_inc_stats(inode, NFSIOS_INODEREVALIDATE); 1221 1205 1222 - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); 1223 - if (IS_ERR(label)) { 1224 - status = PTR_ERR(label); 1225 - goto out; 1226 - } 1227 - 1228 - status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, 1229 - label, inode); 1206 + status = NFS_PROTO(inode)->getattr(server, NFS_FH(inode), fattr, inode); 1230 1207 if (status != 0) { 1231 1208 dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) getattr failed, error=%d\n", 1232 1209 inode->i_sb->s_id, ··· 1236 1227 else 1237 1228 nfs_zap_caches(inode); 1238 1229 } 1239 - goto err_out; 1230 + goto out; 1240 1231 } 1241 1232 1242 1233 status = nfs_refresh_inode(inode, fattr); ··· 1244 1235 dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Lu) refresh failed, error=%d\n", 1245 1236 inode->i_sb->s_id, 1246 1237 (unsigned long long)NFS_FILEID(inode), status); 1247 - goto err_out; 1238 + goto out; 1248 1239 } 1249 1240 1250 1241 if (nfsi->cache_validity & NFS_INO_INVALID_ACL) 1251 1242 nfs_zap_acl_cache(inode); 1252 1243 1253 - nfs_setsecurity(inode, fattr, label); 1244 + nfs_setsecurity(inode, fattr); 1254 1245 1255 1246 dfprintk(PAGECACHE, "NFS: (%s/%Lu) revalidation complete\n", 1256 1247 inode->i_sb->s_id, 1257 1248 (unsigned long long)NFS_FILEID(inode)); 1258 1249 1259 - err_out: 1260 - nfs4_label_free(label); 1261 1250 out: 1262 1251 nfs_free_fattr(fattr); 1263 1252 trace_nfs_revalidate_inode_exit(inode, status); ··· 1453 1446 && (fattr->valid & NFS_ATTR_FATTR_MTIME) 1454 1447 && timespec64_equal(&ts, &fattr->pre_mtime)) { 1455 1448 inode->i_mtime = fattr->mtime; 1456 - if (S_ISDIR(inode->i_mode)) 1457 - nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA); 1458 1449 } 1459 1450 if ((fattr->valid & NFS_ATTR_FATTR_PRESIZE) 1460 1451 && (fattr->valid & NFS_ATTR_FATTR_SIZE) 1461 1452 && i_size_read(inode) == nfs_size_to_loff_t(fattr->pre_size) 1462 1453 && !nfs_have_writebacks(inode)) { 1454 + trace_nfs_size_wcc(inode, fattr->size); 1463 1455 i_size_write(inode, nfs_size_to_loff_t(fattr->size)); 1464 1456 } 1465 1457 } ··· 1586 1580 struct nfs_fattr *fattr; 1587 1581 1588 1582 fattr = kmalloc(sizeof(*fattr), GFP_NOFS); 1589 - if (fattr != NULL) 1583 + if (fattr != NULL) { 1590 1584 nfs_fattr_init(fattr); 1585 + fattr->label = NULL; 1586 + } 1591 1587 return fattr; 1592 1588 } 1593 1589 EXPORT_SYMBOL_GPL(nfs_alloc_fattr); 1590 + 1591 + struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server) 1592 + { 1593 + struct nfs_fattr *fattr = nfs_alloc_fattr(); 1594 + 1595 + if (!fattr) 1596 + return NULL; 1597 + 1598 + fattr->label = nfs4_label_alloc(server, GFP_NOFS); 1599 + if (IS_ERR(fattr->label)) { 1600 + kfree(fattr); 1601 + return NULL; 1602 + } 1603 + 1604 + return fattr; 1605 + } 1606 + EXPORT_SYMBOL_GPL(nfs_alloc_fattr_with_label); 1594 1607 1595 1608 struct nfs_fh *nfs_alloc_fhandle(void) 1596 1609 { ··· 1802 1777 NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_OTHER | 1803 1778 NFS_INO_INVALID_NLINK; 1804 1779 unsigned long cache_validity = NFS_I(inode)->cache_validity; 1780 + enum nfs4_change_attr_type ctype = NFS_SERVER(inode)->change_attr_type; 1805 1781 1806 - if (!(cache_validity & NFS_INO_INVALID_CHANGE) && 1782 + if (ctype != NFS4_CHANGE_TYPE_IS_UNDEFINED && 1783 + !(cache_validity & NFS_INO_INVALID_CHANGE) && 1807 1784 (cache_validity & check_valid) != 0 && 1808 1785 (fattr->valid & NFS_ATTR_FATTR_CHANGE) != 0 && 1809 1786 nfs_inode_attrs_cmp_monotonic(fattr, inode) == 0) ··· 2122 2095 /* Do we perhaps have any outstanding writes, or has 2123 2096 * the file grown beyond our last write? */ 2124 2097 if (!nfs_have_writebacks(inode) || new_isize > cur_isize) { 2098 + trace_nfs_size_update(inode, new_isize); 2125 2099 i_size_write(inode, new_isize); 2126 2100 if (!have_writers) 2127 2101 invalid |= NFS_INO_INVALID_DATA; 2128 2102 } 2129 - dprintk("NFS: isize change on server for file %s/%ld " 2130 - "(%Ld to %Ld)\n", 2131 - inode->i_sb->s_id, 2132 - inode->i_ino, 2133 - (long long)cur_isize, 2134 - (long long)new_isize); 2135 2103 } 2136 2104 if (new_isize == 0 && 2137 2105 !(fattr->valid & (NFS_ATTR_FATTR_SPACE_USED | ··· 2177 2155 save_cache_validity & NFS_INO_INVALID_OTHER; 2178 2156 2179 2157 if (fattr->valid & NFS_ATTR_FATTR_NLINK) { 2180 - if (inode->i_nlink != fattr->nlink) { 2181 - if (S_ISDIR(inode->i_mode)) 2182 - invalid |= NFS_INO_INVALID_DATA; 2158 + if (inode->i_nlink != fattr->nlink) 2183 2159 set_nlink(inode, fattr->nlink); 2184 - } 2185 2160 } else if (fattr_supported & NFS_ATTR_FATTR_NLINK) 2186 2161 nfsi->cache_validity |= 2187 2162 save_cache_validity & NFS_INO_INVALID_NLINK; ··· 2279 2260 INIT_LIST_HEAD(&nfsi->open_files); 2280 2261 INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); 2281 2262 INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); 2282 - INIT_LIST_HEAD(&nfsi->commit_info.list); 2283 - atomic_long_set(&nfsi->nrequests, 0); 2284 - atomic_long_set(&nfsi->commit_info.ncommit, 0); 2285 - atomic_set(&nfsi->commit_info.rpcs_out, 0); 2286 - init_rwsem(&nfsi->rmdir_sem); 2287 - mutex_init(&nfsi->commit_mutex); 2288 2263 nfs4_init_once(nfsi); 2289 - nfsi->cache_change_attribute = 0; 2290 2264 } 2291 2265 2292 2266 static int __init nfs_init_inodecache(void)
+2 -10
fs/nfs/internal.h
··· 193 193 extern struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *); 194 194 int nfs_create_rpc_client(struct nfs_client *, const struct nfs_client_initdata *, rpc_authflavor_t); 195 195 struct nfs_client *nfs_get_client(const struct nfs_client_initdata *); 196 - int nfs_probe_fsinfo(struct nfs_server *server, struct nfs_fh *, struct nfs_fattr *); 196 + int nfs_probe_server(struct nfs_server *, struct nfs_fh *); 197 197 void nfs_server_insert_lists(struct nfs_server *); 198 198 void nfs_server_remove_lists(struct nfs_server *); 199 199 void nfs_init_timeout_values(struct rpc_timeout *to, int proto, int timeo, int retrans); ··· 209 209 nfs4_find_client_sessionid(struct net *, const struct sockaddr *, 210 210 struct nfs4_sessionid *, u32); 211 211 extern struct nfs_server *nfs_create_server(struct fs_context *); 212 + extern void nfs4_server_set_init_caps(struct nfs_server *); 212 213 extern struct nfs_server *nfs4_create_server(struct fs_context *); 213 214 extern struct nfs_server *nfs4_create_referral_server(struct fs_context *); 214 215 extern int nfs4_update_server(struct nfs_server *server, const char *hostname, ··· 342 341 343 342 return dst; 344 343 } 345 - static inline void nfs4_label_free(struct nfs4_label *label) 346 - { 347 - if (label) { 348 - kfree(label->label); 349 - kfree(label); 350 - } 351 - return; 352 - } 353 344 354 345 static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) 355 346 { ··· 350 357 } 351 358 #else 352 359 static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; } 353 - static inline void nfs4_label_free(void *label) {} 354 360 static inline void nfs_zap_label_cache_locked(struct nfs_inode *nfsi) 355 361 { 356 362 }
+1 -2
fs/nfs/namespace.c
··· 308 308 309 309 /* Look it up again to get its attributes */ 310 310 err = server->nfs_client->rpc_ops->lookup(d_inode(parent), dentry, 311 - ctx->mntfh, ctx->clone_data.fattr, 312 - NULL); 311 + ctx->mntfh, ctx->clone_data.fattr); 313 312 dput(parent); 314 313 if (err != 0) 315 314 return err;
+4 -6
fs/nfs/nfs3proc.c
··· 100 100 */ 101 101 static int 102 102 nfs3_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 103 - struct nfs_fattr *fattr, struct nfs4_label *label, 104 - struct inode *inode) 103 + struct nfs_fattr *fattr, struct inode *inode) 105 104 { 106 105 struct rpc_message msg = { 107 106 .rpc_proc = &nfs3_procedures[NFS3PROC_GETATTR], ··· 192 193 193 194 static int 194 195 nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, 195 - struct nfs_fh *fhandle, struct nfs_fattr *fattr, 196 - struct nfs4_label *label) 196 + struct nfs_fh *fhandle, struct nfs_fattr *fattr) 197 197 { 198 198 unsigned short task_flags = 0; 199 199 ··· 207 209 } 208 210 209 211 static int nfs3_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle, 210 - struct nfs_fattr *fattr, struct nfs4_label *label) 212 + struct nfs_fattr *fattr) 211 213 { 212 214 const char dotdot[] = ".."; 213 215 const size_t len = strlen(dotdot); ··· 321 323 if (status != 0) 322 324 return ERR_PTR(status); 323 325 324 - return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr, NULL); 326 + return nfs_add_or_obtain(dentry, data->res.fh, data->res.fattr); 325 327 } 326 328 327 329 static void nfs3_free_createdata(struct nfs3_createdata *data)
+1 -1
fs/nfs/nfs3xdr.c
··· 2227 2227 2228 2228 /* ignore properties */ 2229 2229 result->lease_time = 0; 2230 - result->change_attr_type = NFS4_CHANGE_TYPE_IS_TIME_METADATA; 2230 + result->change_attr_type = NFS4_CHANGE_TYPE_IS_UNDEFINED; 2231 2231 return 0; 2232 2232 } 2233 2233
+9
fs/nfs/nfs42proc.c
··· 83 83 status = nfs_post_op_update_inode_force_wcc(inode, 84 84 res.falloc_fattr); 85 85 86 + if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE]) 87 + trace_nfs4_fallocate(inode, &args, status); 88 + else 89 + trace_nfs4_deallocate(inode, &args, status); 86 90 kfree(res.falloc_fattr); 87 91 return status; 88 92 } ··· 367 363 368 364 status = nfs4_call_sync(dst_server->client, dst_server, &msg, 369 365 &args->seq_args, &res->seq_res, 0); 366 + trace_nfs4_copy(src_inode, dst_inode, args, res, nss, status); 370 367 if (status == -ENOTSUPP) 371 368 dst_server->caps &= ~NFS_CAP_COPY; 372 369 if (status) ··· 509 504 { 510 505 struct nfs42_offloadcancel_data *data = calldata; 511 506 507 + trace_nfs4_offload_cancel(&data->args, task->tk_status); 512 508 nfs41_sequence_done(task, &data->res.osr_seq_res); 513 509 if (task->tk_status && 514 510 nfs4_async_handle_error(task, data->seq_server, NULL, ··· 604 598 605 599 status = nfs4_call_sync(src_server->client, src_server, &msg, 606 600 &args->cna_seq_args, &res->cnr_seq_res, 0); 601 + trace_nfs4_copy_notify(file_inode(src), args, res, status); 607 602 if (status == -ENOTSUPP) 608 603 src_server->caps &= ~NFS_CAP_COPY_NOTIFY; 609 604 ··· 685 678 686 679 status = nfs4_call_sync(server->client, server, &msg, 687 680 &args.seq_args, &res.seq_res, 0); 681 + trace_nfs4_llseek(inode, &args, &res, status); 688 682 if (status == -ENOTSUPP) 689 683 server->caps &= ~NFS_CAP_SEEK; 690 684 if (status) ··· 1079 1071 1080 1072 status = nfs4_call_sync(server->client, server, msg, 1081 1073 &args.seq_args, &res.seq_res, 0); 1074 + trace_nfs4_clone(src_inode, dst_inode, &args, status); 1082 1075 if (status == 0) { 1083 1076 nfs42_copy_dest_done(dst_inode, dst_offset, count); 1084 1077 status = nfs_post_op_update_inode(dst_inode, res.dst_fattr);
+1 -3
fs/nfs/nfs4_fs.h
··· 234 234 struct nfs4_string group_name; 235 235 struct nfs4_label *a_label; 236 236 struct nfs_fattr f_attr; 237 - struct nfs4_label *f_label; 238 237 struct dentry *dir; 239 238 struct dentry *dentry; 240 239 struct nfs4_state_owner *owner; ··· 316 317 const struct nfs_lock_context *l_ctx, 317 318 fmode_t fmode); 318 319 extern int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 319 - struct nfs_fattr *fattr, struct nfs4_label *label, 320 - struct inode *inode); 320 + struct nfs_fattr *fattr, struct inode *inode); 321 321 extern int update_open_stateid(struct nfs4_state *state, 322 322 const nfs4_stateid *open_stateid, 323 323 const nfs4_stateid *deleg_stateid,
+20 -45
fs/nfs/nfs4client.c
··· 1059 1059 #endif 1060 1060 } 1061 1061 1062 - static int nfs4_server_common_setup(struct nfs_server *server, 1063 - struct nfs_fh *mntfh, bool auth_probe) 1062 + void nfs4_server_set_init_caps(struct nfs_server *server) 1064 1063 { 1065 - struct nfs_fattr *fattr; 1066 - int error; 1067 - 1068 - /* data servers support only a subset of NFSv4.1 */ 1069 - if (is_ds_only_client(server->nfs_client)) 1070 - return -EPROTONOSUPPORT; 1071 - 1072 - fattr = nfs_alloc_fattr(); 1073 - if (fattr == NULL) 1074 - return -ENOMEM; 1075 - 1076 - /* We must ensure the session is initialised first */ 1077 - error = nfs4_init_session(server->nfs_client); 1078 - if (error < 0) 1079 - goto out; 1080 - 1081 1064 /* Set the basic capabilities */ 1082 1065 server->caps |= server->nfs_client->cl_mvops->init_caps; 1083 1066 if (server->flags & NFS_MOUNT_NORDIRPLUS) 1084 1067 server->caps &= ~NFS_CAP_READDIRPLUS; 1085 1068 if (server->nfs_client->cl_proto == XPRT_TRANSPORT_RDMA) 1086 1069 server->caps &= ~NFS_CAP_READ_PLUS; 1070 + 1087 1071 /* 1088 1072 * Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower 1089 1073 * authentication. ··· 1075 1091 if (nfs4_disable_idmapping && 1076 1092 server->client->cl_auth->au_flavor == RPC_AUTH_UNIX) 1077 1093 server->caps |= NFS_CAP_UIDGID_NOMAP; 1094 + } 1078 1095 1096 + static int nfs4_server_common_setup(struct nfs_server *server, 1097 + struct nfs_fh *mntfh, bool auth_probe) 1098 + { 1099 + int error; 1100 + 1101 + /* data servers support only a subset of NFSv4.1 */ 1102 + if (is_ds_only_client(server->nfs_client)) 1103 + return -EPROTONOSUPPORT; 1104 + 1105 + /* We must ensure the session is initialised first */ 1106 + error = nfs4_init_session(server->nfs_client); 1107 + if (error < 0) 1108 + goto out; 1109 + 1110 + nfs4_server_set_init_caps(server); 1079 1111 1080 1112 /* Probe the root fh to retrieve its FSID and filehandle */ 1081 1113 error = nfs4_get_rootfh(server, mntfh, auth_probe); ··· 1103 1103 (unsigned long long) server->fsid.minor); 1104 1104 nfs_display_fhandle(mntfh, "Pseudo-fs root FH"); 1105 1105 1106 - error = nfs_probe_fsinfo(server, mntfh, fattr); 1106 + error = nfs_probe_server(server, mntfh); 1107 1107 if (error < 0) 1108 1108 goto out; 1109 1109 ··· 1117 1117 server->mount_time = jiffies; 1118 1118 server->destroy = nfs4_destroy_server; 1119 1119 out: 1120 - nfs_free_fattr(fattr); 1121 1120 return error; 1122 1121 } 1123 1122 ··· 1287 1288 return ERR_PTR(error); 1288 1289 } 1289 1290 1290 - /* 1291 - * Grab the destination's particulars, including lease expiry time. 1292 - * 1293 - * Returns zero if probe succeeded and retrieved FSID matches the FSID 1294 - * we have cached. 1295 - */ 1296 - static int nfs_probe_destination(struct nfs_server *server) 1297 - { 1298 - struct inode *inode = d_inode(server->super->s_root); 1299 - struct nfs_fattr *fattr; 1300 - int error; 1301 - 1302 - fattr = nfs_alloc_fattr(); 1303 - if (fattr == NULL) 1304 - return -ENOMEM; 1305 - 1306 - /* Sanity: the probe won't work if the destination server 1307 - * does not recognize the migrated FH. */ 1308 - error = nfs_probe_fsinfo(server, NFS_FH(inode), fattr); 1309 - 1310 - nfs_free_fattr(fattr); 1311 - return error; 1312 - } 1313 - 1314 1291 /** 1315 1292 * nfs4_update_server - Move an nfs_server to a different nfs_client 1316 1293 * ··· 1347 1372 server->nfs_client->cl_hostname = kstrdup(hostname, GFP_KERNEL); 1348 1373 nfs_server_insert_lists(server); 1349 1374 1350 - return nfs_probe_destination(server); 1375 + return nfs_probe_server(server, NFS_FH(d_inode(server->super->s_root))); 1351 1376 }
+7 -7
fs/nfs/nfs4file.c
··· 317 317 static struct file *__nfs42_ssc_open(struct vfsmount *ss_mnt, 318 318 struct nfs_fh *src_fh, nfs4_stateid *stateid) 319 319 { 320 - struct nfs_fattr fattr; 320 + struct nfs_fattr *fattr = nfs_alloc_fattr(); 321 321 struct file *filep, *res; 322 322 struct nfs_server *server; 323 323 struct inode *r_ino = NULL; ··· 328 328 329 329 server = NFS_SERVER(ss_mnt->mnt_root->d_inode); 330 330 331 - nfs_fattr_init(&fattr); 331 + if (!fattr) 332 + return ERR_PTR(-ENOMEM); 332 333 333 - status = nfs4_proc_getattr(server, src_fh, &fattr, NULL, NULL); 334 + status = nfs4_proc_getattr(server, src_fh, fattr, NULL); 334 335 if (status < 0) { 335 336 res = ERR_PTR(status); 336 337 goto out; ··· 344 343 goto out; 345 344 snprintf(read_name, len, SSC_READ_NAME_BODY, read_name_gen++); 346 345 347 - r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, &fattr, 348 - NULL); 346 + r_ino = nfs_fhget(ss_mnt->mnt_root->d_inode->i_sb, src_fh, fattr); 349 347 if (IS_ERR(r_ino)) { 350 348 res = ERR_CAST(r_ino); 351 349 goto out_free_name; 352 350 } 353 351 354 - filep = alloc_file_pseudo(r_ino, ss_mnt, read_name, FMODE_READ, 352 + filep = alloc_file_pseudo(r_ino, ss_mnt, read_name, O_RDONLY, 355 353 r_ino->i_fop); 356 354 if (IS_ERR(filep)) { 357 355 res = ERR_CAST(filep); 358 356 goto out_free_name; 359 357 } 360 - filep->f_mode |= FMODE_READ; 361 358 362 359 ctx = alloc_nfs_open_context(filep->f_path.dentry, filep->f_mode, 363 360 filep); ··· 387 388 out_free_name: 388 389 kfree(read_name); 389 390 out: 391 + nfs_free_fattr(fattr); 390 392 return res; 391 393 out_stateowner: 392 394 nfs4_put_state_owner(sp);
+1 -1
fs/nfs/nfs4idmap.c
··· 487 487 err_destroy_pipe: 488 488 rpc_destroy_pipe_data(idmap->idmap_pipe); 489 489 err: 490 - get_user_ns(idmap->user_ns); 490 + put_user_ns(idmap->user_ns); 491 491 kfree(idmap); 492 492 return error; 493 493 }
+99 -190
fs/nfs/nfs4proc.c
··· 93 93 static int _nfs4_recover_proc_open(struct nfs4_opendata *data); 94 94 static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *); 95 95 static void nfs_fixup_referral_attributes(struct nfs_fattr *fattr); 96 - static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr, struct nfs4_label *label, struct inode *inode); 96 + static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 97 + struct nfs_fattr *fattr, struct inode *inode); 97 98 static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, 98 99 struct nfs_fattr *fattr, struct iattr *sattr, 99 - struct nfs_open_context *ctx, struct nfs4_label *ilabel, 100 - struct nfs4_label *olabel); 100 + struct nfs_open_context *ctx, struct nfs4_label *ilabel); 101 101 #ifdef CONFIG_NFS_V4_1 102 102 static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, 103 103 const struct cred *cred, ··· 1330 1330 static void nfs4_init_opendata_res(struct nfs4_opendata *p) 1331 1331 { 1332 1332 p->o_res.f_attr = &p->f_attr; 1333 - p->o_res.f_label = p->f_label; 1334 1333 p->o_res.seqid = p->o_arg.seqid; 1335 1334 p->c_res.seqid = p->c_arg.seqid; 1336 1335 p->o_res.server = p->o_arg.server; ··· 1355 1356 if (p == NULL) 1356 1357 goto err; 1357 1358 1358 - p->f_label = nfs4_label_alloc(server, gfp_mask); 1359 - if (IS_ERR(p->f_label)) 1359 + p->f_attr.label = nfs4_label_alloc(server, gfp_mask); 1360 + if (IS_ERR(p->f_attr.label)) 1360 1361 goto err_free_p; 1361 1362 1362 1363 p->a_label = nfs4_label_alloc(server, gfp_mask); ··· 1388 1389 sizeof(p->o_arg.u.verifier.data)); 1389 1390 } 1390 1391 } 1391 - /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS 1392 - * will return permission denied for all bits until close */ 1393 - if (!(flags & O_EXCL)) { 1394 - /* ask server to check for all possible rights as results 1395 - * are cached */ 1396 - switch (p->o_arg.claim) { 1397 - default: 1398 - break; 1399 - case NFS4_OPEN_CLAIM_NULL: 1400 - case NFS4_OPEN_CLAIM_FH: 1401 - p->o_arg.access = NFS4_ACCESS_READ | 1402 - NFS4_ACCESS_MODIFY | 1403 - NFS4_ACCESS_EXTEND | 1404 - NFS4_ACCESS_EXECUTE; 1392 + /* ask server to check for all possible rights as results 1393 + * are cached */ 1394 + switch (p->o_arg.claim) { 1395 + default: 1396 + break; 1397 + case NFS4_OPEN_CLAIM_NULL: 1398 + case NFS4_OPEN_CLAIM_FH: 1399 + p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | 1400 + NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE | 1401 + NFS4_ACCESS_EXECUTE; 1405 1402 #ifdef CONFIG_NFS_V4_2 1406 - if (server->caps & NFS_CAP_XATTR) 1407 - p->o_arg.access |= NFS4_ACCESS_XAREAD | 1408 - NFS4_ACCESS_XAWRITE | 1409 - NFS4_ACCESS_XALIST; 1403 + if (!(server->caps & NFS_CAP_XATTR)) 1404 + break; 1405 + p->o_arg.access |= NFS4_ACCESS_XAREAD | NFS4_ACCESS_XAWRITE | 1406 + NFS4_ACCESS_XALIST; 1410 1407 #endif 1411 - } 1412 1408 } 1413 1409 p->o_arg.clientid = server->nfs_client->cl_clientid; 1414 1410 p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); ··· 1434 1440 err_free_label: 1435 1441 nfs4_label_free(p->a_label); 1436 1442 err_free_f: 1437 - nfs4_label_free(p->f_label); 1443 + nfs4_label_free(p->f_attr.label); 1438 1444 err_free_p: 1439 1445 kfree(p); 1440 1446 err: ··· 1456 1462 nfs4_put_state_owner(p->owner); 1457 1463 1458 1464 nfs4_label_free(p->a_label); 1459 - nfs4_label_free(p->f_label); 1465 + nfs4_label_free(p->f_attr.label); 1460 1466 1461 1467 dput(p->dir); 1462 1468 dput(p->dentry); ··· 1604 1610 { 1605 1611 if (test_bit(NFS_OPEN_STATE, &state->flags)) { 1606 1612 /* The common case - we're updating to a new sequence number */ 1607 - if (nfs4_stateid_match_other(stateid, &state->open_stateid) && 1608 - nfs4_stateid_is_next(&state->open_stateid, stateid)) { 1609 - return true; 1613 + if (nfs4_stateid_match_other(stateid, &state->open_stateid)) { 1614 + if (nfs4_stateid_is_next(&state->open_stateid, stateid)) 1615 + return true; 1616 + return false; 1610 1617 } 1611 - } else { 1612 - /* This is the first OPEN in this generation */ 1613 - if (stateid->seqid == cpu_to_be32(1)) 1614 - return true; 1618 + /* The server returned a new stateid */ 1615 1619 } 1620 + /* This is the first OPEN in this generation */ 1621 + if (stateid->seqid == cpu_to_be32(1)) 1622 + return true; 1616 1623 return false; 1617 1624 } 1618 1625 ··· 2009 2014 if (!(data->f_attr.valid & NFS_ATTR_FATTR)) 2010 2015 return ERR_PTR(-EAGAIN); 2011 2016 inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, 2012 - &data->f_attr, data->f_label); 2017 + &data->f_attr); 2013 2018 break; 2014 2019 default: 2015 2020 inode = d_inode(data->dentry); ··· 2468 2473 /* Set the create mode (note dependency on the session type) */ 2469 2474 data->o_arg.createmode = NFS4_CREATE_UNCHECKED; 2470 2475 if (data->o_arg.open_flags & O_EXCL) { 2471 - data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE; 2472 - if (nfs4_has_persistent_session(clp)) 2476 + data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE4_1; 2477 + if (clp->cl_mvops->minor_version == 0) { 2478 + data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE; 2479 + /* don't put an ACCESS op in OPEN compound if O_EXCL, 2480 + * because ACCESS will return permission denied for 2481 + * all bits until close */ 2482 + data->o_res.access_request = data->o_arg.access = 0; 2483 + } else if (nfs4_has_persistent_session(clp)) 2473 2484 data->o_arg.createmode = NFS4_CREATE_GUARDED; 2474 - else if (clp->cl_mvops->minor_version > 0) 2475 - data->o_arg.createmode = NFS4_CREATE_EXCLUSIVE4_1; 2476 2485 } 2477 2486 return; 2478 2487 unlock_no_action: ··· 2708 2709 } 2709 2710 if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) { 2710 2711 nfs4_sequence_free_slot(&o_res->seq_res); 2711 - nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, 2712 - o_res->f_label, NULL); 2712 + nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL); 2713 2713 } 2714 2714 return 0; 2715 2715 } ··· 3124 3126 enum open_claim_type4 claim = NFS4_OPEN_CLAIM_NULL; 3125 3127 struct iattr *sattr = c->sattr; 3126 3128 struct nfs4_label *label = c->label; 3127 - struct nfs4_label *olabel = NULL; 3128 3129 int status; 3129 3130 3130 3131 /* Protect against reboot recovery conflicts */ ··· 3146 3149 if (opendata == NULL) 3147 3150 goto err_put_state_owner; 3148 3151 3149 - if (label) { 3150 - olabel = nfs4_label_alloc(server, GFP_KERNEL); 3151 - if (IS_ERR(olabel)) { 3152 - status = PTR_ERR(olabel); 3153 - goto err_opendata_put; 3154 - } 3155 - } 3156 - 3157 3152 if (server->attr_bitmask[2] & FATTR4_WORD2_MDSTHRESHOLD) { 3158 3153 if (!opendata->f_attr.mdsthreshold) { 3159 3154 opendata->f_attr.mdsthreshold = pnfs_mdsthreshold_alloc(); 3160 3155 if (!opendata->f_attr.mdsthreshold) 3161 - goto err_free_label; 3156 + goto err_opendata_put; 3162 3157 } 3163 3158 opendata->o_arg.open_bitmap = &nfs4_pnfs_open_bitmap[0]; 3164 3159 } ··· 3159 3170 3160 3171 status = _nfs4_open_and_get_state(opendata, flags, ctx); 3161 3172 if (status != 0) 3162 - goto err_free_label; 3173 + goto err_opendata_put; 3163 3174 state = ctx->state; 3164 3175 3165 3176 if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) && ··· 3176 3187 nfs_fattr_init(opendata->o_res.f_attr); 3177 3188 status = nfs4_do_setattr(state->inode, cred, 3178 3189 opendata->o_res.f_attr, sattr, 3179 - ctx, label, olabel); 3190 + ctx, label); 3180 3191 if (status == 0) { 3181 3192 nfs_setattr_update_inode(state->inode, sattr, 3182 3193 opendata->o_res.f_attr); 3183 - nfs_setsecurity(state->inode, opendata->o_res.f_attr, olabel); 3194 + nfs_setsecurity(state->inode, opendata->o_res.f_attr); 3184 3195 } 3185 3196 sattr->ia_valid = ia_old; 3186 3197 } ··· 3193 3204 opendata->f_attr.mdsthreshold = NULL; 3194 3205 } 3195 3206 3196 - nfs4_label_free(olabel); 3197 - 3198 3207 nfs4_opendata_put(opendata); 3199 3208 nfs4_put_state_owner(sp); 3200 3209 return 0; 3201 - err_free_label: 3202 - nfs4_label_free(olabel); 3203 3210 err_opendata_put: 3204 3211 nfs4_opendata_put(opendata); 3205 3212 err_put_state_owner: ··· 3340 3355 3341 3356 static int nfs4_do_setattr(struct inode *inode, const struct cred *cred, 3342 3357 struct nfs_fattr *fattr, struct iattr *sattr, 3343 - struct nfs_open_context *ctx, struct nfs4_label *ilabel, 3344 - struct nfs4_label *olabel) 3358 + struct nfs_open_context *ctx, struct nfs4_label *ilabel) 3345 3359 { 3346 3360 struct nfs_server *server = NFS_SERVER(inode); 3347 3361 __u32 bitmask[NFS4_BITMASK_SZ]; ··· 3354 3370 }; 3355 3371 struct nfs_setattrres res = { 3356 3372 .fattr = fattr, 3357 - .label = olabel, 3358 3373 .server = server, 3359 3374 }; 3360 3375 struct nfs4_exception exception = { ··· 3370 3387 adjust_flags |= NFS_INO_INVALID_OTHER; 3371 3388 3372 3389 do { 3373 - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, olabel), 3390 + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, fattr->label), 3374 3391 inode, adjust_flags); 3375 3392 3376 3393 err = _nfs4_do_setattr(inode, &arg, &res, cred, ctx); ··· 3545 3562 .stateid = &calldata->arg.stateid, 3546 3563 }; 3547 3564 3548 - dprintk("%s: begin!\n", __func__); 3549 3565 if (!nfs4_sequence_done(task, &calldata->res.seq_res)) 3550 3566 return; 3551 3567 trace_nfs4_close(state, &calldata->arg, &calldata->res, task->tk_status); ··· 3599 3617 task->tk_status = 0; 3600 3618 nfs_release_seqid(calldata->arg.seqid); 3601 3619 nfs_refresh_inode(calldata->inode, &calldata->fattr); 3602 - dprintk("%s: done, ret = %d!\n", __func__, task->tk_status); 3620 + dprintk("%s: ret = %d\n", __func__, task->tk_status); 3603 3621 return; 3604 3622 out_restart: 3605 3623 task->tk_status = 0; ··· 3617 3635 bool is_rdonly, is_wronly, is_rdwr; 3618 3636 int call_close = 0; 3619 3637 3620 - dprintk("%s: begin!\n", __func__); 3621 3638 if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0) 3622 3639 goto out_wait; 3623 3640 ··· 3690 3709 &calldata->res.seq_res, 3691 3710 task) != 0) 3692 3711 nfs_release_seqid(calldata->arg.seqid); 3693 - dprintk("%s: done!\n", __func__); 3694 3712 return; 3695 3713 out_no_action: 3696 3714 task->tk_action = NULL; ··· 3922 3942 .interruptible = true, 3923 3943 }; 3924 3944 int err; 3945 + 3946 + nfs4_server_set_init_caps(server); 3925 3947 do { 3926 3948 err = nfs4_handle_exception(server, 3927 3949 _nfs4_server_capabilities(server, fhandle), ··· 4087 4105 { 4088 4106 int error; 4089 4107 struct nfs_fattr *fattr = info->fattr; 4090 - struct nfs4_label *label = fattr->label; 4091 4108 4092 4109 error = nfs4_server_capabilities(server, mntfh); 4093 4110 if (error < 0) { ··· 4094 4113 return error; 4095 4114 } 4096 4115 4097 - error = nfs4_proc_getattr(server, mntfh, fattr, label, NULL); 4116 + error = nfs4_proc_getattr(server, mntfh, fattr, NULL); 4098 4117 if (error < 0) { 4099 4118 dprintk("nfs4_get_root: getattr error = %d\n", -error); 4100 4119 goto out; ··· 4157 4176 } 4158 4177 4159 4178 static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 4160 - struct nfs_fattr *fattr, struct nfs4_label *label, 4161 - struct inode *inode) 4179 + struct nfs_fattr *fattr, struct inode *inode) 4162 4180 { 4163 4181 __u32 bitmask[NFS4_BITMASK_SZ]; 4164 4182 struct nfs4_getattr_arg args = { ··· 4166 4186 }; 4167 4187 struct nfs4_getattr_res res = { 4168 4188 .fattr = fattr, 4169 - .label = label, 4170 4189 .server = server, 4171 4190 }; 4172 4191 struct rpc_message msg = { ··· 4182 4203 if (inode && (server->flags & NFS_MOUNT_SOFTREVAL)) 4183 4204 task_flags |= RPC_TASK_TIMEOUT; 4184 4205 4185 - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, label), inode, 0); 4206 + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, fattr->label), inode, 0); 4186 4207 nfs_fattr_init(fattr); 4187 4208 nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0); 4188 4209 return nfs4_do_call_sync(server->client, server, &msg, ··· 4190 4211 } 4191 4212 4192 4213 int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 4193 - struct nfs_fattr *fattr, struct nfs4_label *label, 4194 - struct inode *inode) 4214 + struct nfs_fattr *fattr, struct inode *inode) 4195 4215 { 4196 4216 struct nfs4_exception exception = { 4197 4217 .interruptible = true, 4198 4218 }; 4199 4219 int err; 4200 4220 do { 4201 - err = _nfs4_proc_getattr(server, fhandle, fattr, label, inode); 4221 + err = _nfs4_proc_getattr(server, fhandle, fattr, inode); 4202 4222 trace_nfs4_getattr(server, fhandle, fattr, err); 4203 4223 err = nfs4_handle_exception(server, err, 4204 4224 &exception); ··· 4229 4251 struct inode *inode = d_inode(dentry); 4230 4252 const struct cred *cred = NULL; 4231 4253 struct nfs_open_context *ctx = NULL; 4232 - struct nfs4_label *label = NULL; 4233 4254 int status; 4234 4255 4235 4256 if (pnfs_ld_layoutret_on_setattr(inode) && ··· 4254 4277 cred = ctx->cred; 4255 4278 } 4256 4279 4257 - label = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); 4258 - if (IS_ERR(label)) 4259 - return PTR_ERR(label); 4260 - 4261 4280 /* Return any delegations if we're going to change ACLs */ 4262 4281 if ((sattr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0) 4263 4282 nfs4_inode_make_writeable(inode); 4264 4283 4265 - status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL, label); 4284 + status = nfs4_do_setattr(inode, cred, fattr, sattr, ctx, NULL); 4266 4285 if (status == 0) { 4267 4286 nfs_setattr_update_inode(inode, sattr, fattr); 4268 - nfs_setsecurity(inode, fattr, label); 4287 + nfs_setsecurity(inode, fattr); 4269 4288 } 4270 - nfs4_label_free(label); 4271 4289 return status; 4272 4290 } 4273 4291 4274 4292 static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, 4275 4293 struct dentry *dentry, struct nfs_fh *fhandle, 4276 - struct nfs_fattr *fattr, struct nfs4_label *label) 4294 + struct nfs_fattr *fattr) 4277 4295 { 4278 4296 struct nfs_server *server = NFS_SERVER(dir); 4279 4297 int status; ··· 4280 4308 struct nfs4_lookup_res res = { 4281 4309 .server = server, 4282 4310 .fattr = fattr, 4283 - .label = label, 4284 4311 .fh = fhandle, 4285 4312 }; 4286 4313 struct rpc_message msg = { ··· 4296 4325 if (nfs_lookup_is_soft_revalidate(dentry)) 4297 4326 task_flags |= RPC_TASK_TIMEOUT; 4298 4327 4299 - args.bitmask = nfs4_bitmask(server, label); 4328 + args.bitmask = nfs4_bitmask(server, fattr->label); 4300 4329 4301 4330 nfs_fattr_init(fattr); 4302 4331 ··· 4318 4347 4319 4348 static int nfs4_proc_lookup_common(struct rpc_clnt **clnt, struct inode *dir, 4320 4349 struct dentry *dentry, struct nfs_fh *fhandle, 4321 - struct nfs_fattr *fattr, struct nfs4_label *label) 4350 + struct nfs_fattr *fattr) 4322 4351 { 4323 4352 struct nfs4_exception exception = { 4324 4353 .interruptible = true, ··· 4327 4356 const struct qstr *name = &dentry->d_name; 4328 4357 int err; 4329 4358 do { 4330 - err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr, label); 4359 + err = _nfs4_proc_lookup(client, dir, dentry, fhandle, fattr); 4331 4360 trace_nfs4_lookup(dir, name, err); 4332 4361 switch (err) { 4333 4362 case -NFS4ERR_BADNAME: ··· 4363 4392 } 4364 4393 4365 4394 static int nfs4_proc_lookup(struct inode *dir, struct dentry *dentry, 4366 - struct nfs_fh *fhandle, struct nfs_fattr *fattr, 4367 - struct nfs4_label *label) 4395 + struct nfs_fh *fhandle, struct nfs_fattr *fattr) 4368 4396 { 4369 4397 int status; 4370 4398 struct rpc_clnt *client = NFS_CLIENT(dir); 4371 4399 4372 - status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, label); 4400 + status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr); 4373 4401 if (client != NFS_CLIENT(dir)) { 4374 4402 rpc_shutdown_client(client); 4375 4403 nfs_fixup_secinfo_attributes(fattr); ··· 4383 4413 struct rpc_clnt *client = NFS_CLIENT(dir); 4384 4414 int status; 4385 4415 4386 - status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr, NULL); 4416 + status = nfs4_proc_lookup_common(&client, dir, dentry, fhandle, fattr); 4387 4417 if (status < 0) 4388 4418 return ERR_PTR(status); 4389 4419 return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; 4390 4420 } 4391 4421 4392 4422 static int _nfs4_proc_lookupp(struct inode *inode, 4393 - struct nfs_fh *fhandle, struct nfs_fattr *fattr, 4394 - struct nfs4_label *label) 4423 + struct nfs_fh *fhandle, struct nfs_fattr *fattr) 4395 4424 { 4396 4425 struct rpc_clnt *clnt = NFS_CLIENT(inode); 4397 4426 struct nfs_server *server = NFS_SERVER(inode); ··· 4402 4433 struct nfs4_lookupp_res res = { 4403 4434 .server = server, 4404 4435 .fattr = fattr, 4405 - .label = label, 4406 4436 .fh = fhandle, 4407 4437 }; 4408 4438 struct rpc_message msg = { ··· 4414 4446 if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL) 4415 4447 task_flags |= RPC_TASK_TIMEOUT; 4416 4448 4417 - args.bitmask = nfs4_bitmask(server, label); 4449 + args.bitmask = nfs4_bitmask(server, fattr->label); 4418 4450 4419 4451 nfs_fattr_init(fattr); 4420 4452 ··· 4426 4458 } 4427 4459 4428 4460 static int nfs4_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle, 4429 - struct nfs_fattr *fattr, struct nfs4_label *label) 4461 + struct nfs_fattr *fattr) 4430 4462 { 4431 4463 struct nfs4_exception exception = { 4432 4464 .interruptible = true, 4433 4465 }; 4434 4466 int err; 4435 4467 do { 4436 - err = _nfs4_proc_lookupp(inode, fhandle, fattr, label); 4468 + err = _nfs4_proc_lookupp(inode, fhandle, fattr); 4437 4469 trace_nfs4_lookupp(inode, err); 4438 4470 err = nfs4_handle_exception(NFS_SERVER(inode), err, 4439 4471 &exception); ··· 4760 4792 }; 4761 4793 struct nfs4_link_res res = { 4762 4794 .server = server, 4763 - .label = NULL, 4764 4795 }; 4765 4796 struct rpc_message msg = { 4766 4797 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LINK], ··· 4768 4801 }; 4769 4802 int status = -ENOMEM; 4770 4803 4771 - res.fattr = nfs_alloc_fattr(); 4804 + res.fattr = nfs_alloc_fattr_with_label(server); 4772 4805 if (res.fattr == NULL) 4773 4806 goto out; 4774 4807 4775 - res.label = nfs4_label_alloc(server, GFP_KERNEL); 4776 - if (IS_ERR(res.label)) { 4777 - status = PTR_ERR(res.label); 4778 - goto out; 4779 - } 4780 - 4781 4808 nfs4_inode_make_writeable(inode); 4782 - nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, res.label), inode, 4809 + nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, res.fattr->label), inode, 4783 4810 NFS_INO_INVALID_CHANGE); 4784 4811 status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); 4785 4812 if (!status) { ··· 4782 4821 nfs4_inc_nlink(inode); 4783 4822 status = nfs_post_op_update_inode(inode, res.fattr); 4784 4823 if (!status) 4785 - nfs_setsecurity(inode, res.fattr, res.label); 4824 + nfs_setsecurity(inode, res.fattr); 4786 4825 } 4787 - 4788 - 4789 - nfs4_label_free(res.label); 4790 4826 4791 4827 out: 4792 4828 nfs_free_fattr(res.fattr); ··· 4810 4852 struct nfs4_create_res res; 4811 4853 struct nfs_fh fh; 4812 4854 struct nfs_fattr fattr; 4813 - struct nfs4_label *label; 4814 4855 }; 4815 4856 4816 4857 static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir, ··· 4821 4864 if (data != NULL) { 4822 4865 struct nfs_server *server = NFS_SERVER(dir); 4823 4866 4824 - data->label = nfs4_label_alloc(server, GFP_KERNEL); 4825 - if (IS_ERR(data->label)) 4867 + data->fattr.label = nfs4_label_alloc(server, GFP_KERNEL); 4868 + if (IS_ERR(data->fattr.label)) 4826 4869 goto out_free; 4827 4870 4828 4871 data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE]; ··· 4833 4876 data->arg.name = name; 4834 4877 data->arg.attrs = sattr; 4835 4878 data->arg.ftype = ftype; 4836 - data->arg.bitmask = nfs4_bitmask(server, data->label); 4879 + data->arg.bitmask = nfs4_bitmask(server, data->fattr.label); 4837 4880 data->arg.umask = current_umask(); 4838 4881 data->res.server = server; 4839 4882 data->res.fh = &data->fh; 4840 4883 data->res.fattr = &data->fattr; 4841 - data->res.label = data->label; 4842 4884 nfs_fattr_init(data->res.fattr); 4843 4885 } 4844 4886 return data; ··· 4859 4903 data->res.fattr->time_start, 4860 4904 NFS_INO_INVALID_DATA); 4861 4905 spin_unlock(&dir->i_lock); 4862 - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, data->res.label); 4906 + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 4863 4907 } 4864 4908 return status; 4865 4909 } 4866 4910 4867 4911 static void nfs4_free_createdata(struct nfs4_createdata *data) 4868 4912 { 4869 - nfs4_label_free(data->label); 4913 + nfs4_label_free(data->fattr.label); 4870 4914 kfree(data); 4871 4915 } 4872 4916 ··· 5304 5348 5305 5349 static int nfs4_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr) 5306 5350 { 5307 - dprintk("--> %s\n", __func__); 5308 - 5309 5351 if (!nfs4_sequence_done(task, &hdr->res.seq_res)) 5310 5352 return -EAGAIN; 5311 5353 if (nfs4_read_stateid_changed(task, &hdr->args)) ··· 5959 6005 size_t buflen) 5960 6006 { 5961 6007 struct nfs_server *server = NFS_SERVER(inode); 5962 - struct nfs_fattr fattr; 5963 6008 struct nfs4_label label = {0, 0, buflen, buf}; 5964 6009 5965 6010 u32 bitmask[3] = { 0, 0, FATTR4_WORD2_SECURITY_LABEL }; 6011 + struct nfs_fattr fattr = { 6012 + .label = &label, 6013 + }; 5966 6014 struct nfs4_getattr_arg arg = { 5967 6015 .fh = NFS_FH(inode), 5968 6016 .bitmask = bitmask, 5969 6017 }; 5970 6018 struct nfs4_getattr_res res = { 5971 6019 .fattr = &fattr, 5972 - .label = &label, 5973 6020 .server = server, 5974 6021 }; 5975 6022 struct rpc_message msg = { ··· 6012 6057 6013 6058 static int _nfs4_do_set_security_label(struct inode *inode, 6014 6059 struct nfs4_label *ilabel, 6015 - struct nfs_fattr *fattr, 6016 - struct nfs4_label *olabel) 6060 + struct nfs_fattr *fattr) 6017 6061 { 6018 6062 6019 6063 struct iattr sattr = {0}; ··· 6027 6073 }; 6028 6074 struct nfs_setattrres res = { 6029 6075 .fattr = fattr, 6030 - .label = olabel, 6031 6076 .server = server, 6032 6077 }; 6033 6078 struct rpc_message msg = { ··· 6047 6094 6048 6095 static int nfs4_do_set_security_label(struct inode *inode, 6049 6096 struct nfs4_label *ilabel, 6050 - struct nfs_fattr *fattr, 6051 - struct nfs4_label *olabel) 6097 + struct nfs_fattr *fattr) 6052 6098 { 6053 6099 struct nfs4_exception exception = { }; 6054 6100 int err; 6055 6101 6056 6102 do { 6057 - err = _nfs4_do_set_security_label(inode, ilabel, 6058 - fattr, olabel); 6103 + err = _nfs4_do_set_security_label(inode, ilabel, fattr); 6059 6104 trace_nfs4_set_security_label(inode, err); 6060 6105 err = nfs4_handle_exception(NFS_SERVER(inode), err, 6061 6106 &exception); ··· 6064 6113 static int 6065 6114 nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen) 6066 6115 { 6067 - struct nfs4_label ilabel, *olabel = NULL; 6068 - struct nfs_fattr fattr; 6116 + struct nfs4_label ilabel = {0, 0, buflen, (char *)buf }; 6117 + struct nfs_fattr *fattr; 6069 6118 int status; 6070 6119 6071 6120 if (!nfs_server_capable(inode, NFS_CAP_SECURITY_LABEL)) 6072 6121 return -EOPNOTSUPP; 6073 6122 6074 - nfs_fattr_init(&fattr); 6123 + fattr = nfs_alloc_fattr_with_label(NFS_SERVER(inode)); 6124 + if (fattr == NULL) 6125 + return -ENOMEM; 6075 6126 6076 - ilabel.pi = 0; 6077 - ilabel.lfs = 0; 6078 - ilabel.label = (char *)buf; 6079 - ilabel.len = buflen; 6080 - 6081 - olabel = nfs4_label_alloc(NFS_SERVER(inode), GFP_KERNEL); 6082 - if (IS_ERR(olabel)) { 6083 - status = -PTR_ERR(olabel); 6084 - goto out; 6085 - } 6086 - 6087 - status = nfs4_do_set_security_label(inode, &ilabel, &fattr, olabel); 6127 + status = nfs4_do_set_security_label(inode, &ilabel, fattr); 6088 6128 if (status == 0) 6089 - nfs_setsecurity(inode, &fattr, olabel); 6129 + nfs_setsecurity(inode, fattr); 6090 6130 6091 - nfs4_label_free(olabel); 6092 - out: 6093 6131 return status; 6094 6132 } 6095 6133 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ ··· 6944 7004 struct nfs4_lockdata *data = calldata; 6945 7005 struct nfs4_state *state = data->lsp->ls_state; 6946 7006 6947 - dprintk("%s: begin!\n", __func__); 6948 7007 if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) 6949 7008 goto out_wait; 6950 7009 /* Do we need to do an open_to_lock_owner? */ ··· 6977 7038 nfs_release_seqid(data->arg.lock_seqid); 6978 7039 out_wait: 6979 7040 nfs4_sequence_done(task, &data->res.seq_res); 6980 - dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); 7041 + dprintk("%s: ret = %d\n", __func__, data->rpc_status); 6981 7042 } 6982 7043 6983 7044 static void nfs4_lock_done(struct rpc_task *task, void *calldata) 6984 7045 { 6985 7046 struct nfs4_lockdata *data = calldata; 6986 7047 struct nfs4_lock_state *lsp = data->lsp; 6987 - 6988 - dprintk("%s: begin!\n", __func__); 6989 7048 6990 7049 if (!nfs4_sequence_done(task, &data->res.seq_res)) 6991 7050 return; ··· 7018 7081 goto out_restart; 7019 7082 } 7020 7083 out_done: 7021 - dprintk("%s: done, ret = %d!\n", __func__, data->rpc_status); 7084 + dprintk("%s: ret = %d!\n", __func__, data->rpc_status); 7022 7085 return; 7023 7086 out_restart: 7024 7087 if (!data->cancelled) ··· 7030 7093 { 7031 7094 struct nfs4_lockdata *data = calldata; 7032 7095 7033 - dprintk("%s: begin!\n", __func__); 7034 7096 nfs_free_seqid(data->arg.open_seqid); 7035 7097 if (data->cancelled && data->rpc_status == 0) { 7036 7098 struct rpc_task *task; ··· 7043 7107 nfs4_put_lock_state(data->lsp); 7044 7108 put_nfs_open_context(data->ctx); 7045 7109 kfree(data); 7046 - dprintk("%s: done!\n", __func__); 7047 7110 } 7048 7111 7049 7112 static const struct rpc_call_ops nfs4_lock_ops = { ··· 7089 7154 if (client->cl_minorversion) 7090 7155 task_setup_data.flags |= RPC_TASK_MOVEABLE; 7091 7156 7092 - dprintk("%s: begin!\n", __func__); 7093 7157 data = nfs4_alloc_lockdata(fl, nfs_file_open_context(fl->fl_file), 7094 7158 fl->fl_u.nfs4_fl.owner, 7095 7159 recovery_type == NFS_LOCK_NEW ? GFP_KERNEL : GFP_NOFS); ··· 7119 7185 data->cancelled = true; 7120 7186 trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret); 7121 7187 rpc_put_task(task); 7122 - dprintk("%s: done, ret = %d!\n", __func__, ret); 7188 + dprintk("%s: ret = %d\n", __func__, ret); 7123 7189 return ret; 7124 7190 } 7125 7191 ··· 8790 8856 struct nfs4_get_lease_time_data *data = 8791 8857 (struct nfs4_get_lease_time_data *)calldata; 8792 8858 8793 - dprintk("--> %s\n", __func__); 8794 8859 /* just setup sequence, do not trigger session recovery 8795 8860 since we're invoked within one */ 8796 8861 nfs4_setup_sequence(data->clp, 8797 8862 &data->args->la_seq_args, 8798 8863 &data->res->lr_seq_res, 8799 8864 task); 8800 - dprintk("<-- %s\n", __func__); 8801 8865 } 8802 8866 8803 8867 /* ··· 8807 8875 struct nfs4_get_lease_time_data *data = 8808 8876 (struct nfs4_get_lease_time_data *)calldata; 8809 8877 8810 - dprintk("--> %s\n", __func__); 8811 8878 if (!nfs4_sequence_done(task, &data->res->lr_seq_res)) 8812 8879 return; 8813 8880 switch (task->tk_status) { 8814 8881 case -NFS4ERR_DELAY: 8815 8882 case -NFS4ERR_GRACE: 8816 - dprintk("%s Retry: tk_status %d\n", __func__, task->tk_status); 8817 8883 rpc_delay(task, NFS4_POLL_RETRY_MIN); 8818 8884 task->tk_status = 0; 8819 8885 fallthrough; ··· 8819 8889 rpc_restart_call_prepare(task); 8820 8890 return; 8821 8891 } 8822 - dprintk("<-- %s\n", __func__); 8823 8892 } 8824 8893 8825 8894 static const struct rpc_call_ops nfs4_get_lease_time_ops = { ··· 9050 9121 dprintk("%s client>seqid %d sessionid %u:%u:%u:%u\n", __func__, 9051 9122 clp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]); 9052 9123 out: 9053 - dprintk("<-- %s\n", __func__); 9054 9124 return status; 9055 9125 } 9056 9126 ··· 9067 9139 }; 9068 9140 int status = 0; 9069 9141 9070 - dprintk("--> nfs4_proc_destroy_session\n"); 9071 - 9072 9142 /* session is still being setup */ 9073 9143 if (!test_and_clear_bit(NFS4_SESSION_ESTABLISHED, &session->session_state)) 9074 9144 return 0; ··· 9078 9152 if (status) 9079 9153 dprintk("NFS: Got error %d from the server on DESTROY_SESSION. " 9080 9154 "Session has been destroyed regardless...\n", status); 9081 - 9082 - dprintk("<-- nfs4_proc_destroy_session\n"); 9083 9155 return status; 9084 9156 } 9085 9157 ··· 9125 9201 if (task->tk_status < 0) { 9126 9202 dprintk("%s ERROR %d\n", __func__, task->tk_status); 9127 9203 if (refcount_read(&clp->cl_count) == 1) 9128 - goto out; 9204 + return; 9129 9205 9130 9206 if (nfs41_sequence_handle_errors(task, clp) == -EAGAIN) { 9131 9207 rpc_restart_call_prepare(task); ··· 9133 9209 } 9134 9210 } 9135 9211 dprintk("%s rpc_cred %p\n", __func__, task->tk_msg.rpc_cred); 9136 - out: 9137 - dprintk("<-- %s\n", __func__); 9138 9212 } 9139 9213 9140 9214 static void nfs41_sequence_prepare(struct rpc_task *task, void *data) ··· 9279 9357 struct nfs_client *clp = calldata->clp; 9280 9358 struct nfs4_sequence_res *res = &calldata->res.seq_res; 9281 9359 9282 - dprintk("--> %s\n", __func__); 9283 9360 if (!nfs41_sequence_done(task, res)) 9284 9361 return; 9285 9362 ··· 9287 9366 rpc_restart_call_prepare(task); 9288 9367 return; 9289 9368 } 9290 - dprintk("<-- %s\n", __func__); 9291 9369 } 9292 9370 9293 9371 static void nfs4_free_reclaim_complete_data(void *data) ··· 9321 9401 }; 9322 9402 int status = -ENOMEM; 9323 9403 9324 - dprintk("--> %s\n", __func__); 9325 9404 calldata = kzalloc(sizeof(*calldata), GFP_NOFS); 9326 9405 if (calldata == NULL) 9327 9406 goto out; ··· 9343 9424 struct nfs4_layoutget *lgp = calldata; 9344 9425 struct nfs_server *server = NFS_SERVER(lgp->args.inode); 9345 9426 9346 - dprintk("--> %s\n", __func__); 9347 9427 nfs4_setup_sequence(server->nfs_client, &lgp->args.seq_args, 9348 9428 &lgp->res.seq_res, task); 9349 - dprintk("<-- %s\n", __func__); 9350 9429 } 9351 9430 9352 9431 static void nfs4_layoutget_done(struct rpc_task *task, void *calldata) 9353 9432 { 9354 9433 struct nfs4_layoutget *lgp = calldata; 9355 9434 9356 - dprintk("--> %s\n", __func__); 9357 9435 nfs41_sequence_process(task, &lgp->res.seq_res); 9358 - dprintk("<-- %s\n", __func__); 9359 9436 } 9360 9437 9361 9438 static int ··· 9440 9525 status = err; 9441 9526 } 9442 9527 out: 9443 - dprintk("<-- %s\n", __func__); 9444 9528 return status; 9445 9529 } 9446 9530 ··· 9453 9539 { 9454 9540 struct nfs4_layoutget *lgp = calldata; 9455 9541 9456 - dprintk("--> %s\n", __func__); 9457 9542 nfs4_sequence_free_slot(&lgp->res.seq_res); 9458 9543 pnfs_layoutget_free(lgp); 9459 - dprintk("<-- %s\n", __func__); 9460 9544 } 9461 9545 9462 9546 static const struct rpc_call_ops nfs4_layoutget_call_ops = { ··· 9489 9577 .timeout = *timeout, 9490 9578 }; 9491 9579 int status = 0; 9492 - 9493 - dprintk("--> %s\n", __func__); 9494 9580 9495 9581 nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0, 0); 9496 9582 ··· 9525 9615 { 9526 9616 struct nfs4_layoutreturn *lrp = calldata; 9527 9617 9528 - dprintk("--> %s\n", __func__); 9529 9618 nfs4_setup_sequence(lrp->clp, 9530 9619 &lrp->args.seq_args, 9531 9620 &lrp->res.seq_res, ··· 9537 9628 { 9538 9629 struct nfs4_layoutreturn *lrp = calldata; 9539 9630 struct nfs_server *server; 9540 - 9541 - dprintk("--> %s\n", __func__); 9542 9631 9543 9632 if (!nfs41_sequence_process(task, &lrp->res.seq_res)) 9544 9633 return; ··· 9568 9661 break; 9569 9662 goto out_restart; 9570 9663 } 9571 - dprintk("<-- %s\n", __func__); 9572 9664 return; 9573 9665 out_restart: 9574 9666 task->tk_status = 0; ··· 9580 9674 struct nfs4_layoutreturn *lrp = calldata; 9581 9675 struct pnfs_layout_hdr *lo = lrp->args.layout; 9582 9676 9583 - dprintk("--> %s\n", __func__); 9584 9677 pnfs_layoutreturn_free_lsegs(lo, &lrp->args.stateid, &lrp->args.range, 9585 9678 lrp->res.lrs_present ? &lrp->res.stateid : NULL); 9586 9679 nfs4_sequence_free_slot(&lrp->res.seq_res); ··· 9589 9684 nfs_iput_and_deactive(lrp->inode); 9590 9685 put_cred(lrp->cred); 9591 9686 kfree(calldata); 9592 - dprintk("<-- %s\n", __func__); 9593 9687 } 9594 9688 9595 9689 static const struct rpc_call_ops nfs4_layoutreturn_call_ops = { ··· 9619 9715 NFS_SP4_MACH_CRED_PNFS_CLEANUP, 9620 9716 &task_setup_data.rpc_client, &msg); 9621 9717 9622 - dprintk("--> %s\n", __func__); 9623 9718 lrp->inode = nfs_igrab_and_active(lrp->args.inode); 9624 9719 if (!sync) { 9625 9720 if (!lrp->inode) { ··· 9665 9762 }; 9666 9763 int status; 9667 9764 9668 - dprintk("--> %s\n", __func__); 9669 9765 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); 9670 9766 if (res.notification & ~args.notify_types) 9671 9767 dprintk("%s: unsupported notification\n", __func__); ··· 9836 9934 msg.rpc_cred = cred; 9837 9935 } 9838 9936 9839 - dprintk("--> %s\n", __func__); 9840 9937 nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0); 9841 9938 status = nfs4_call_sync_custom(&task_setup); 9842 9939 dprintk("<-- %s status=%d\n", __func__, status); ··· 10059 10158 10060 10159 static void nfs41_free_stateid_release(void *calldata) 10061 10160 { 10161 + struct nfs_free_stateid_data *data = calldata; 10162 + struct nfs_client *clp = data->server->nfs_client; 10163 + 10164 + nfs_put_client(clp); 10062 10165 kfree(calldata); 10063 10166 } 10064 10167 ··· 10099 10194 }; 10100 10195 struct nfs_free_stateid_data *data; 10101 10196 struct rpc_task *task; 10197 + struct nfs_client *clp = server->nfs_client; 10198 + 10199 + if (!refcount_inc_not_zero(&clp->cl_count)) 10200 + return -EIO; 10102 10201 10103 10202 nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_STATEID, 10104 10203 &task_setup.rpc_client, &msg);
+8 -4
fs/nfs/nfs4session.c
··· 511 511 struct nfs4_slot *slot, 512 512 struct nfs4_sequence_res *res) 513 513 { 514 + u32 target_highest_slotid = min(res->sr_target_highest_slotid, 515 + NFS4_MAX_SLOTID); 516 + u32 highest_slotid = min(res->sr_highest_slotid, NFS4_MAX_SLOTID); 517 + 514 518 spin_lock(&tbl->slot_tbl_lock); 515 - if (!nfs41_is_outlier_target_slotid(tbl, res->sr_target_highest_slotid)) 516 - nfs41_set_target_slotid_locked(tbl, res->sr_target_highest_slotid); 519 + if (!nfs41_is_outlier_target_slotid(tbl, target_highest_slotid)) 520 + nfs41_set_target_slotid_locked(tbl, target_highest_slotid); 517 521 if (tbl->generation == slot->generation) 518 - nfs41_set_server_slotid_locked(tbl, res->sr_highest_slotid); 519 - nfs41_set_max_slotid_locked(tbl, res->sr_target_highest_slotid); 522 + nfs41_set_server_slotid_locked(tbl, highest_slotid); 523 + nfs41_set_max_slotid_locked(tbl, target_highest_slotid); 520 524 spin_unlock(&tbl->slot_tbl_lock); 521 525 } 522 526
+1
fs/nfs/nfs4session.h
··· 12 12 #define NFS4_DEF_SLOT_TABLE_SIZE (64U) 13 13 #define NFS4_DEF_CB_SLOT_TABLE_SIZE (16U) 14 14 #define NFS4_MAX_SLOT_TABLE (1024U) 15 + #define NFS4_MAX_SLOTID (NFS4_MAX_SLOT_TABLE - 1U) 15 16 #define NFS4_NO_SLOT ((u32)-1) 16 17 17 18 #if IS_ENABLED(CONFIG_NFS_V4)
+1 -4
fs/nfs/nfs4state.c
··· 1194 1194 1195 1195 static void nfs4_clear_state_manager_bit(struct nfs_client *clp) 1196 1196 { 1197 - smp_mb__before_atomic(); 1198 - clear_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); 1199 - smp_mb__after_atomic(); 1200 - wake_up_bit(&clp->cl_state, NFS4CLNT_MANAGER_RUNNING); 1197 + clear_and_wake_up_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state); 1201 1198 rpc_wake_up(&clp->cl_rpcwaitq); 1202 1199 } 1203 1200
+500 -420
fs/nfs/nfs4trace.h
··· 9 9 #define _TRACE_NFS4_H 10 10 11 11 #include <linux/tracepoint.h> 12 + #include <trace/events/sunrpc_base.h> 12 13 13 - TRACE_DEFINE_ENUM(EPERM); 14 - TRACE_DEFINE_ENUM(ENOENT); 15 - TRACE_DEFINE_ENUM(EIO); 16 - TRACE_DEFINE_ENUM(ENXIO); 17 - TRACE_DEFINE_ENUM(EACCES); 18 - TRACE_DEFINE_ENUM(EEXIST); 19 - TRACE_DEFINE_ENUM(EXDEV); 20 - TRACE_DEFINE_ENUM(ENOTDIR); 21 - TRACE_DEFINE_ENUM(EISDIR); 22 - TRACE_DEFINE_ENUM(EFBIG); 23 - TRACE_DEFINE_ENUM(ENOSPC); 24 - TRACE_DEFINE_ENUM(EROFS); 25 - TRACE_DEFINE_ENUM(EMLINK); 26 - TRACE_DEFINE_ENUM(ENAMETOOLONG); 27 - TRACE_DEFINE_ENUM(ENOTEMPTY); 28 - TRACE_DEFINE_ENUM(EDQUOT); 29 - TRACE_DEFINE_ENUM(ESTALE); 30 - TRACE_DEFINE_ENUM(EBADHANDLE); 31 - TRACE_DEFINE_ENUM(EBADCOOKIE); 32 - TRACE_DEFINE_ENUM(ENOTSUPP); 33 - TRACE_DEFINE_ENUM(ETOOSMALL); 34 - TRACE_DEFINE_ENUM(EREMOTEIO); 35 - TRACE_DEFINE_ENUM(EBADTYPE); 36 - TRACE_DEFINE_ENUM(EAGAIN); 37 - TRACE_DEFINE_ENUM(ELOOP); 38 - TRACE_DEFINE_ENUM(EOPNOTSUPP); 39 - TRACE_DEFINE_ENUM(EDEADLK); 40 - TRACE_DEFINE_ENUM(ENOMEM); 41 - TRACE_DEFINE_ENUM(EKEYEXPIRED); 42 - TRACE_DEFINE_ENUM(ETIMEDOUT); 43 - TRACE_DEFINE_ENUM(ERESTARTSYS); 44 - TRACE_DEFINE_ENUM(ECONNREFUSED); 45 - TRACE_DEFINE_ENUM(ECONNRESET); 46 - TRACE_DEFINE_ENUM(ENETUNREACH); 47 - TRACE_DEFINE_ENUM(EHOSTUNREACH); 48 - TRACE_DEFINE_ENUM(EHOSTDOWN); 49 - TRACE_DEFINE_ENUM(EPIPE); 50 - TRACE_DEFINE_ENUM(EPFNOSUPPORT); 51 - TRACE_DEFINE_ENUM(EPROTONOSUPPORT); 52 - 53 - TRACE_DEFINE_ENUM(NFS4_OK); 54 - TRACE_DEFINE_ENUM(NFS4ERR_ACCESS); 55 - TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP); 56 - TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED); 57 - TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY); 58 - TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR); 59 - TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE); 60 - TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE); 61 - TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT); 62 - TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL); 63 - TRACE_DEFINE_ENUM(NFS4ERR_BADNAME); 64 - TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER); 65 - TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION); 66 - TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT); 67 - TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE); 68 - TRACE_DEFINE_ENUM(NFS4ERR_BADXDR); 69 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE); 70 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT); 71 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE); 72 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID); 73 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST); 74 - TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID); 75 - TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN); 76 - TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE); 77 - TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY); 78 - TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY); 79 - TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION); 80 - TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK); 81 - TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION); 82 - TRACE_DEFINE_ENUM(NFS4ERR_DELAY); 83 - TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED); 84 - TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED); 85 - TRACE_DEFINE_ENUM(NFS4ERR_DENIED); 86 - TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL); 87 - TRACE_DEFINE_ENUM(NFS4ERR_DQUOT); 88 - TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP); 89 - TRACE_DEFINE_ENUM(NFS4ERR_EXIST); 90 - TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED); 91 - TRACE_DEFINE_ENUM(NFS4ERR_FBIG); 92 - TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED); 93 - TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN); 94 - TRACE_DEFINE_ENUM(NFS4ERR_GRACE); 95 - TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP); 96 - TRACE_DEFINE_ENUM(NFS4ERR_INVAL); 97 - TRACE_DEFINE_ENUM(NFS4ERR_IO); 98 - TRACE_DEFINE_ENUM(NFS4ERR_ISDIR); 99 - TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER); 100 - TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE); 101 - TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED); 102 - TRACE_DEFINE_ENUM(NFS4ERR_LOCKED); 103 - TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD); 104 - TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE); 105 - TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH); 106 - TRACE_DEFINE_ENUM(NFS4ERR_MLINK); 107 - TRACE_DEFINE_ENUM(NFS4ERR_MOVED); 108 - TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG); 109 - TRACE_DEFINE_ENUM(NFS4ERR_NOENT); 110 - TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE); 111 - TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT); 112 - TRACE_DEFINE_ENUM(NFS4ERR_NOSPC); 113 - TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR); 114 - TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY); 115 - TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP); 116 - TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP); 117 - TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME); 118 - TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE); 119 - TRACE_DEFINE_ENUM(NFS4ERR_NXIO); 120 - TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID); 121 - TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE); 122 - TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL); 123 - TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION); 124 - TRACE_DEFINE_ENUM(NFS4ERR_PERM); 125 - TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE); 126 - TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT); 127 - TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT); 128 - TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD); 129 - TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT); 130 - TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG); 131 - TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG); 132 - TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE); 133 - TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG); 134 - TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE); 135 - TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH); 136 - TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP); 137 - TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT); 138 - TRACE_DEFINE_ENUM(NFS4ERR_ROFS); 139 - TRACE_DEFINE_ENUM(NFS4ERR_SAME); 140 - TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED); 141 - TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS); 142 - TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY); 143 - TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED); 144 - TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT); 145 - TRACE_DEFINE_ENUM(NFS4ERR_STALE); 146 - TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID); 147 - TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID); 148 - TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK); 149 - TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL); 150 - TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS); 151 - TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE); 152 - TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND); 153 - TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC); 154 - TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED); 155 - TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE); 156 - TRACE_DEFINE_ENUM(NFS4ERR_XDEV); 157 - 158 - TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS); 159 - TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS); 160 - 161 - #define show_nfsv4_errors(error) \ 162 - __print_symbolic(error, \ 163 - { NFS4_OK, "OK" }, \ 164 - /* Mapped by nfs4_stat_to_errno() */ \ 165 - { EPERM, "EPERM" }, \ 166 - { ENOENT, "ENOENT" }, \ 167 - { EIO, "EIO" }, \ 168 - { ENXIO, "ENXIO" }, \ 169 - { EACCES, "EACCES" }, \ 170 - { EEXIST, "EEXIST" }, \ 171 - { EXDEV, "EXDEV" }, \ 172 - { ENOTDIR, "ENOTDIR" }, \ 173 - { EISDIR, "EISDIR" }, \ 174 - { EFBIG, "EFBIG" }, \ 175 - { ENOSPC, "ENOSPC" }, \ 176 - { EROFS, "EROFS" }, \ 177 - { EMLINK, "EMLINK" }, \ 178 - { ENAMETOOLONG, "ENAMETOOLONG" }, \ 179 - { ENOTEMPTY, "ENOTEMPTY" }, \ 180 - { EDQUOT, "EDQUOT" }, \ 181 - { ESTALE, "ESTALE" }, \ 182 - { EBADHANDLE, "EBADHANDLE" }, \ 183 - { EBADCOOKIE, "EBADCOOKIE" }, \ 184 - { ENOTSUPP, "ENOTSUPP" }, \ 185 - { ETOOSMALL, "ETOOSMALL" }, \ 186 - { EREMOTEIO, "EREMOTEIO" }, \ 187 - { EBADTYPE, "EBADTYPE" }, \ 188 - { EAGAIN, "EAGAIN" }, \ 189 - { ELOOP, "ELOOP" }, \ 190 - { EOPNOTSUPP, "EOPNOTSUPP" }, \ 191 - { EDEADLK, "EDEADLK" }, \ 192 - /* RPC errors */ \ 193 - { ENOMEM, "ENOMEM" }, \ 194 - { EKEYEXPIRED, "EKEYEXPIRED" }, \ 195 - { ETIMEDOUT, "ETIMEDOUT" }, \ 196 - { ERESTARTSYS, "ERESTARTSYS" }, \ 197 - { ECONNREFUSED, "ECONNREFUSED" }, \ 198 - { ECONNRESET, "ECONNRESET" }, \ 199 - { ENETUNREACH, "ENETUNREACH" }, \ 200 - { EHOSTUNREACH, "EHOSTUNREACH" }, \ 201 - { EHOSTDOWN, "EHOSTDOWN" }, \ 202 - { EPIPE, "EPIPE" }, \ 203 - { EPFNOSUPPORT, "EPFNOSUPPORT" }, \ 204 - { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \ 205 - /* NFSv4 native errors */ \ 206 - { NFS4ERR_ACCESS, "ACCESS" }, \ 207 - { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \ 208 - { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \ 209 - { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \ 210 - { NFS4ERR_BADCHAR, "BADCHAR" }, \ 211 - { NFS4ERR_BADHANDLE, "BADHANDLE" }, \ 212 - { NFS4ERR_BADIOMODE, "BADIOMODE" }, \ 213 - { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \ 214 - { NFS4ERR_BADLABEL, "BADLABEL" }, \ 215 - { NFS4ERR_BADNAME, "BADNAME" }, \ 216 - { NFS4ERR_BADOWNER, "BADOWNER" }, \ 217 - { NFS4ERR_BADSESSION, "BADSESSION" }, \ 218 - { NFS4ERR_BADSLOT, "BADSLOT" }, \ 219 - { NFS4ERR_BADTYPE, "BADTYPE" }, \ 220 - { NFS4ERR_BADXDR, "BADXDR" }, \ 221 - { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \ 222 - { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \ 223 - { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \ 224 - { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \ 225 - { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \ 226 - { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \ 227 - { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 228 - { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \ 229 - { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \ 230 - { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \ 231 - { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \ 232 - "CONN_NOT_BOUND_TO_SESSION" }, \ 233 - { NFS4ERR_DEADLOCK, "DEADLOCK" }, \ 234 - { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \ 235 - { NFS4ERR_DELAY, "DELAY" }, \ 236 - { NFS4ERR_DELEG_ALREADY_WANTED, \ 237 - "DELEG_ALREADY_WANTED" }, \ 238 - { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \ 239 - { NFS4ERR_DENIED, "DENIED" }, \ 240 - { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \ 241 - { NFS4ERR_DQUOT, "DQUOT" }, \ 242 - { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \ 243 - { NFS4ERR_EXIST, "EXIST" }, \ 244 - { NFS4ERR_EXPIRED, "EXPIRED" }, \ 245 - { NFS4ERR_FBIG, "FBIG" }, \ 246 - { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \ 247 - { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \ 248 - { NFS4ERR_GRACE, "GRACE" }, \ 249 - { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \ 250 - { NFS4ERR_INVAL, "INVAL" }, \ 251 - { NFS4ERR_IO, "IO" }, \ 252 - { NFS4ERR_ISDIR, "ISDIR" }, \ 253 - { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \ 254 - { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \ 255 - { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \ 256 - { NFS4ERR_LOCKED, "LOCKED" }, \ 257 - { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \ 258 - { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \ 259 - { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \ 260 - { NFS4ERR_MLINK, "MLINK" }, \ 261 - { NFS4ERR_MOVED, "MOVED" }, \ 262 - { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \ 263 - { NFS4ERR_NOENT, "NOENT" }, \ 264 - { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \ 265 - { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \ 266 - { NFS4ERR_NOSPC, "NOSPC" }, \ 267 - { NFS4ERR_NOTDIR, "NOTDIR" }, \ 268 - { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \ 269 - { NFS4ERR_NOTSUPP, "NOTSUPP" }, \ 270 - { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \ 271 - { NFS4ERR_NOT_SAME, "NOT_SAME" }, \ 272 - { NFS4ERR_NO_GRACE, "NO_GRACE" }, \ 273 - { NFS4ERR_NXIO, "NXIO" }, \ 274 - { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \ 275 - { NFS4ERR_OPENMODE, "OPENMODE" }, \ 276 - { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \ 277 - { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \ 278 - { NFS4ERR_PERM, "PERM" }, \ 279 - { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \ 280 - { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \ 281 - { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \ 282 - { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \ 283 - { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \ 284 - { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \ 285 - { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \ 286 - { NFS4ERR_REP_TOO_BIG_TO_CACHE, \ 287 - "REP_TOO_BIG_TO_CACHE" }, \ 288 - { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \ 289 - { NFS4ERR_RESOURCE, "RESOURCE" }, \ 290 - { NFS4ERR_RESTOREFH, "RESTOREFH" }, \ 291 - { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \ 292 - { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \ 293 - { NFS4ERR_ROFS, "ROFS" }, \ 294 - { NFS4ERR_SAME, "SAME" }, \ 295 - { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \ 296 - { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \ 297 - { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \ 298 - { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \ 299 - { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \ 300 - { NFS4ERR_STALE, "STALE" }, \ 301 - { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \ 302 - { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \ 303 - { NFS4ERR_SYMLINK, "SYMLINK" }, \ 304 - { NFS4ERR_TOOSMALL, "TOOSMALL" }, \ 305 - { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \ 306 - { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \ 307 - { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \ 308 - { NFS4ERR_WRONGSEC, "WRONGSEC" }, \ 309 - { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ 310 - { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ 311 - { NFS4ERR_XDEV, "XDEV" }, \ 312 - /* ***** Internal to Linux NFS client ***** */ \ 313 - { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \ 314 - { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" }) 315 - 316 - #define show_open_flags(flags) \ 317 - __print_flags(flags, "|", \ 318 - { O_CREAT, "O_CREAT" }, \ 319 - { O_EXCL, "O_EXCL" }, \ 320 - { O_TRUNC, "O_TRUNC" }, \ 321 - { O_DIRECT, "O_DIRECT" }) 322 - 323 - #define show_fmode_flags(mode) \ 324 - __print_flags(mode, "|", \ 325 - { ((__force unsigned long)FMODE_READ), "READ" }, \ 326 - { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \ 327 - { ((__force unsigned long)FMODE_EXEC), "EXEC" }) 14 + #include <trace/events/fs.h> 15 + #include <trace/events/nfs.h> 328 16 329 17 #define show_nfs_fattr_flags(valid) \ 330 18 __print_flags((unsigned long)valid, "|", \ ··· 53 365 TP_printk( 54 366 "error=%ld (%s) dstaddr=%s", 55 367 -__entry->error, 56 - show_nfsv4_errors(__entry->error), 368 + show_nfs4_status(__entry->error), 57 369 __get_str(dstaddr) 58 370 ) 59 371 ); ··· 77 389 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence); 78 390 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete); 79 391 80 - #define show_nfs4_sequence_status_flags(status) \ 81 - __print_flags((unsigned long)status, "|", \ 82 - { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 83 - { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \ 84 - "CB_GSS_CONTEXTS_EXPIRING" }, \ 85 - { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \ 86 - "CB_GSS_CONTEXTS_EXPIRED" }, \ 87 - { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \ 88 - "EXPIRED_ALL_STATE_REVOKED" }, \ 89 - { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \ 90 - "EXPIRED_SOME_STATE_REVOKED" }, \ 91 - { SEQ4_STATUS_ADMIN_STATE_REVOKED, \ 92 - "ADMIN_STATE_REVOKED" }, \ 93 - { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \ 94 - "RECALLABLE_STATE_REVOKED" }, \ 95 - { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \ 96 - { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \ 97 - "RESTART_RECLAIM_NEEDED" }, \ 98 - { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \ 99 - "CB_PATH_DOWN_SESSION" }, \ 100 - { SEQ4_STATUS_BACKCHANNEL_FAULT, \ 101 - "BACKCHANNEL_FAULT" }) 102 - 103 392 TRACE_EVENT(nfs4_sequence_done, 104 393 TP_PROTO( 105 394 const struct nfs4_session *session, ··· 90 425 __field(unsigned int, seq_nr) 91 426 __field(unsigned int, highest_slotid) 92 427 __field(unsigned int, target_highest_slotid) 93 - __field(unsigned int, status_flags) 428 + __field(unsigned long, status_flags) 94 429 __field(unsigned long, error) 95 430 ), 96 431 ··· 109 444 TP_printk( 110 445 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 111 446 "highest_slotid=%u target_highest_slotid=%u " 112 - "status_flags=%u (%s)", 447 + "status_flags=0x%lx (%s)", 113 448 -__entry->error, 114 - show_nfsv4_errors(__entry->error), 449 + show_nfs4_status(__entry->error), 115 450 __entry->session, 116 451 __entry->slot_nr, 117 452 __entry->seq_nr, 118 453 __entry->highest_slotid, 119 454 __entry->target_highest_slotid, 120 455 __entry->status_flags, 121 - show_nfs4_sequence_status_flags(__entry->status_flags) 456 + show_nfs4_seq4_status(__entry->status_flags) 122 457 ) 123 458 ); 124 459 ··· 155 490 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 156 491 "highest_slotid=%u", 157 492 -__entry->error, 158 - show_nfsv4_errors(__entry->error), 493 + show_nfs4_status(__entry->error), 159 494 __entry->session, 160 495 __entry->slot_nr, 161 496 __entry->seq_nr, ··· 192 527 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 193 528 "highest_slotid=%u", 194 529 -__entry->error, 195 - show_nfsv4_errors(__entry->error), 530 + show_nfs4_status(__entry->error), 196 531 __entry->session, 197 532 __entry->slot_nr, 198 533 __entry->seq_nr, ··· 200 535 ) 201 536 ); 202 537 538 + TRACE_EVENT(nfs4_cb_offload, 539 + TP_PROTO( 540 + const struct nfs_fh *cb_fh, 541 + const nfs4_stateid *cb_stateid, 542 + uint64_t cb_count, 543 + int cb_error, 544 + int cb_how_stable 545 + ), 546 + 547 + TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error, 548 + cb_how_stable), 549 + 550 + TP_STRUCT__entry( 551 + __field(unsigned long, error) 552 + __field(u32, fhandle) 553 + __field(loff_t, cb_count) 554 + __field(int, cb_how) 555 + __field(int, cb_stateid_seq) 556 + __field(u32, cb_stateid_hash) 557 + ), 558 + 559 + TP_fast_assign( 560 + __entry->error = cb_error < 0 ? -cb_error : 0; 561 + __entry->fhandle = nfs_fhandle_hash(cb_fh); 562 + __entry->cb_stateid_seq = 563 + be32_to_cpu(cb_stateid->seqid); 564 + __entry->cb_stateid_hash = 565 + nfs_stateid_hash(cb_stateid); 566 + __entry->cb_count = cb_count; 567 + __entry->cb_how = cb_how_stable; 568 + ), 569 + 570 + TP_printk( 571 + "error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x " 572 + "cb_count=%llu cb_how=%s", 573 + -__entry->error, 574 + show_nfs4_status(__entry->error), 575 + __entry->fhandle, 576 + __entry->cb_stateid_seq, __entry->cb_stateid_hash, 577 + __entry->cb_count, 578 + show_nfs_stable_how(__entry->cb_how) 579 + ) 580 + ); 203 581 #endif /* CONFIG_NFS_V4_1 */ 204 582 205 583 TRACE_EVENT(nfs4_setup_sequence, ··· 369 661 "hostname=%s clp state=%s error=%ld (%s) section=%s", 370 662 __get_str(hostname), 371 663 show_nfs4_clp_state(__entry->state), -__entry->error, 372 - show_nfsv4_errors(__entry->error), __get_str(section) 664 + show_nfs4_status(__entry->error), __get_str(section) 373 665 374 666 ) 375 667 ) ··· 402 694 __entry->expected = expected; 403 695 ), 404 696 405 - TP_printk( 406 - "task:%u@%d xid=0x%08x operation=%u, expected=%u", 697 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 698 + " xid=0x%08x operation=%u, expected=%u", 407 699 __entry->task_id, __entry->client_id, __entry->xid, 408 700 __entry->op, __entry->expected 409 701 ) ··· 437 729 __entry->error = error; 438 730 ), 439 731 440 - TP_printk( 441 - "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u", 732 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 733 + " xid=0x%08x error=%ld (%s) operation=%u", 442 734 __entry->task_id, __entry->client_id, __entry->xid, 443 - -__entry->error, show_nfsv4_errors(__entry->error), 735 + -__entry->error, show_nfs4_status(__entry->error), 444 736 __entry->op 445 737 ) 446 738 ); ··· 501 793 502 794 TP_STRUCT__entry( 503 795 __field(unsigned long, error) 504 - __field(unsigned int, flags) 505 - __field(unsigned int, fmode) 796 + __field(unsigned long, flags) 797 + __field(unsigned long, fmode) 506 798 __field(dev_t, dev) 507 799 __field(u32, fhandle) 508 800 __field(u64, fileid) ··· 520 812 521 813 __entry->error = -error; 522 814 __entry->flags = flags; 523 - __entry->fmode = (__force unsigned int)ctx->mode; 815 + __entry->fmode = (__force unsigned long)ctx->mode; 524 816 __entry->dev = ctx->dentry->d_sb->s_dev; 525 817 if (!IS_ERR_OR_NULL(state)) { 526 818 inode = state->inode; ··· 550 842 ), 551 843 552 844 TP_printk( 553 - "error=%ld (%s) flags=%d (%s) fmode=%s " 845 + "error=%ld (%s) flags=%lu (%s) fmode=%s " 554 846 "fileid=%02x:%02x:%llu fhandle=0x%08x " 555 847 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x " 556 848 "openstateid=%d:0x%08x", 557 849 -__entry->error, 558 - show_nfsv4_errors(__entry->error), 850 + show_nfs4_status(__entry->error), 559 851 __entry->flags, 560 - show_open_flags(__entry->flags), 561 - show_fmode_flags(__entry->fmode), 852 + show_fs_fcntl_open_flags(__entry->flags), 853 + show_fs_fmode_flags(__entry->fmode), 562 854 MAJOR(__entry->dev), MINOR(__entry->dev), 563 855 (unsigned long long)__entry->fileid, 564 856 __entry->fhandle, ··· 612 904 TP_printk( 613 905 "fmode=%s fileid=%02x:%02x:%llu " 614 906 "fhandle=0x%08x stateid=%d:0x%08x", 615 - __entry->fmode ? show_fmode_flags(__entry->fmode) : 907 + __entry->fmode ? show_fs_fmode_flags(__entry->fmode) : 616 908 "closed", 617 909 MAJOR(__entry->dev), MINOR(__entry->dev), 618 910 (unsigned long long)__entry->fileid, ··· 659 951 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu " 660 952 "fhandle=0x%08x openstateid=%d:0x%08x", 661 953 -__entry->error, 662 - show_nfsv4_errors(__entry->error), 663 - __entry->fmode ? show_fmode_flags(__entry->fmode) : 954 + show_nfs4_status(__entry->error), 955 + __entry->fmode ? show_fs_fmode_flags(__entry->fmode) : 664 956 "closed", 665 957 MAJOR(__entry->dev), MINOR(__entry->dev), 666 958 (unsigned long long)__entry->fileid, ··· 668 960 __entry->stateid_seq, __entry->stateid_hash 669 961 ) 670 962 ); 671 - 672 - TRACE_DEFINE_ENUM(F_GETLK); 673 - TRACE_DEFINE_ENUM(F_SETLK); 674 - TRACE_DEFINE_ENUM(F_SETLKW); 675 - TRACE_DEFINE_ENUM(F_RDLCK); 676 - TRACE_DEFINE_ENUM(F_WRLCK); 677 - TRACE_DEFINE_ENUM(F_UNLCK); 678 - 679 - #define show_lock_cmd(type) \ 680 - __print_symbolic((int)type, \ 681 - { F_GETLK, "GETLK" }, \ 682 - { F_SETLK, "SETLK" }, \ 683 - { F_SETLKW, "SETLKW" }) 684 - #define show_lock_type(type) \ 685 - __print_symbolic((int)type, \ 686 - { F_RDLCK, "RDLCK" }, \ 687 - { F_WRLCK, "WRLCK" }, \ 688 - { F_UNLCK, "UNLCK" }) 689 963 690 964 DECLARE_EVENT_CLASS(nfs4_lock_event, 691 965 TP_PROTO( ··· 681 991 682 992 TP_STRUCT__entry( 683 993 __field(unsigned long, error) 684 - __field(int, cmd) 685 - __field(char, type) 994 + __field(unsigned long, cmd) 995 + __field(unsigned long, type) 686 996 __field(loff_t, start) 687 997 __field(loff_t, end) 688 998 __field(dev_t, dev) ··· 714 1024 "fileid=%02x:%02x:%llu fhandle=0x%08x " 715 1025 "stateid=%d:0x%08x", 716 1026 -__entry->error, 717 - show_nfsv4_errors(__entry->error), 718 - show_lock_cmd(__entry->cmd), 719 - show_lock_type(__entry->type), 1027 + show_nfs4_status(__entry->error), 1028 + show_fs_fcntl_cmd(__entry->cmd), 1029 + show_fs_fcntl_lock_type(__entry->type), 720 1030 (long long)__entry->start, 721 1031 (long long)__entry->end, 722 1032 MAJOR(__entry->dev), MINOR(__entry->dev), ··· 751 1061 752 1062 TP_STRUCT__entry( 753 1063 __field(unsigned long, error) 754 - __field(int, cmd) 755 - __field(char, type) 1064 + __field(unsigned long, cmd) 1065 + __field(unsigned long, type) 756 1066 __field(loff_t, start) 757 1067 __field(loff_t, end) 758 1068 __field(dev_t, dev) ··· 790 1100 "fileid=%02x:%02x:%llu fhandle=0x%08x " 791 1101 "stateid=%d:0x%08x lockstateid=%d:0x%08x", 792 1102 -__entry->error, 793 - show_nfsv4_errors(__entry->error), 794 - show_lock_cmd(__entry->cmd), 795 - show_lock_type(__entry->type), 1103 + show_nfs4_status(__entry->error), 1104 + show_fs_fcntl_cmd(__entry->cmd), 1105 + show_fs_fcntl_lock_type(__entry->type), 796 1106 (long long)__entry->start, 797 1107 (long long)__entry->end, 798 1108 MAJOR(__entry->dev), MINOR(__entry->dev), ··· 909 1219 910 1220 TP_printk( 911 1221 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x", 912 - show_fmode_flags(__entry->fmode), 1222 + show_fs_fmode_flags(__entry->fmode), 913 1223 MAJOR(__entry->dev), MINOR(__entry->dev), 914 1224 (unsigned long long)__entry->fileid, 915 1225 __entry->fhandle ··· 956 1266 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x " 957 1267 "stateid=%d:0x%08x", 958 1268 -__entry->error, 959 - show_nfsv4_errors(__entry->error), 1269 + show_nfs4_status(__entry->error), 960 1270 MAJOR(__entry->dev), MINOR(__entry->dev), 961 1271 __entry->fhandle, 962 1272 __entry->stateid_seq, __entry->stateid_hash ··· 999 1309 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1000 1310 "stateid=%d:0x%08x", 1001 1311 -__entry->error, 1002 - show_nfsv4_errors(__entry->error), 1312 + show_nfs4_status(__entry->error), 1003 1313 MAJOR(__entry->dev), MINOR(__entry->dev), 1004 1314 (unsigned long long)__entry->fileid, 1005 1315 __entry->fhandle, ··· 1046 1356 TP_printk( 1047 1357 "error=%ld (%s) name=%02x:%02x:%llu/%s", 1048 1358 -__entry->error, 1049 - show_nfsv4_errors(__entry->error), 1359 + show_nfs4_status(__entry->error), 1050 1360 MAJOR(__entry->dev), MINOR(__entry->dev), 1051 1361 (unsigned long long)__entry->dir, 1052 1362 __get_str(name) ··· 1093 1403 TP_printk( 1094 1404 "error=%ld (%s) inode=%02x:%02x:%llu", 1095 1405 -__entry->error, 1096 - show_nfsv4_errors(__entry->error), 1406 + show_nfs4_status(__entry->error), 1097 1407 MAJOR(__entry->dev), MINOR(__entry->dev), 1098 1408 (unsigned long long)__entry->ino 1099 1409 ) ··· 1132 1442 "error=%ld (%s) oldname=%02x:%02x:%llu/%s " 1133 1443 "newname=%02x:%02x:%llu/%s", 1134 1444 -__entry->error, 1135 - show_nfsv4_errors(__entry->error), 1445 + show_nfs4_status(__entry->error), 1136 1446 MAJOR(__entry->dev), MINOR(__entry->dev), 1137 1447 (unsigned long long)__entry->olddir, 1138 1448 __get_str(oldname), ··· 1167 1477 TP_printk( 1168 1478 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x", 1169 1479 -__entry->error, 1170 - show_nfsv4_errors(__entry->error), 1480 + show_nfs4_status(__entry->error), 1171 1481 MAJOR(__entry->dev), MINOR(__entry->dev), 1172 1482 (unsigned long long)__entry->fileid, 1173 1483 __entry->fhandle ··· 1225 1535 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1226 1536 "stateid=%d:0x%08x", 1227 1537 -__entry->error, 1228 - show_nfsv4_errors(__entry->error), 1538 + show_nfs4_status(__entry->error), 1229 1539 MAJOR(__entry->dev), MINOR(__entry->dev), 1230 1540 (unsigned long long)__entry->fileid, 1231 1541 __entry->fhandle, ··· 1278 1588 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1279 1589 "valid=%s", 1280 1590 -__entry->error, 1281 - show_nfsv4_errors(__entry->error), 1591 + show_nfs4_status(__entry->error), 1282 1592 MAJOR(__entry->dev), MINOR(__entry->dev), 1283 1593 (unsigned long long)__entry->fileid, 1284 1594 __entry->fhandle, ··· 1334 1644 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1335 1645 "dstaddr=%s", 1336 1646 -__entry->error, 1337 - show_nfsv4_errors(__entry->error), 1647 + show_nfs4_status(__entry->error), 1338 1648 MAJOR(__entry->dev), MINOR(__entry->dev), 1339 1649 (unsigned long long)__entry->fileid, 1340 1650 __entry->fhandle, ··· 1395 1705 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1396 1706 "stateid=%d:0x%08x dstaddr=%s", 1397 1707 -__entry->error, 1398 - show_nfsv4_errors(__entry->error), 1708 + show_nfs4_status(__entry->error), 1399 1709 MAJOR(__entry->dev), MINOR(__entry->dev), 1400 1710 (unsigned long long)__entry->fileid, 1401 1711 __entry->fhandle, ··· 1444 1754 1445 1755 TP_printk( 1446 1756 "error=%ld (%s) id=%u name=%s", 1447 - -__entry->error, show_nfsv4_errors(__entry->error), 1757 + -__entry->error, show_nfs4_status(__entry->error), 1448 1758 __entry->id, 1449 1759 __get_str(name) 1450 1760 ) ··· 1522 1832 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1523 1833 "layoutstateid=%d:0x%08x", 1524 1834 -__entry->error, 1525 - show_nfsv4_errors(__entry->error), 1835 + show_nfs4_status(__entry->error), 1526 1836 MAJOR(__entry->dev), MINOR(__entry->dev), 1527 1837 (unsigned long long)__entry->fileid, 1528 1838 __entry->fhandle, ··· 1596 1906 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1597 1907 "layoutstateid=%d:0x%08x", 1598 1908 -__entry->error, 1599 - show_nfsv4_errors(__entry->error), 1909 + show_nfs4_status(__entry->error), 1600 1910 MAJOR(__entry->dev), MINOR(__entry->dev), 1601 1911 (unsigned long long)__entry->fileid, 1602 1912 __entry->fhandle, ··· 1660 1970 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1661 1971 "offset=%lld count=%u layoutstateid=%d:0x%08x", 1662 1972 -__entry->error, 1663 - show_nfsv4_errors(__entry->error), 1973 + show_nfs4_status(__entry->error), 1664 1974 MAJOR(__entry->dev), MINOR(__entry->dev), 1665 1975 (unsigned long long)__entry->fileid, 1666 1976 __entry->fhandle, ··· 1679 1989 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); 1680 1990 #ifdef CONFIG_NFS_V4_1 1681 1991 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); 1682 - 1683 - TRACE_DEFINE_ENUM(IOMODE_READ); 1684 - TRACE_DEFINE_ENUM(IOMODE_RW); 1685 - TRACE_DEFINE_ENUM(IOMODE_ANY); 1686 - 1687 - #define show_pnfs_iomode(iomode) \ 1688 - __print_symbolic(iomode, \ 1689 - { IOMODE_READ, "READ" }, \ 1690 - { IOMODE_RW, "RW" }, \ 1691 - { IOMODE_ANY, "ANY" }) 1692 1992 1693 1993 TRACE_EVENT(nfs4_layoutget, 1694 1994 TP_PROTO( ··· 1735 2055 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x " 1736 2056 "layoutstateid=%d:0x%08x", 1737 2057 -__entry->error, 1738 - show_nfsv4_errors(__entry->error), 2058 + show_nfs4_status(__entry->error), 1739 2059 MAJOR(__entry->dev), MINOR(__entry->dev), 1740 2060 (unsigned long long)__entry->fileid, 1741 2061 __entry->fhandle, 1742 - show_pnfs_iomode(__entry->iomode), 2062 + show_pnfs_layout_iomode(__entry->iomode), 1743 2063 (unsigned long long)__entry->offset, 1744 2064 (unsigned long long)__entry->count, 1745 2065 __entry->stateid_seq, __entry->stateid_hash, ··· 1833 2153 MAJOR(__entry->dev), MINOR(__entry->dev), 1834 2154 (unsigned long long)__entry->fileid, 1835 2155 __entry->fhandle, 1836 - show_pnfs_iomode(__entry->iomode), 2156 + show_pnfs_layout_iomode(__entry->iomode), 1837 2157 (unsigned long long)__entry->pos, 1838 2158 (unsigned long long)__entry->count, 1839 2159 __entry->layoutstateid_seq, __entry->layoutstateid_hash, ··· 1887 2207 MAJOR(__entry->dev), MINOR(__entry->dev), 1888 2208 (unsigned long long)__entry->fileid, 1889 2209 __entry->fhandle, 1890 - show_pnfs_iomode(__entry->iomode), 2210 + show_pnfs_layout_iomode(__entry->iomode), 1891 2211 (unsigned long long)__entry->pos, 1892 2212 (unsigned long long)__entry->count, 1893 2213 __entry->layoutstateid_seq, __entry->layoutstateid_hash, ··· 2032 2352 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2033 2353 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s", 2034 2354 -__entry->error, 2035 - show_nfsv4_errors(__entry->error), 2355 + show_nfs4_status(__entry->error), 2036 2356 MAJOR(__entry->dev), MINOR(__entry->dev), 2037 2357 (unsigned long long)__entry->fileid, 2038 2358 __entry->fhandle, ··· 2088 2408 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2089 2409 "offset=%llu count=%u dstaddr=%s", 2090 2410 -__entry->error, 2091 - show_nfsv4_errors(__entry->error), 2411 + show_nfs4_status(__entry->error), 2092 2412 MAJOR(__entry->dev), MINOR(__entry->dev), 2093 2413 (unsigned long long)__entry->fileid, 2094 2414 __entry->fhandle, ··· 2097 2417 ) 2098 2418 ); 2099 2419 2420 + TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA); 2421 + TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE); 2422 + 2423 + #define show_llseek_mode(what) \ 2424 + __print_symbolic(what, \ 2425 + { NFS4_CONTENT_DATA, "DATA" }, \ 2426 + { NFS4_CONTENT_HOLE, "HOLE" }) 2427 + 2428 + #ifdef CONFIG_NFS_V4_2 2429 + TRACE_EVENT(nfs4_llseek, 2430 + TP_PROTO( 2431 + const struct inode *inode, 2432 + const struct nfs42_seek_args *args, 2433 + const struct nfs42_seek_res *res, 2434 + int error 2435 + ), 2436 + 2437 + TP_ARGS(inode, args, res, error), 2438 + 2439 + TP_STRUCT__entry( 2440 + __field(unsigned long, error) 2441 + __field(u32, fhandle) 2442 + __field(u32, fileid) 2443 + __field(dev_t, dev) 2444 + __field(int, stateid_seq) 2445 + __field(u32, stateid_hash) 2446 + __field(loff_t, offset_s) 2447 + __field(u32, what) 2448 + __field(loff_t, offset_r) 2449 + __field(u32, eof) 2450 + ), 2451 + 2452 + TP_fast_assign( 2453 + const struct nfs_inode *nfsi = NFS_I(inode); 2454 + const struct nfs_fh *fh = args->sa_fh; 2455 + 2456 + __entry->fileid = nfsi->fileid; 2457 + __entry->dev = inode->i_sb->s_dev; 2458 + __entry->fhandle = nfs_fhandle_hash(fh); 2459 + __entry->offset_s = args->sa_offset; 2460 + __entry->stateid_seq = 2461 + be32_to_cpu(args->sa_stateid.seqid); 2462 + __entry->stateid_hash = 2463 + nfs_stateid_hash(&args->sa_stateid); 2464 + __entry->what = args->sa_what; 2465 + if (error) { 2466 + __entry->error = -error; 2467 + __entry->offset_r = 0; 2468 + __entry->eof = 0; 2469 + } else { 2470 + __entry->error = 0; 2471 + __entry->offset_r = res->sr_offset; 2472 + __entry->eof = res->sr_eof; 2473 + } 2474 + ), 2475 + 2476 + TP_printk( 2477 + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2478 + "stateid=%d:0x%08x offset_s=%llu what=%s " 2479 + "offset_r=%llu eof=%u", 2480 + -__entry->error, 2481 + show_nfs4_status(__entry->error), 2482 + MAJOR(__entry->dev), MINOR(__entry->dev), 2483 + (unsigned long long)__entry->fileid, 2484 + __entry->fhandle, 2485 + __entry->stateid_seq, __entry->stateid_hash, 2486 + __entry->offset_s, 2487 + show_llseek_mode(__entry->what), 2488 + __entry->offset_r, 2489 + __entry->eof 2490 + ) 2491 + ); 2492 + 2493 + DECLARE_EVENT_CLASS(nfs4_sparse_event, 2494 + TP_PROTO( 2495 + const struct inode *inode, 2496 + const struct nfs42_falloc_args *args, 2497 + int error 2498 + ), 2499 + 2500 + TP_ARGS(inode, args, error), 2501 + 2502 + TP_STRUCT__entry( 2503 + __field(unsigned long, error) 2504 + __field(loff_t, offset) 2505 + __field(loff_t, len) 2506 + __field(dev_t, dev) 2507 + __field(u32, fhandle) 2508 + __field(u64, fileid) 2509 + __field(int, stateid_seq) 2510 + __field(u32, stateid_hash) 2511 + ), 2512 + 2513 + TP_fast_assign( 2514 + __entry->error = error < 0 ? -error : 0; 2515 + __entry->offset = args->falloc_offset; 2516 + __entry->len = args->falloc_length; 2517 + __entry->dev = inode->i_sb->s_dev; 2518 + __entry->fileid = NFS_FILEID(inode); 2519 + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2520 + __entry->stateid_seq = 2521 + be32_to_cpu(args->falloc_stateid.seqid); 2522 + __entry->stateid_hash = 2523 + nfs_stateid_hash(&args->falloc_stateid); 2524 + ), 2525 + 2526 + TP_printk( 2527 + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2528 + "stateid=%d:0x%08x offset=%llu len=%llu", 2529 + -__entry->error, 2530 + show_nfs4_status(__entry->error), 2531 + MAJOR(__entry->dev), MINOR(__entry->dev), 2532 + (unsigned long long)__entry->fileid, 2533 + __entry->fhandle, 2534 + __entry->stateid_seq, __entry->stateid_hash, 2535 + (long long)__entry->offset, 2536 + (long long)__entry->len 2537 + ) 2538 + ); 2539 + #define DEFINE_NFS4_SPARSE_EVENT(name) \ 2540 + DEFINE_EVENT(nfs4_sparse_event, name, \ 2541 + TP_PROTO( \ 2542 + const struct inode *inode, \ 2543 + const struct nfs42_falloc_args *args, \ 2544 + int error \ 2545 + ), \ 2546 + TP_ARGS(inode, args, error)) 2547 + DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate); 2548 + DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate); 2549 + 2550 + TRACE_EVENT(nfs4_copy, 2551 + TP_PROTO( 2552 + const struct inode *src_inode, 2553 + const struct inode *dst_inode, 2554 + const struct nfs42_copy_args *args, 2555 + const struct nfs42_copy_res *res, 2556 + const struct nl4_server *nss, 2557 + int error 2558 + ), 2559 + 2560 + TP_ARGS(src_inode, dst_inode, args, res, nss, error), 2561 + 2562 + TP_STRUCT__entry( 2563 + __field(unsigned long, error) 2564 + __field(u32, src_fhandle) 2565 + __field(u32, src_fileid) 2566 + __field(u32, dst_fhandle) 2567 + __field(u32, dst_fileid) 2568 + __field(dev_t, src_dev) 2569 + __field(dev_t, dst_dev) 2570 + __field(int, src_stateid_seq) 2571 + __field(u32, src_stateid_hash) 2572 + __field(int, dst_stateid_seq) 2573 + __field(u32, dst_stateid_hash) 2574 + __field(loff_t, src_offset) 2575 + __field(loff_t, dst_offset) 2576 + __field(bool, sync) 2577 + __field(loff_t, len) 2578 + __field(int, res_stateid_seq) 2579 + __field(u32, res_stateid_hash) 2580 + __field(loff_t, res_count) 2581 + __field(bool, res_sync) 2582 + __field(bool, res_cons) 2583 + __field(bool, intra) 2584 + ), 2585 + 2586 + TP_fast_assign( 2587 + const struct nfs_inode *src_nfsi = NFS_I(src_inode); 2588 + const struct nfs_inode *dst_nfsi = NFS_I(dst_inode); 2589 + 2590 + __entry->src_fileid = src_nfsi->fileid; 2591 + __entry->src_dev = src_inode->i_sb->s_dev; 2592 + __entry->src_fhandle = nfs_fhandle_hash(args->src_fh); 2593 + __entry->src_offset = args->src_pos; 2594 + __entry->dst_fileid = dst_nfsi->fileid; 2595 + __entry->dst_dev = dst_inode->i_sb->s_dev; 2596 + __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh); 2597 + __entry->dst_offset = args->dst_pos; 2598 + __entry->len = args->count; 2599 + __entry->sync = args->sync; 2600 + __entry->src_stateid_seq = 2601 + be32_to_cpu(args->src_stateid.seqid); 2602 + __entry->src_stateid_hash = 2603 + nfs_stateid_hash(&args->src_stateid); 2604 + __entry->dst_stateid_seq = 2605 + be32_to_cpu(args->dst_stateid.seqid); 2606 + __entry->dst_stateid_hash = 2607 + nfs_stateid_hash(&args->dst_stateid); 2608 + __entry->intra = nss ? 0 : 1; 2609 + if (error) { 2610 + __entry->error = -error; 2611 + __entry->res_stateid_seq = 0; 2612 + __entry->res_stateid_hash = 0; 2613 + __entry->res_count = 0; 2614 + __entry->res_sync = 0; 2615 + __entry->res_cons = 0; 2616 + } else { 2617 + __entry->error = 0; 2618 + __entry->res_stateid_seq = 2619 + be32_to_cpu(res->write_res.stateid.seqid); 2620 + __entry->res_stateid_hash = 2621 + nfs_stateid_hash(&res->write_res.stateid); 2622 + __entry->res_count = res->write_res.count; 2623 + __entry->res_sync = res->synchronous; 2624 + __entry->res_cons = res->consecutive; 2625 + } 2626 + ), 2627 + 2628 + TP_printk( 2629 + "error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu " 2630 + "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu " 2631 + "dst_fhandle=0x%08x src_stateid=%d:0x%08x " 2632 + "dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu " 2633 + "len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d " 2634 + "res_cons=%d res_count=%llu", 2635 + -__entry->error, 2636 + show_nfs4_status(__entry->error), 2637 + __entry->intra, 2638 + MAJOR(__entry->src_dev), MINOR(__entry->src_dev), 2639 + (unsigned long long)__entry->src_fileid, 2640 + __entry->src_fhandle, 2641 + MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev), 2642 + (unsigned long long)__entry->dst_fileid, 2643 + __entry->dst_fhandle, 2644 + __entry->src_stateid_seq, __entry->src_stateid_hash, 2645 + __entry->dst_stateid_seq, __entry->dst_stateid_hash, 2646 + __entry->src_offset, 2647 + __entry->dst_offset, 2648 + __entry->len, 2649 + __entry->sync, 2650 + __entry->res_stateid_seq, __entry->res_stateid_hash, 2651 + __entry->res_sync, 2652 + __entry->res_cons, 2653 + __entry->res_count 2654 + ) 2655 + ); 2656 + 2657 + TRACE_EVENT(nfs4_clone, 2658 + TP_PROTO( 2659 + const struct inode *src_inode, 2660 + const struct inode *dst_inode, 2661 + const struct nfs42_clone_args *args, 2662 + int error 2663 + ), 2664 + 2665 + TP_ARGS(src_inode, dst_inode, args, error), 2666 + 2667 + TP_STRUCT__entry( 2668 + __field(unsigned long, error) 2669 + __field(u32, src_fhandle) 2670 + __field(u32, src_fileid) 2671 + __field(u32, dst_fhandle) 2672 + __field(u32, dst_fileid) 2673 + __field(dev_t, src_dev) 2674 + __field(dev_t, dst_dev) 2675 + __field(loff_t, src_offset) 2676 + __field(loff_t, dst_offset) 2677 + __field(int, src_stateid_seq) 2678 + __field(u32, src_stateid_hash) 2679 + __field(int, dst_stateid_seq) 2680 + __field(u32, dst_stateid_hash) 2681 + __field(loff_t, len) 2682 + ), 2683 + 2684 + TP_fast_assign( 2685 + const struct nfs_inode *src_nfsi = NFS_I(src_inode); 2686 + const struct nfs_inode *dst_nfsi = NFS_I(dst_inode); 2687 + 2688 + __entry->src_fileid = src_nfsi->fileid; 2689 + __entry->src_dev = src_inode->i_sb->s_dev; 2690 + __entry->src_fhandle = nfs_fhandle_hash(args->src_fh); 2691 + __entry->src_offset = args->src_offset; 2692 + __entry->dst_fileid = dst_nfsi->fileid; 2693 + __entry->dst_dev = dst_inode->i_sb->s_dev; 2694 + __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh); 2695 + __entry->dst_offset = args->dst_offset; 2696 + __entry->len = args->count; 2697 + __entry->error = error < 0 ? -error : 0; 2698 + __entry->src_stateid_seq = 2699 + be32_to_cpu(args->src_stateid.seqid); 2700 + __entry->src_stateid_hash = 2701 + nfs_stateid_hash(&args->src_stateid); 2702 + __entry->dst_stateid_seq = 2703 + be32_to_cpu(args->dst_stateid.seqid); 2704 + __entry->dst_stateid_hash = 2705 + nfs_stateid_hash(&args->dst_stateid); 2706 + ), 2707 + 2708 + TP_printk( 2709 + "error=%ld (%s) src_fileid=%02x:%02x:%llu " 2710 + "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu " 2711 + "dst_fhandle=0x%08x src_stateid=%d:0x%08x " 2712 + "dst_stateid=%d:0x%08x src_offset=%llu " 2713 + "dst_offset=%llu len=%llu", 2714 + -__entry->error, 2715 + show_nfs4_status(__entry->error), 2716 + MAJOR(__entry->src_dev), MINOR(__entry->src_dev), 2717 + (unsigned long long)__entry->src_fileid, 2718 + __entry->src_fhandle, 2719 + MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev), 2720 + (unsigned long long)__entry->dst_fileid, 2721 + __entry->dst_fhandle, 2722 + __entry->src_stateid_seq, __entry->src_stateid_hash, 2723 + __entry->dst_stateid_seq, __entry->dst_stateid_hash, 2724 + __entry->src_offset, 2725 + __entry->dst_offset, 2726 + __entry->len 2727 + ) 2728 + ); 2729 + 2730 + TRACE_EVENT(nfs4_copy_notify, 2731 + TP_PROTO( 2732 + const struct inode *inode, 2733 + const struct nfs42_copy_notify_args *args, 2734 + const struct nfs42_copy_notify_res *res, 2735 + int error 2736 + ), 2737 + 2738 + TP_ARGS(inode, args, res, error), 2739 + 2740 + TP_STRUCT__entry( 2741 + __field(unsigned long, error) 2742 + __field(u32, fhandle) 2743 + __field(u32, fileid) 2744 + __field(dev_t, dev) 2745 + __field(int, stateid_seq) 2746 + __field(u32, stateid_hash) 2747 + __field(int, res_stateid_seq) 2748 + __field(u32, res_stateid_hash) 2749 + ), 2750 + 2751 + TP_fast_assign( 2752 + const struct nfs_inode *nfsi = NFS_I(inode); 2753 + 2754 + __entry->fileid = nfsi->fileid; 2755 + __entry->dev = inode->i_sb->s_dev; 2756 + __entry->fhandle = nfs_fhandle_hash(args->cna_src_fh); 2757 + __entry->stateid_seq = 2758 + be32_to_cpu(args->cna_src_stateid.seqid); 2759 + __entry->stateid_hash = 2760 + nfs_stateid_hash(&args->cna_src_stateid); 2761 + if (error) { 2762 + __entry->error = -error; 2763 + __entry->res_stateid_seq = 0; 2764 + __entry->res_stateid_hash = 0; 2765 + } else { 2766 + __entry->error = 0; 2767 + __entry->res_stateid_seq = 2768 + be32_to_cpu(res->cnr_stateid.seqid); 2769 + __entry->res_stateid_hash = 2770 + nfs_stateid_hash(&res->cnr_stateid); 2771 + } 2772 + ), 2773 + 2774 + TP_printk( 2775 + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2776 + "stateid=%d:0x%08x res_stateid=%d:0x%08x", 2777 + -__entry->error, 2778 + show_nfs4_status(__entry->error), 2779 + MAJOR(__entry->dev), MINOR(__entry->dev), 2780 + (unsigned long long)__entry->fileid, 2781 + __entry->fhandle, 2782 + __entry->stateid_seq, __entry->stateid_hash, 2783 + __entry->res_stateid_seq, __entry->res_stateid_hash 2784 + ) 2785 + ); 2786 + 2787 + TRACE_EVENT(nfs4_offload_cancel, 2788 + TP_PROTO( 2789 + const struct nfs42_offload_status_args *args, 2790 + int error 2791 + ), 2792 + 2793 + TP_ARGS(args, error), 2794 + 2795 + TP_STRUCT__entry( 2796 + __field(unsigned long, error) 2797 + __field(u32, fhandle) 2798 + __field(int, stateid_seq) 2799 + __field(u32, stateid_hash) 2800 + ), 2801 + 2802 + TP_fast_assign( 2803 + __entry->fhandle = nfs_fhandle_hash(args->osa_src_fh); 2804 + __entry->error = error < 0 ? -error : 0; 2805 + __entry->stateid_seq = 2806 + be32_to_cpu(args->osa_stateid.seqid); 2807 + __entry->stateid_hash = 2808 + nfs_stateid_hash(&args->osa_stateid); 2809 + ), 2810 + 2811 + TP_printk( 2812 + "error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x", 2813 + -__entry->error, 2814 + show_nfs4_status(__entry->error), 2815 + __entry->fhandle, 2816 + __entry->stateid_seq, __entry->stateid_hash 2817 + ) 2818 + ); 2819 + #endif /* CONFIG_NFS_V4_2 */ 2100 2820 2101 2821 #endif /* CONFIG_NFS_V4_1 */ 2102 2822
+32 -49
fs/nfs/nfs4xdr.c
··· 3168 3168 3169 3169 static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr) 3170 3170 { 3171 - __be32 *p; 3171 + ssize_t ret; 3172 + void *ptr; 3173 + u32 tmp; 3172 3174 3173 - p = xdr_inline_decode(xdr, 8); 3174 - if (unlikely(!p)) 3175 + if (xdr_stream_decode_u32(xdr, &tmp) < 0) 3175 3176 return -EIO; 3176 - hdr->status = be32_to_cpup(p++); 3177 - hdr->taglen = be32_to_cpup(p); 3177 + hdr->status = tmp; 3178 3178 3179 - p = xdr_inline_decode(xdr, hdr->taglen + 4); 3180 - if (unlikely(!p)) 3179 + ret = xdr_stream_decode_opaque_inline(xdr, &ptr, NFS4_OPAQUE_LIMIT); 3180 + if (ret < 0) 3181 3181 return -EIO; 3182 - hdr->tag = (char *)p; 3183 - p += XDR_QUADLEN(hdr->taglen); 3184 - hdr->nops = be32_to_cpup(p); 3182 + hdr->taglen = ret; 3183 + hdr->tag = ptr; 3184 + 3185 + if (xdr_stream_decode_u32(xdr, &tmp) < 0) 3186 + return -EIO; 3187 + hdr->nops = tmp; 3185 3188 if (unlikely(hdr->nops < 1)) 3186 3189 return nfs4_stat_to_errno(hdr->status); 3187 3190 return 0; ··· 4585 4582 4586 4583 static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, 4587 4584 struct nfs_fattr *fattr, struct nfs_fh *fh, 4588 - struct nfs4_fs_locations *fs_loc, struct nfs4_label *label, 4589 - const struct nfs_server *server) 4585 + struct nfs4_fs_locations *fs_loc, const struct nfs_server *server) 4590 4586 { 4591 4587 int status; 4592 4588 umode_t fmode = 0; ··· 4700 4698 if (status < 0) 4701 4699 goto xdr_error; 4702 4700 4703 - if (label) { 4704 - status = decode_attr_security_label(xdr, bitmap, label); 4701 + if (fattr->label) { 4702 + status = decode_attr_security_label(xdr, bitmap, fattr->label); 4705 4703 if (status < 0) 4706 4704 goto xdr_error; 4707 4705 fattr->valid |= status; ··· 4714 4712 4715 4713 static int decode_getfattr_generic(struct xdr_stream *xdr, struct nfs_fattr *fattr, 4716 4714 struct nfs_fh *fh, struct nfs4_fs_locations *fs_loc, 4717 - struct nfs4_label *label, const struct nfs_server *server) 4715 + const struct nfs_server *server) 4718 4716 { 4719 4717 unsigned int savep; 4720 4718 uint32_t attrlen, ··· 4733 4731 if (status < 0) 4734 4732 goto xdr_error; 4735 4733 4736 - status = decode_getfattr_attrs(xdr, bitmap, fattr, fh, fs_loc, 4737 - label, server); 4734 + status = decode_getfattr_attrs(xdr, bitmap, fattr, fh, fs_loc, server); 4738 4735 if (status < 0) 4739 4736 goto xdr_error; 4740 4737 ··· 4743 4742 return status; 4744 4743 } 4745 4744 4746 - static int decode_getfattr_label(struct xdr_stream *xdr, struct nfs_fattr *fattr, 4747 - struct nfs4_label *label, const struct nfs_server *server) 4748 - { 4749 - return decode_getfattr_generic(xdr, fattr, NULL, NULL, label, server); 4750 - } 4751 - 4752 4745 static int decode_getfattr(struct xdr_stream *xdr, struct nfs_fattr *fattr, 4753 4746 const struct nfs_server *server) 4754 4747 { 4755 - return decode_getfattr_generic(xdr, fattr, NULL, NULL, NULL, server); 4748 + return decode_getfattr_generic(xdr, fattr, NULL, NULL, server); 4756 4749 } 4757 4750 4758 4751 /* ··· 5567 5572 5568 5573 static int decode_op_map(struct xdr_stream *xdr, struct nfs4_op_map *op_map) 5569 5574 { 5570 - __be32 *p; 5571 - uint32_t bitmap_words; 5572 - unsigned int i; 5573 - 5574 - p = xdr_inline_decode(xdr, 4); 5575 - if (!p) 5575 + if (xdr_stream_decode_uint32_array(xdr, op_map->u.words, 5576 + ARRAY_SIZE(op_map->u.words)) < 0) 5576 5577 return -EIO; 5577 - bitmap_words = be32_to_cpup(p++); 5578 - if (bitmap_words > NFS4_OP_MAP_NUM_WORDS) 5579 - return -EIO; 5580 - p = xdr_inline_decode(xdr, 4 * bitmap_words); 5581 - for (i = 0; i < bitmap_words; i++) 5582 - op_map->u.words[i] = be32_to_cpup(p++); 5583 - 5584 5578 return 0; 5585 5579 } 5586 5580 ··· 6163 6179 status = decode_getfh(xdr, res->fh); 6164 6180 if (status) 6165 6181 goto out; 6166 - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6182 + status = decode_getfattr(xdr, res->fattr, res->server); 6167 6183 out: 6168 6184 return status; 6169 6185 } ··· 6193 6209 status = decode_getfh(xdr, res->fh); 6194 6210 if (status) 6195 6211 goto out; 6196 - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6212 + status = decode_getfattr(xdr, res->fattr, res->server); 6197 6213 out: 6198 6214 return status; 6199 6215 } ··· 6220 6236 goto out; 6221 6237 status = decode_getfh(xdr, res->fh); 6222 6238 if (status == 0) 6223 - status = decode_getfattr_label(xdr, res->fattr, 6224 - res->label, res->server); 6239 + status = decode_getfattr(xdr, res->fattr, res->server); 6225 6240 out: 6226 6241 return status; 6227 6242 } ··· 6314 6331 status = decode_restorefh(xdr); 6315 6332 if (status) 6316 6333 goto out; 6317 - decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6334 + decode_getfattr(xdr, res->fattr, res->server); 6318 6335 out: 6319 6336 return status; 6320 6337 } ··· 6344 6361 status = decode_getfh(xdr, res->fh); 6345 6362 if (status) 6346 6363 goto out; 6347 - decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6364 + decode_getfattr(xdr, res->fattr, res->server); 6348 6365 out: 6349 6366 return status; 6350 6367 } ··· 6377 6394 status = decode_putfh(xdr); 6378 6395 if (status) 6379 6396 goto out; 6380 - status = decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6397 + status = decode_getfattr(xdr, res->fattr, res->server); 6381 6398 out: 6382 6399 return status; 6383 6400 } ··· 6515 6532 goto out; 6516 6533 if (res->access_request) 6517 6534 decode_access(xdr, &res->access_supported, &res->access_result); 6518 - decode_getfattr_label(xdr, res->f_attr, res->f_label, res->server); 6535 + decode_getfattr(xdr, res->f_attr, res->server); 6519 6536 if (res->lg_res) 6520 6537 decode_layoutget(xdr, rqstp, res->lg_res); 6521 6538 out: ··· 6599 6616 status = decode_setattr(xdr); 6600 6617 if (status) 6601 6618 goto out; 6602 - decode_getfattr_label(xdr, res->fattr, res->label, res->server); 6619 + decode_getfattr(xdr, res->fattr, res->server); 6603 6620 out: 6604 6621 return status; 6605 6622 } ··· 7014 7031 status = decode_getfattr_generic(xdr, 7015 7032 &res->fs_locations->fattr, 7016 7033 NULL, res->fs_locations, 7017 - NULL, res->fs_locations->server); 7034 + res->fs_locations->server); 7018 7035 if (status) 7019 7036 goto out; 7020 7037 if (res->renew) ··· 7027 7044 status = decode_getfattr_generic(xdr, 7028 7045 &res->fs_locations->fattr, 7029 7046 NULL, res->fs_locations, 7030 - NULL, res->fs_locations->server); 7047 + res->fs_locations->server); 7031 7048 } 7032 7049 out: 7033 7050 return status; ··· 7458 7475 return -EAGAIN; 7459 7476 7460 7477 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, 7461 - NULL, entry->label, entry->server) < 0) 7478 + NULL, entry->server) < 0) 7462 7479 return -EAGAIN; 7463 7480 if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) 7464 7481 entry->ino = entry->fattr->mounted_on_fileid;
+235 -230
fs/nfs/nfstrace.h
··· 11 11 #include <linux/tracepoint.h> 12 12 #include <linux/iversion.h> 13 13 14 - TRACE_DEFINE_ENUM(DT_UNKNOWN); 15 - TRACE_DEFINE_ENUM(DT_FIFO); 16 - TRACE_DEFINE_ENUM(DT_CHR); 17 - TRACE_DEFINE_ENUM(DT_DIR); 18 - TRACE_DEFINE_ENUM(DT_BLK); 19 - TRACE_DEFINE_ENUM(DT_REG); 20 - TRACE_DEFINE_ENUM(DT_LNK); 21 - TRACE_DEFINE_ENUM(DT_SOCK); 22 - TRACE_DEFINE_ENUM(DT_WHT); 23 - 24 - #define nfs_show_file_type(ftype) \ 25 - __print_symbolic(ftype, \ 26 - { DT_UNKNOWN, "UNKNOWN" }, \ 27 - { DT_FIFO, "FIFO" }, \ 28 - { DT_CHR, "CHR" }, \ 29 - { DT_DIR, "DIR" }, \ 30 - { DT_BLK, "BLK" }, \ 31 - { DT_REG, "REG" }, \ 32 - { DT_LNK, "LNK" }, \ 33 - { DT_SOCK, "SOCK" }, \ 34 - { DT_WHT, "WHT" }) 35 - 36 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_DATA); 37 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_ATIME); 38 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACCESS); 39 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACL); 40 - TRACE_DEFINE_ENUM(NFS_INO_REVAL_PAGECACHE); 41 - TRACE_DEFINE_ENUM(NFS_INO_REVAL_FORCED); 42 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_LABEL); 43 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_CHANGE); 44 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_CTIME); 45 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_MTIME); 46 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_SIZE); 47 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER); 48 - TRACE_DEFINE_ENUM(NFS_INO_DATA_INVAL_DEFER); 49 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_BLOCKS); 50 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_XATTR); 51 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_NLINK); 52 - TRACE_DEFINE_ENUM(NFS_INO_INVALID_MODE); 14 + #include <trace/events/fs.h> 15 + #include <trace/events/nfs.h> 16 + #include <trace/events/sunrpc_base.h> 53 17 54 18 #define nfs_show_cache_validity(v) \ 55 19 __print_flags(v, "|", \ ··· 34 70 { NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \ 35 71 { NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \ 36 72 { NFS_INO_INVALID_MODE, "INVALID_MODE" }) 37 - 38 - TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS); 39 - TRACE_DEFINE_ENUM(NFS_INO_STALE); 40 - TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET); 41 - TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING); 42 - TRACE_DEFINE_ENUM(NFS_INO_FSCACHE); 43 - TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK); 44 - TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT); 45 - TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING); 46 - TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS); 47 - TRACE_DEFINE_ENUM(NFS_INO_ODIRECT); 48 73 49 74 #define nfs_show_nfsi_flags(v) \ 50 75 __print_flags(v, "|", \ ··· 116 163 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 117 164 "type=%u (%s) version=%llu size=%lld " 118 165 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)", 119 - -__entry->error, nfs_show_status(__entry->error), 166 + -__entry->error, show_nfs_status(__entry->error), 120 167 MAJOR(__entry->dev), MINOR(__entry->dev), 121 168 (unsigned long long)__entry->fileid, 122 169 __entry->fhandle, 123 170 __entry->type, 124 - nfs_show_file_type(__entry->type), 171 + show_fs_dirent_type(__entry->type), 125 172 (unsigned long long)__entry->version, 126 173 (long long)__entry->size, 127 174 __entry->cache_validity, ··· 207 254 "type=%u (%s) version=%llu size=%lld " 208 255 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) " 209 256 "mask=0x%x permitted=0x%x", 210 - -__entry->error, nfs_show_status(__entry->error), 257 + -__entry->error, show_nfs_status(__entry->error), 211 258 MAJOR(__entry->dev), MINOR(__entry->dev), 212 259 (unsigned long long)__entry->fileid, 213 260 __entry->fhandle, 214 261 __entry->type, 215 - nfs_show_file_type(__entry->type), 262 + show_fs_dirent_type(__entry->type), 216 263 (unsigned long long)__entry->version, 217 264 (long long)__entry->size, 218 265 __entry->cache_validity, ··· 223 270 ) 224 271 ); 225 272 226 - TRACE_DEFINE_ENUM(LOOKUP_FOLLOW); 227 - TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY); 228 - TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT); 229 - TRACE_DEFINE_ENUM(LOOKUP_PARENT); 230 - TRACE_DEFINE_ENUM(LOOKUP_REVAL); 231 - TRACE_DEFINE_ENUM(LOOKUP_RCU); 232 - TRACE_DEFINE_ENUM(LOOKUP_OPEN); 233 - TRACE_DEFINE_ENUM(LOOKUP_CREATE); 234 - TRACE_DEFINE_ENUM(LOOKUP_EXCL); 235 - TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET); 236 - TRACE_DEFINE_ENUM(LOOKUP_EMPTY); 237 - TRACE_DEFINE_ENUM(LOOKUP_DOWN); 273 + DECLARE_EVENT_CLASS(nfs_update_size_class, 274 + TP_PROTO( 275 + const struct inode *inode, 276 + loff_t new_size 277 + ), 238 278 239 - #define show_lookup_flags(flags) \ 240 - __print_flags(flags, "|", \ 241 - { LOOKUP_FOLLOW, "FOLLOW" }, \ 242 - { LOOKUP_DIRECTORY, "DIRECTORY" }, \ 243 - { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \ 244 - { LOOKUP_PARENT, "PARENT" }, \ 245 - { LOOKUP_REVAL, "REVAL" }, \ 246 - { LOOKUP_RCU, "RCU" }, \ 247 - { LOOKUP_OPEN, "OPEN" }, \ 248 - { LOOKUP_CREATE, "CREATE" }, \ 249 - { LOOKUP_EXCL, "EXCL" }, \ 250 - { LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \ 251 - { LOOKUP_EMPTY, "EMPTY" }, \ 252 - { LOOKUP_DOWN, "DOWN" }) 279 + TP_ARGS(inode, new_size), 280 + 281 + TP_STRUCT__entry( 282 + __field(dev_t, dev) 283 + __field(u32, fhandle) 284 + __field(u64, fileid) 285 + __field(u64, version) 286 + __field(loff_t, cur_size) 287 + __field(loff_t, new_size) 288 + ), 289 + 290 + TP_fast_assign( 291 + const struct nfs_inode *nfsi = NFS_I(inode); 292 + 293 + __entry->dev = inode->i_sb->s_dev; 294 + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 295 + __entry->fileid = nfsi->fileid; 296 + __entry->version = inode_peek_iversion_raw(inode); 297 + __entry->cur_size = i_size_read(inode); 298 + __entry->new_size = new_size; 299 + ), 300 + 301 + TP_printk( 302 + "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld", 303 + MAJOR(__entry->dev), MINOR(__entry->dev), 304 + (unsigned long long)__entry->fileid, 305 + __entry->fhandle, __entry->version, 306 + __entry->cur_size, __entry->new_size 307 + ) 308 + ); 309 + 310 + #define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \ 311 + DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \ 312 + TP_PROTO( \ 313 + const struct inode *inode, \ 314 + loff_t new_size \ 315 + ), \ 316 + TP_ARGS(inode, new_size)) 317 + 318 + DEFINE_NFS_UPDATE_SIZE_EVENT(truncate); 319 + DEFINE_NFS_UPDATE_SIZE_EVENT(wcc); 320 + DEFINE_NFS_UPDATE_SIZE_EVENT(update); 321 + DEFINE_NFS_UPDATE_SIZE_EVENT(grow); 253 322 254 323 DECLARE_EVENT_CLASS(nfs_lookup_event, 255 324 TP_PROTO( ··· 299 324 TP_printk( 300 325 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 301 326 __entry->flags, 302 - show_lookup_flags(__entry->flags), 327 + show_fs_lookup_flags(__entry->flags), 303 328 MAJOR(__entry->dev), MINOR(__entry->dev), 304 329 (unsigned long long)__entry->dir, 305 330 __get_str(name) ··· 343 368 344 369 TP_printk( 345 370 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 346 - -__entry->error, nfs_show_status(__entry->error), 371 + -__entry->error, show_nfs_status(__entry->error), 347 372 __entry->flags, 348 - show_lookup_flags(__entry->flags), 373 + show_fs_lookup_flags(__entry->flags), 349 374 MAJOR(__entry->dev), MINOR(__entry->dev), 350 375 (unsigned long long)__entry->dir, 351 376 __get_str(name) ··· 367 392 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter); 368 393 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit); 369 394 370 - TRACE_DEFINE_ENUM(O_WRONLY); 371 - TRACE_DEFINE_ENUM(O_RDWR); 372 - TRACE_DEFINE_ENUM(O_CREAT); 373 - TRACE_DEFINE_ENUM(O_EXCL); 374 - TRACE_DEFINE_ENUM(O_NOCTTY); 375 - TRACE_DEFINE_ENUM(O_TRUNC); 376 - TRACE_DEFINE_ENUM(O_APPEND); 377 - TRACE_DEFINE_ENUM(O_NONBLOCK); 378 - TRACE_DEFINE_ENUM(O_DSYNC); 379 - TRACE_DEFINE_ENUM(O_DIRECT); 380 - TRACE_DEFINE_ENUM(O_LARGEFILE); 381 - TRACE_DEFINE_ENUM(O_DIRECTORY); 382 - TRACE_DEFINE_ENUM(O_NOFOLLOW); 383 - TRACE_DEFINE_ENUM(O_NOATIME); 384 - TRACE_DEFINE_ENUM(O_CLOEXEC); 385 - 386 - #define show_open_flags(flags) \ 387 - __print_flags(flags, "|", \ 388 - { O_WRONLY, "O_WRONLY" }, \ 389 - { O_RDWR, "O_RDWR" }, \ 390 - { O_CREAT, "O_CREAT" }, \ 391 - { O_EXCL, "O_EXCL" }, \ 392 - { O_NOCTTY, "O_NOCTTY" }, \ 393 - { O_TRUNC, "O_TRUNC" }, \ 394 - { O_APPEND, "O_APPEND" }, \ 395 - { O_NONBLOCK, "O_NONBLOCK" }, \ 396 - { O_DSYNC, "O_DSYNC" }, \ 397 - { O_DIRECT, "O_DIRECT" }, \ 398 - { O_LARGEFILE, "O_LARGEFILE" }, \ 399 - { O_DIRECTORY, "O_DIRECTORY" }, \ 400 - { O_NOFOLLOW, "O_NOFOLLOW" }, \ 401 - { O_NOATIME, "O_NOATIME" }, \ 402 - { O_CLOEXEC, "O_CLOEXEC" }) 403 - 404 - #define show_fmode_flags(mode) \ 405 - __print_flags(mode, "|", \ 406 - { ((__force unsigned long)FMODE_READ), "READ" }, \ 407 - { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \ 408 - { ((__force unsigned long)FMODE_EXEC), "EXEC" }) 409 - 410 395 TRACE_EVENT(nfs_atomic_open_enter, 411 396 TP_PROTO( 412 397 const struct inode *dir, ··· 378 443 379 444 TP_STRUCT__entry( 380 445 __field(unsigned long, flags) 381 - __field(unsigned int, fmode) 446 + __field(unsigned long, fmode) 382 447 __field(dev_t, dev) 383 448 __field(u64, dir) 384 449 __string(name, ctx->dentry->d_name.name) ··· 388 453 __entry->dev = dir->i_sb->s_dev; 389 454 __entry->dir = NFS_FILEID(dir); 390 455 __entry->flags = flags; 391 - __entry->fmode = (__force unsigned int)ctx->mode; 456 + __entry->fmode = (__force unsigned long)ctx->mode; 392 457 __assign_str(name, ctx->dentry->d_name.name); 393 458 ), 394 459 395 460 TP_printk( 396 461 "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s", 397 462 __entry->flags, 398 - show_open_flags(__entry->flags), 399 - show_fmode_flags(__entry->fmode), 463 + show_fs_fcntl_open_flags(__entry->flags), 464 + show_fs_fmode_flags(__entry->fmode), 400 465 MAJOR(__entry->dev), MINOR(__entry->dev), 401 466 (unsigned long long)__entry->dir, 402 467 __get_str(name) ··· 416 481 TP_STRUCT__entry( 417 482 __field(unsigned long, error) 418 483 __field(unsigned long, flags) 419 - __field(unsigned int, fmode) 484 + __field(unsigned long, fmode) 420 485 __field(dev_t, dev) 421 486 __field(u64, dir) 422 487 __string(name, ctx->dentry->d_name.name) ··· 427 492 __entry->dev = dir->i_sb->s_dev; 428 493 __entry->dir = NFS_FILEID(dir); 429 494 __entry->flags = flags; 430 - __entry->fmode = (__force unsigned int)ctx->mode; 495 + __entry->fmode = (__force unsigned long)ctx->mode; 431 496 __assign_str(name, ctx->dentry->d_name.name); 432 497 ), 433 498 434 499 TP_printk( 435 500 "error=%ld (%s) flags=0x%lx (%s) fmode=%s " 436 501 "name=%02x:%02x:%llu/%s", 437 - -__entry->error, nfs_show_status(__entry->error), 502 + -__entry->error, show_nfs_status(__entry->error), 438 503 __entry->flags, 439 - show_open_flags(__entry->flags), 440 - show_fmode_flags(__entry->fmode), 504 + show_fs_fcntl_open_flags(__entry->flags), 505 + show_fs_fmode_flags(__entry->fmode), 441 506 MAJOR(__entry->dev), MINOR(__entry->dev), 442 507 (unsigned long long)__entry->dir, 443 508 __get_str(name) ··· 470 535 TP_printk( 471 536 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 472 537 __entry->flags, 473 - show_open_flags(__entry->flags), 538 + show_fs_fcntl_open_flags(__entry->flags), 474 539 MAJOR(__entry->dev), MINOR(__entry->dev), 475 540 (unsigned long long)__entry->dir, 476 541 __get_str(name) ··· 505 570 506 571 TP_printk( 507 572 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 508 - -__entry->error, nfs_show_status(__entry->error), 573 + -__entry->error, show_nfs_status(__entry->error), 509 574 __entry->flags, 510 - show_open_flags(__entry->flags), 575 + show_fs_fcntl_open_flags(__entry->flags), 511 576 MAJOR(__entry->dev), MINOR(__entry->dev), 512 577 (unsigned long long)__entry->dir, 513 578 __get_str(name) ··· 575 640 576 641 TP_printk( 577 642 "error=%ld (%s) name=%02x:%02x:%llu/%s", 578 - -__entry->error, nfs_show_status(__entry->error), 643 + -__entry->error, show_nfs_status(__entry->error), 579 644 MAJOR(__entry->dev), MINOR(__entry->dev), 580 645 (unsigned long long)__entry->dir, 581 646 __get_str(name) ··· 665 730 666 731 TP_printk( 667 732 "error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s", 668 - -__entry->error, nfs_show_status(__entry->error), 733 + -__entry->error, show_nfs_status(__entry->error), 669 734 MAJOR(__entry->dev), MINOR(__entry->dev), 670 735 __entry->fileid, 671 736 MAJOR(__entry->dev), MINOR(__entry->dev), ··· 752 817 TP_printk( 753 818 "error=%ld (%s) old_name=%02x:%02x:%llu/%s " 754 819 "new_name=%02x:%02x:%llu/%s", 755 - -__entry->error, nfs_show_status(__entry->error), 820 + -__entry->error, show_nfs_status(__entry->error), 756 821 MAJOR(__entry->dev), MINOR(__entry->dev), 757 822 (unsigned long long)__entry->old_dir, 758 823 __get_str(old_name), ··· 806 871 807 872 TP_printk( 808 873 "error=%ld (%s) name=%02x:%02x:%llu/%s", 809 - -__entry->error, nfs_show_status(__entry->error), 874 + -__entry->error, show_nfs_status(__entry->error), 810 875 MAJOR(__entry->dev), MINOR(__entry->dev), 811 876 (unsigned long long)__entry->dir, 812 877 __get_str(name) 878 + ) 879 + ); 880 + 881 + TRACE_EVENT(nfs_aop_readpage, 882 + TP_PROTO( 883 + const struct inode *inode, 884 + struct page *page 885 + ), 886 + 887 + TP_ARGS(inode, page), 888 + 889 + TP_STRUCT__entry( 890 + __field(dev_t, dev) 891 + __field(u32, fhandle) 892 + __field(u64, fileid) 893 + __field(u64, version) 894 + __field(loff_t, offset) 895 + ), 896 + 897 + TP_fast_assign( 898 + const struct nfs_inode *nfsi = NFS_I(inode); 899 + 900 + __entry->dev = inode->i_sb->s_dev; 901 + __entry->fileid = nfsi->fileid; 902 + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 903 + __entry->version = inode_peek_iversion_raw(inode); 904 + __entry->offset = page_index(page) << PAGE_SHIFT; 905 + ), 906 + 907 + TP_printk( 908 + "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld", 909 + MAJOR(__entry->dev), MINOR(__entry->dev), 910 + (unsigned long long)__entry->fileid, 911 + __entry->fhandle, __entry->version, 912 + __entry->offset 913 + ) 914 + ); 915 + 916 + TRACE_EVENT(nfs_aop_readpage_done, 917 + TP_PROTO( 918 + const struct inode *inode, 919 + struct page *page, 920 + int ret 921 + ), 922 + 923 + TP_ARGS(inode, page, ret), 924 + 925 + TP_STRUCT__entry( 926 + __field(dev_t, dev) 927 + __field(u32, fhandle) 928 + __field(int, ret) 929 + __field(u64, fileid) 930 + __field(u64, version) 931 + __field(loff_t, offset) 932 + ), 933 + 934 + TP_fast_assign( 935 + const struct nfs_inode *nfsi = NFS_I(inode); 936 + 937 + __entry->dev = inode->i_sb->s_dev; 938 + __entry->fileid = nfsi->fileid; 939 + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 940 + __entry->version = inode_peek_iversion_raw(inode); 941 + __entry->offset = page_index(page) << PAGE_SHIFT; 942 + __entry->ret = ret; 943 + ), 944 + 945 + TP_printk( 946 + "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld ret=%d", 947 + MAJOR(__entry->dev), MINOR(__entry->dev), 948 + (unsigned long long)__entry->fileid, 949 + __entry->fhandle, __entry->version, 950 + __entry->offset, __entry->ret 951 + ) 952 + ); 953 + 954 + TRACE_EVENT(nfs_aop_readahead, 955 + TP_PROTO( 956 + const struct inode *inode, 957 + struct page *page, 958 + unsigned int nr_pages 959 + ), 960 + 961 + TP_ARGS(inode, page, nr_pages), 962 + 963 + TP_STRUCT__entry( 964 + __field(dev_t, dev) 965 + __field(u32, fhandle) 966 + __field(u64, fileid) 967 + __field(u64, version) 968 + __field(loff_t, offset) 969 + __field(unsigned int, nr_pages) 970 + ), 971 + 972 + TP_fast_assign( 973 + const struct nfs_inode *nfsi = NFS_I(inode); 974 + 975 + __entry->dev = inode->i_sb->s_dev; 976 + __entry->fileid = nfsi->fileid; 977 + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 978 + __entry->version = inode_peek_iversion_raw(inode); 979 + __entry->offset = page_index(page) << PAGE_SHIFT; 980 + __entry->nr_pages = nr_pages; 981 + ), 982 + 983 + TP_printk( 984 + "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u", 985 + MAJOR(__entry->dev), MINOR(__entry->dev), 986 + (unsigned long long)__entry->fileid, 987 + __entry->fhandle, __entry->version, 988 + __entry->offset, __entry->nr_pages 989 + ) 990 + ); 991 + 992 + TRACE_EVENT(nfs_aop_readahead_done, 993 + TP_PROTO( 994 + const struct inode *inode, 995 + unsigned int nr_pages, 996 + int ret 997 + ), 998 + 999 + TP_ARGS(inode, nr_pages, ret), 1000 + 1001 + TP_STRUCT__entry( 1002 + __field(dev_t, dev) 1003 + __field(u32, fhandle) 1004 + __field(int, ret) 1005 + __field(u64, fileid) 1006 + __field(u64, version) 1007 + __field(loff_t, offset) 1008 + __field(unsigned int, nr_pages) 1009 + ), 1010 + 1011 + TP_fast_assign( 1012 + const struct nfs_inode *nfsi = NFS_I(inode); 1013 + 1014 + __entry->dev = inode->i_sb->s_dev; 1015 + __entry->fileid = nfsi->fileid; 1016 + __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 1017 + __entry->version = inode_peek_iversion_raw(inode); 1018 + __entry->nr_pages = nr_pages; 1019 + __entry->ret = ret; 1020 + ), 1021 + 1022 + TP_printk( 1023 + "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d", 1024 + MAJOR(__entry->dev), MINOR(__entry->dev), 1025 + (unsigned long long)__entry->fileid, 1026 + __entry->fhandle, __entry->version, 1027 + __entry->nr_pages, __entry->ret 813 1028 ) 814 1029 ); 815 1030 ··· 1139 1054 ) 1140 1055 ); 1141 1056 1142 - TRACE_DEFINE_ENUM(NFS_UNSTABLE); 1143 - TRACE_DEFINE_ENUM(NFS_DATA_SYNC); 1144 - TRACE_DEFINE_ENUM(NFS_FILE_SYNC); 1145 - 1146 - #define nfs_show_stable(stable) \ 1147 - __print_symbolic(stable, \ 1148 - { NFS_UNSTABLE, "UNSTABLE" }, \ 1149 - { NFS_DATA_SYNC, "DATA_SYNC" }, \ 1150 - { NFS_FILE_SYNC, "FILE_SYNC" }) 1151 - 1152 1057 TRACE_EVENT(nfs_initiate_write, 1153 1058 TP_PROTO( 1154 1059 const struct nfs_pgio_header *hdr ··· 1152 1077 __field(u64, fileid) 1153 1078 __field(loff_t, offset) 1154 1079 __field(u32, count) 1155 - __field(enum nfs3_stable_how, stable) 1080 + __field(unsigned long, stable) 1156 1081 ), 1157 1082 1158 1083 TP_fast_assign( ··· 1176 1101 (unsigned long long)__entry->fileid, 1177 1102 __entry->fhandle, 1178 1103 (long long)__entry->offset, __entry->count, 1179 - nfs_show_stable(__entry->stable) 1104 + show_nfs_stable_how(__entry->stable) 1180 1105 ) 1181 1106 ); 1182 1107 ··· 1196 1121 __field(u32, arg_count) 1197 1122 __field(u32, res_count) 1198 1123 __field(int, status) 1199 - __field(enum nfs3_stable_how, stable) 1124 + __field(unsigned long, stable) 1200 1125 __array(char, verifier, NFS4_VERIFIER_SIZE) 1201 1126 ), 1202 1127 ··· 1229 1154 __entry->fhandle, 1230 1155 (long long)__entry->offset, __entry->arg_count, 1231 1156 __entry->res_count, __entry->status, 1232 - nfs_show_stable(__entry->stable), 1233 - __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) 1157 + show_nfs_stable_how(__entry->stable), 1158 + show_nfs4_verifier(__entry->verifier) 1234 1159 ) 1235 1160 ); 1236 1161 ··· 1331 1256 __field(u64, fileid) 1332 1257 __field(loff_t, offset) 1333 1258 __field(int, status) 1334 - __field(enum nfs3_stable_how, stable) 1259 + __field(unsigned long, stable) 1335 1260 __array(char, verifier, NFS4_VERIFIER_SIZE) 1336 1261 ), 1337 1262 ··· 1360 1285 (unsigned long long)__entry->fileid, 1361 1286 __entry->fhandle, 1362 1287 (long long)__entry->offset, __entry->status, 1363 - nfs_show_stable(__entry->stable), 1364 - __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE) 1288 + show_nfs_stable_how(__entry->stable), 1289 + show_nfs4_verifier(__entry->verifier) 1365 1290 ) 1366 1291 ); 1367 1292 ··· 1398 1323 ) 1399 1324 ); 1400 1325 1401 - TRACE_DEFINE_ENUM(NFS_OK); 1402 - TRACE_DEFINE_ENUM(NFSERR_PERM); 1403 - TRACE_DEFINE_ENUM(NFSERR_NOENT); 1404 - TRACE_DEFINE_ENUM(NFSERR_IO); 1405 - TRACE_DEFINE_ENUM(NFSERR_NXIO); 1406 - TRACE_DEFINE_ENUM(ECHILD); 1407 - TRACE_DEFINE_ENUM(NFSERR_EAGAIN); 1408 - TRACE_DEFINE_ENUM(NFSERR_ACCES); 1409 - TRACE_DEFINE_ENUM(NFSERR_EXIST); 1410 - TRACE_DEFINE_ENUM(NFSERR_XDEV); 1411 - TRACE_DEFINE_ENUM(NFSERR_NODEV); 1412 - TRACE_DEFINE_ENUM(NFSERR_NOTDIR); 1413 - TRACE_DEFINE_ENUM(NFSERR_ISDIR); 1414 - TRACE_DEFINE_ENUM(NFSERR_INVAL); 1415 - TRACE_DEFINE_ENUM(NFSERR_FBIG); 1416 - TRACE_DEFINE_ENUM(NFSERR_NOSPC); 1417 - TRACE_DEFINE_ENUM(NFSERR_ROFS); 1418 - TRACE_DEFINE_ENUM(NFSERR_MLINK); 1419 - TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP); 1420 - TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG); 1421 - TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY); 1422 - TRACE_DEFINE_ENUM(NFSERR_DQUOT); 1423 - TRACE_DEFINE_ENUM(NFSERR_STALE); 1424 - TRACE_DEFINE_ENUM(NFSERR_REMOTE); 1425 - TRACE_DEFINE_ENUM(NFSERR_WFLUSH); 1426 - TRACE_DEFINE_ENUM(NFSERR_BADHANDLE); 1427 - TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC); 1428 - TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE); 1429 - TRACE_DEFINE_ENUM(NFSERR_NOTSUPP); 1430 - TRACE_DEFINE_ENUM(NFSERR_TOOSMALL); 1431 - TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT); 1432 - TRACE_DEFINE_ENUM(NFSERR_BADTYPE); 1433 - TRACE_DEFINE_ENUM(NFSERR_JUKEBOX); 1434 - 1435 - #define nfs_show_status(x) \ 1436 - __print_symbolic(x, \ 1437 - { NFS_OK, "OK" }, \ 1438 - { NFSERR_PERM, "PERM" }, \ 1439 - { NFSERR_NOENT, "NOENT" }, \ 1440 - { NFSERR_IO, "IO" }, \ 1441 - { NFSERR_NXIO, "NXIO" }, \ 1442 - { ECHILD, "CHILD" }, \ 1443 - { NFSERR_EAGAIN, "AGAIN" }, \ 1444 - { NFSERR_ACCES, "ACCES" }, \ 1445 - { NFSERR_EXIST, "EXIST" }, \ 1446 - { NFSERR_XDEV, "XDEV" }, \ 1447 - { NFSERR_NODEV, "NODEV" }, \ 1448 - { NFSERR_NOTDIR, "NOTDIR" }, \ 1449 - { NFSERR_ISDIR, "ISDIR" }, \ 1450 - { NFSERR_INVAL, "INVAL" }, \ 1451 - { NFSERR_FBIG, "FBIG" }, \ 1452 - { NFSERR_NOSPC, "NOSPC" }, \ 1453 - { NFSERR_ROFS, "ROFS" }, \ 1454 - { NFSERR_MLINK, "MLINK" }, \ 1455 - { NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \ 1456 - { NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \ 1457 - { NFSERR_NOTEMPTY, "NOTEMPTY" }, \ 1458 - { NFSERR_DQUOT, "DQUOT" }, \ 1459 - { NFSERR_STALE, "STALE" }, \ 1460 - { NFSERR_REMOTE, "REMOTE" }, \ 1461 - { NFSERR_WFLUSH, "WFLUSH" }, \ 1462 - { NFSERR_BADHANDLE, "BADHANDLE" }, \ 1463 - { NFSERR_NOT_SYNC, "NOTSYNC" }, \ 1464 - { NFSERR_BAD_COOKIE, "BADCOOKIE" }, \ 1465 - { NFSERR_NOTSUPP, "NOTSUPP" }, \ 1466 - { NFSERR_TOOSMALL, "TOOSMALL" }, \ 1467 - { NFSERR_SERVERFAULT, "REMOTEIO" }, \ 1468 - { NFSERR_BADTYPE, "BADTYPE" }, \ 1469 - { NFSERR_JUKEBOX, "JUKEBOX" }) 1470 - 1471 1326 DECLARE_EVENT_CLASS(nfs_xdr_event, 1472 1327 TP_PROTO( 1473 1328 const struct xdr_stream *xdr, ··· 1432 1427 __assign_str(procedure, task->tk_msg.rpc_proc->p_name); 1433 1428 ), 1434 1429 1435 - TP_printk( 1436 - "task:%u@%d xid=0x%08x %sv%d %s error=%ld (%s)", 1430 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1431 + " xid=0x%08x %sv%d %s error=%ld (%s)", 1437 1432 __entry->task_id, __entry->client_id, __entry->xid, 1438 1433 __get_str(program), __entry->version, 1439 1434 __get_str(procedure), -__entry->error, 1440 - nfs_show_status(__entry->error) 1435 + show_nfs_status(__entry->error) 1441 1436 ) 1442 1437 ); 1443 1438 #define DEFINE_NFS_XDR_EVENT(name) \
+2 -11
fs/nfs/pagelist.c
··· 271 271 void 272 272 nfs_page_clear_headlock(struct nfs_page *req) 273 273 { 274 - smp_mb__before_atomic(); 275 - clear_bit(PG_HEADLOCK, &req->wb_flags); 274 + clear_bit_unlock(PG_HEADLOCK, &req->wb_flags); 276 275 smp_mb__after_atomic(); 277 276 if (!test_bit(PG_CONTENDED1, &req->wb_flags)) 278 277 return; ··· 524 525 */ 525 526 void nfs_unlock_request(struct nfs_page *req) 526 527 { 527 - if (!NFS_WBACK_BUSY(req)) { 528 - printk(KERN_ERR "NFS: Invalid unlock attempted\n"); 529 - BUG(); 530 - } 531 - smp_mb__before_atomic(); 532 - clear_bit(PG_BUSY, &req->wb_flags); 528 + clear_bit_unlock(PG_BUSY, &req->wb_flags); 533 529 smp_mb__after_atomic(); 534 530 if (!test_bit(PG_CONTENDED2, &req->wb_flags)) 535 531 return; ··· 863 869 { 864 870 struct nfs_pgio_header *hdr = calldata; 865 871 struct inode *inode = hdr->inode; 866 - 867 - dprintk("NFS: %s: %5u, (status %d)\n", __func__, 868 - task->tk_pid, task->tk_status); 869 872 870 873 if (hdr->rw_ops->rw_done(task, hdr, inode) != 0) 871 874 return;
+1 -5
fs/nfs/pnfs.h
··· 82 82 PNFS_TRY_AGAIN = 2, 83 83 }; 84 84 85 - /* error codes for internal use */ 86 - #define NFS4ERR_RESET_TO_MDS 12001 87 - #define NFS4ERR_RESET_TO_PNFS 12002 88 - 89 85 #ifdef CONFIG_NFS_V4_1 90 86 91 87 #define LAYOUT_NFSV4_1_MODULE_PREFIX "nfs-layouttype4" ··· 513 517 { 514 518 struct pnfs_ds_commit_info *fl_cinfo = cinfo->ds; 515 519 516 - if (!lseg || !fl_cinfo->ops->mark_request_commit) 520 + if (!lseg || !fl_cinfo->ops || !fl_cinfo->ops->mark_request_commit) 517 521 return false; 518 522 fl_cinfo->ops->mark_request_commit(req, lseg, cinfo, ds_commit_idx); 519 523 return true;
+2 -4
fs/nfs/pnfs_nfs.c
··· 468 468 goto out_error; 469 469 data->ds_commit_index = i; 470 470 list_add_tail(&data->list, list); 471 - atomic_inc(&cinfo->mds->rpcs_out); 472 471 nreq++; 473 472 } 474 473 mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex); ··· 519 520 data->ds_commit_index = -1; 520 521 list_splice_init(mds_pages, &data->pages); 521 522 list_add_tail(&data->list, &list); 522 - atomic_inc(&cinfo->mds->rpcs_out); 523 523 nreq++; 524 524 } 525 525 ··· 893 895 } 894 896 895 897 smp_wmb(); 896 - ds->ds_clp = clp; 898 + WRITE_ONCE(ds->ds_clp, clp); 897 899 dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr); 898 900 out: 899 901 return status; ··· 971 973 } 972 974 973 975 smp_wmb(); 974 - ds->ds_clp = clp; 976 + WRITE_ONCE(ds->ds_clp, clp); 975 977 dprintk("%s [new] addr: %s\n", __func__, ds->ds_remotestr); 976 978 out: 977 979 return status;
+7 -9
fs/nfs/proc.c
··· 91 91 info->dtpref = fsinfo.tsize; 92 92 info->maxfilesize = 0x7FFFFFFF; 93 93 info->lease_time = 0; 94 - info->change_attr_type = NFS4_CHANGE_TYPE_IS_TIME_METADATA; 94 + info->change_attr_type = NFS4_CHANGE_TYPE_IS_UNDEFINED; 95 95 return 0; 96 96 } 97 97 ··· 100 100 */ 101 101 static int 102 102 nfs_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, 103 - struct nfs_fattr *fattr, struct nfs4_label *label, 104 - struct inode *inode) 103 + struct nfs_fattr *fattr, struct inode *inode) 105 104 { 106 105 struct rpc_message msg = { 107 106 .rpc_proc = &nfs_procedures[NFSPROC_GETATTR], ··· 153 154 154 155 static int 155 156 nfs_proc_lookup(struct inode *dir, struct dentry *dentry, 156 - struct nfs_fh *fhandle, struct nfs_fattr *fattr, 157 - struct nfs4_label *label) 157 + struct nfs_fh *fhandle, struct nfs_fattr *fattr) 158 158 { 159 159 struct nfs_diropargs arg = { 160 160 .fh = NFS_FH(dir), ··· 255 257 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 256 258 nfs_mark_for_revalidate(dir); 257 259 if (status == 0) 258 - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); 260 + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 259 261 nfs_free_createdata(data); 260 262 out: 261 263 dprintk("NFS reply create: %d\n", status); ··· 302 304 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 303 305 } 304 306 if (status == 0) 305 - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); 307 + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 306 308 nfs_free_createdata(data); 307 309 out: 308 310 dprintk("NFS reply mknod: %d\n", status); ··· 434 436 * should fill in the data with a LOOKUP call on the wire. 435 437 */ 436 438 if (status == 0) 437 - status = nfs_instantiate(dentry, fh, fattr, NULL); 439 + status = nfs_instantiate(dentry, fh, fattr); 438 440 439 441 out_free: 440 442 nfs_free_fattr(fattr); ··· 463 465 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 464 466 nfs_mark_for_revalidate(dir); 465 467 if (status == 0) 466 - status = nfs_instantiate(dentry, data->res.fh, data->res.fattr, NULL); 468 + status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); 467 469 nfs_free_createdata(data); 468 470 out: 469 471 dprintk("NFS reply mkdir: %d\n", status);
+5 -6
fs/nfs/read.c
··· 337 337 struct inode *inode = page_file_mapping(page)->host; 338 338 int ret; 339 339 340 - dprintk("NFS: nfs_readpage (%p %ld@%lu)\n", 341 - page, PAGE_SIZE, page_index(page)); 340 + trace_nfs_aop_readpage(inode, page); 342 341 nfs_inc_stats(inode, NFSIOS_VFSREADPAGE); 343 342 344 343 /* ··· 389 390 } 390 391 out: 391 392 put_nfs_open_context(desc.ctx); 393 + trace_nfs_aop_readpage_done(inode, page, ret); 392 394 return ret; 393 395 out_unlock: 394 396 unlock_page(page); 397 + trace_nfs_aop_readpage_done(inode, page, ret); 395 398 return ret; 396 399 } 397 400 ··· 404 403 struct inode *inode = mapping->host; 405 404 int ret; 406 405 407 - dprintk("NFS: nfs_readpages (%s/%Lu %d)\n", 408 - inode->i_sb->s_id, 409 - (unsigned long long)NFS_FILEID(inode), 410 - nr_pages); 406 + trace_nfs_aop_readahead(inode, lru_to_page(pages), nr_pages); 411 407 nfs_inc_stats(inode, NFSIOS_VFSREADPAGES); 412 408 413 409 ret = -ESTALE; ··· 437 439 read_complete: 438 440 put_nfs_open_context(desc.ctx); 439 441 out: 442 + trace_nfs_aop_readahead_done(inode, nr_pages, ret); 440 443 return ret; 441 444 } 442 445
+6 -1
fs/nfs/super.c
··· 1004 1004 struct nfs_fs_context *ctx = nfs_fc2context(fc); 1005 1005 struct super_block *sb = fc->root->d_sb; 1006 1006 struct nfs_server *nfss = sb->s_fs_info; 1007 + int ret; 1007 1008 1008 1009 sync_filesystem(sb); 1009 1010 ··· 1029 1028 } 1030 1029 1031 1030 /* compare new mount options with old ones */ 1032 - return nfs_compare_remount_data(nfss, ctx); 1031 + ret = nfs_compare_remount_data(nfss, ctx); 1032 + if (ret) 1033 + return ret; 1034 + 1035 + return nfs_probe_server(nfss, NFS_FH(d_inode(fc->root))); 1033 1036 } 1034 1037 EXPORT_SYMBOL_GPL(nfs_reconfigure); 1035 1038
+37 -36
fs/nfs/write.c
··· 288 288 end = page_file_offset(page) + ((loff_t)offset+count); 289 289 if (i_size >= end) 290 290 goto out; 291 + trace_nfs_size_grow(inode, end); 291 292 i_size_write(inode, end); 292 293 NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_SIZE; 293 294 nfs_inc_stats(inode, NFSIOS_EXTENDWRITE); ··· 1039 1038 struct nfs_page *req, *tmp; 1040 1039 int ret = 0; 1041 1040 1042 - restart: 1043 1041 list_for_each_entry_safe(req, tmp, src, wb_list) { 1044 1042 kref_get(&req->wb_kref); 1045 1043 if (!nfs_lock_request(req)) { 1046 - int status; 1047 - 1048 - /* Prevent deadlock with nfs_lock_and_join_requests */ 1049 - if (!list_empty(dst)) { 1050 - nfs_release_request(req); 1051 - continue; 1052 - } 1053 - /* Ensure we make progress to prevent livelock */ 1054 - mutex_unlock(&NFS_I(cinfo->inode)->commit_mutex); 1055 - status = nfs_wait_on_request(req); 1056 1044 nfs_release_request(req); 1057 - mutex_lock(&NFS_I(cinfo->inode)->commit_mutex); 1058 - if (status < 0) 1059 - break; 1060 - goto restart; 1045 + continue; 1061 1046 } 1062 1047 nfs_request_remove_commit_list(req, cinfo); 1063 1048 clear_bit(PG_COMMIT_TO_DS, &req->wb_flags); ··· 1233 1246 struct nfs_open_context *ctx = nfs_file_open_context(filp); 1234 1247 1235 1248 if (nfs_ctx_key_to_expire(ctx, inode) && 1236 - !ctx->ll_cred) 1249 + !rcu_access_pointer(ctx->ll_cred)) 1237 1250 /* Already expired! */ 1238 1251 return -EACCES; 1239 1252 return 0; ··· 1245 1258 bool nfs_ctx_key_to_expire(struct nfs_open_context *ctx, struct inode *inode) 1246 1259 { 1247 1260 struct rpc_auth *auth = NFS_SERVER(inode)->client->cl_auth; 1248 - struct rpc_cred *cred = ctx->ll_cred; 1261 + struct rpc_cred *cred, *new, *old = NULL; 1249 1262 struct auth_cred acred = { 1250 1263 .cred = ctx->cred, 1251 1264 }; 1265 + bool ret = false; 1252 1266 1253 - if (cred && !cred->cr_ops->crmatch(&acred, cred, 0)) { 1254 - put_rpccred(cred); 1255 - ctx->ll_cred = NULL; 1256 - cred = NULL; 1257 - } 1258 - if (!cred) 1259 - cred = auth->au_ops->lookup_cred(auth, &acred, 0); 1260 - if (!cred || IS_ERR(cred)) 1267 + rcu_read_lock(); 1268 + cred = rcu_dereference(ctx->ll_cred); 1269 + if (cred && !(cred->cr_ops->crkey_timeout && 1270 + cred->cr_ops->crkey_timeout(cred))) 1271 + goto out; 1272 + rcu_read_unlock(); 1273 + 1274 + new = auth->au_ops->lookup_cred(auth, &acred, 0); 1275 + if (new == cred) { 1276 + put_rpccred(new); 1261 1277 return true; 1262 - ctx->ll_cred = cred; 1263 - return !!(cred->cr_ops->crkey_timeout && 1264 - cred->cr_ops->crkey_timeout(cred)); 1278 + } 1279 + if (IS_ERR_OR_NULL(new)) { 1280 + new = NULL; 1281 + ret = true; 1282 + } else if (new->cr_ops->crkey_timeout && 1283 + new->cr_ops->crkey_timeout(new)) 1284 + ret = true; 1285 + 1286 + rcu_read_lock(); 1287 + old = rcu_dereference_protected(xchg(&ctx->ll_cred, 1288 + RCU_INITIALIZER(new)), 1); 1289 + out: 1290 + rcu_read_unlock(); 1291 + put_rpccred(old); 1292 + return ret; 1265 1293 } 1266 1294 1267 1295 /* ··· 1384 1382 status = nfs_writepage_setup(ctx, page, offset, count); 1385 1383 if (status < 0) 1386 1384 nfs_set_pageerror(mapping); 1387 - else 1388 - __set_page_dirty_nobuffers(page); 1389 1385 out: 1390 1386 dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n", 1391 1387 status, (long long)i_size_read(inode)); ··· 1671 1671 atomic_inc(&cinfo->rpcs_out); 1672 1672 } 1673 1673 1674 - static void nfs_commit_end(struct nfs_mds_commit_info *cinfo) 1674 + bool nfs_commit_end(struct nfs_mds_commit_info *cinfo) 1675 1675 { 1676 - if (atomic_dec_and_test(&cinfo->rpcs_out)) 1676 + if (atomic_dec_and_test(&cinfo->rpcs_out)) { 1677 1677 wake_up_var(&cinfo->rpcs_out); 1678 + return true; 1679 + } 1680 + return false; 1678 1681 } 1679 1682 1680 1683 void nfs_commitdata_release(struct nfs_commit_data *data) ··· 1777 1774 data->res.fattr = &data->fattr; 1778 1775 data->res.verf = &data->verf; 1779 1776 nfs_fattr_init(&data->fattr); 1777 + nfs_commit_begin(cinfo->mds); 1780 1778 } 1781 1779 EXPORT_SYMBOL_GPL(nfs_init_commit); 1782 1780 ··· 1824 1820 1825 1821 /* Set up the argument struct */ 1826 1822 nfs_init_commit(data, head, NULL, cinfo); 1827 - atomic_inc(&cinfo->mds->rpcs_out); 1828 1823 if (NFS_SERVER(inode)->nfs_client->cl_minorversion) 1829 1824 task_flags = RPC_TASK_MOVEABLE; 1830 1825 return nfs_initiate_commit(NFS_CLIENT(inode), data, NFS_PROTO(inode), ··· 1837 1834 static void nfs_commit_done(struct rpc_task *task, void *calldata) 1838 1835 { 1839 1836 struct nfs_commit_data *data = calldata; 1840 - 1841 - dprintk("NFS: %5u nfs_commit_done (status %d)\n", 1842 - task->tk_pid, task->tk_status); 1843 1837 1844 1838 /* Call the NFS version-specific code */ 1845 1839 NFS_PROTO(data->inode)->commit_done(task, data); ··· 1936 1936 int may_wait = how & FLUSH_SYNC; 1937 1937 int ret, nscan; 1938 1938 1939 + how &= ~FLUSH_SYNC; 1939 1940 nfs_init_cinfo_from_inode(&cinfo, inode); 1940 1941 nfs_commit_begin(cinfo.mds); 1941 1942 for (;;) {
+1
fs/nfsd/trace.h
··· 9 9 #define _NFSD_TRACE_H 10 10 11 11 #include <linux/tracepoint.h> 12 + 12 13 #include "export.h" 13 14 #include "nfsfh.h" 14 15
+4
include/linux/nfs4.h
··· 292 292 NFS4ERR_XATTR2BIG = 10096, 293 293 }; 294 294 295 + /* error codes for internal client use */ 296 + #define NFS4ERR_RESET_TO_MDS 12001 297 + #define NFS4ERR_RESET_TO_PNFS 12002 298 + 295 299 static inline bool seqid_mutating_err(u32 err) 296 300 { 297 301 /* See RFC 7530, section 9.1.7 */
+48 -29
include/linux/nfs_fs.h
··· 81 81 fl_owner_t flock_owner; 82 82 struct dentry *dentry; 83 83 const struct cred *cred; 84 - struct rpc_cred *ll_cred; /* low-level cred - use to check for expiry */ 84 + struct rpc_cred __rcu *ll_cred; /* low-level cred - use to check for expiry */ 85 85 struct nfs4_state *state; 86 86 fmode_t mode; 87 87 ··· 103 103 __be32 verf[NFS_DIR_VERIFIER_SIZE]; 104 104 __u64 dir_cookie; 105 105 __u64 dup_cookie; 106 + pgoff_t page_index; 106 107 signed char duped; 107 108 }; 108 109 ··· 155 154 unsigned long attrtimeo_timestamp; 156 155 157 156 unsigned long attr_gencount; 158 - /* "Generation counter" for the attribute cache. This is 159 - * bumped whenever we update the metadata on the 160 - * server. 161 - */ 162 - unsigned long cache_change_attribute; 163 157 164 158 struct rb_root access_cache; 165 159 struct list_head access_cache_entry_lru; 166 160 struct list_head access_cache_inode_lru; 167 161 168 - /* 169 - * This is the cookie verifier used for NFSv3 readdir 170 - * operations 171 - */ 172 - __be32 cookieverf[NFS_DIR_VERIFIER_SIZE]; 173 - 174 - atomic_long_t nrequests; 175 - struct nfs_mds_commit_info commit_info; 162 + union { 163 + /* Directory */ 164 + struct { 165 + /* "Generation counter" for the attribute cache. 166 + * This is bumped whenever we update the metadata 167 + * on the server. 168 + */ 169 + unsigned long cache_change_attribute; 170 + /* 171 + * This is the cookie verifier used for NFSv3 readdir 172 + * operations 173 + */ 174 + __be32 cookieverf[NFS_DIR_VERIFIER_SIZE]; 175 + /* Readers: in-flight sillydelete RPC calls */ 176 + /* Writers: rmdir */ 177 + struct rw_semaphore rmdir_sem; 178 + }; 179 + /* Regular file */ 180 + struct { 181 + atomic_long_t nrequests; 182 + struct nfs_mds_commit_info commit_info; 183 + struct mutex commit_mutex; 184 + }; 185 + }; 176 186 177 187 /* Open contexts for shared mmap writes */ 178 188 struct list_head open_files; 179 - 180 - /* Readers: in-flight sillydelete RPC calls */ 181 - /* Writers: rmdir */ 182 - struct rw_semaphore rmdir_sem; 183 - struct mutex commit_mutex; 184 - 185 - /* track last access to cached pages */ 186 - unsigned long page_index; 187 189 188 190 #if IS_ENABLED(CONFIG_NFS_V4) 189 191 struct nfs4_cached_acl *nfs4_acl; ··· 276 272 #define NFS_INO_INVALIDATING (3) /* inode is being invalidated */ 277 273 #define NFS_INO_FSCACHE (5) /* inode can be cached by FS-Cache */ 278 274 #define NFS_INO_FSCACHE_LOCK (6) /* FS-Cache cookie management lock */ 275 + #define NFS_INO_FORCE_READDIR (7) /* force readdirplus */ 279 276 #define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */ 280 277 #define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */ 281 278 #define NFS_INO_LAYOUTSTATS (11) /* layoutstats inflight */ ··· 388 383 extern void nfs_set_inode_stale(struct inode *inode); 389 384 extern void nfs_invalidate_atime(struct inode *); 390 385 extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 391 - struct nfs_fattr *, struct nfs4_label *); 386 + struct nfs_fattr *); 392 387 struct inode *nfs_ilookup(struct super_block *sb, struct nfs_fattr *, struct nfs_fh *); 393 388 extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 394 389 extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); ··· 409 404 extern int nfs_revalidate_mapping_rcu(struct inode *inode); 410 405 extern int nfs_setattr(struct user_namespace *, struct dentry *, struct iattr *); 411 406 extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr, struct nfs_fattr *); 412 - extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr, 413 - struct nfs4_label *label); 407 + extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr); 414 408 extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 415 409 extern void put_nfs_open_context(struct nfs_open_context *ctx); 416 410 extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, const struct cred *cred, fmode_t mode); ··· 425 421 extern unsigned long nfs_inc_attr_generation_counter(void); 426 422 427 423 extern struct nfs_fattr *nfs_alloc_fattr(void); 424 + extern struct nfs_fattr *nfs_alloc_fattr_with_label(struct nfs_server *server); 425 + 426 + static inline void nfs4_label_free(struct nfs4_label *label) 427 + { 428 + #ifdef CONFIG_NFS_V4_SECURITY_LABEL 429 + if (label) { 430 + kfree(label->label); 431 + kfree(label); 432 + } 433 + #endif 434 + } 428 435 429 436 static inline void nfs_free_fattr(const struct nfs_fattr *fattr) 430 437 { 438 + if (fattr) 439 + nfs4_label_free(fattr->label); 431 440 kfree(fattr); 432 441 } 433 442 ··· 528 511 extern void nfs_clear_verifier_delegated(struct inode *inode); 529 512 #endif /* IS_ENABLED(CONFIG_NFS_V4) */ 530 513 extern struct dentry *nfs_add_or_obtain(struct dentry *dentry, 531 - struct nfs_fh *fh, struct nfs_fattr *fattr, 532 - struct nfs4_label *label); 514 + struct nfs_fh *fh, struct nfs_fattr *fattr); 533 515 extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, 534 - struct nfs_fattr *fattr, struct nfs4_label *label); 516 + struct nfs_fattr *fattr); 535 517 extern int nfs_may_open(struct inode *inode, const struct cred *cred, int openflags); 536 518 extern void nfs_access_zap_cache(struct inode *inode); 537 519 extern int nfs_access_get_cached(struct inode *inode, const struct cred *cred, struct nfs_access_entry *res, ··· 585 569 extern int nfs_commit_inode(struct inode *, int); 586 570 extern struct nfs_commit_data *nfs_commitdata_alloc(bool never_fail); 587 571 extern void nfs_commit_free(struct nfs_commit_data *data); 572 + bool nfs_commit_end(struct nfs_mds_commit_info *cinfo); 588 573 589 574 static inline int 590 575 nfs_have_writebacks(struct inode *inode) 591 576 { 592 - return atomic_long_read(&NFS_I(inode)->nrequests) != 0; 577 + if (S_ISREG(inode->i_mode)) 578 + return atomic_long_read(&NFS_I(inode)->nrequests) != 0; 579 + return 0; 593 580 } 594 581 595 582 /*
+3 -13
include/linux/nfs_xdr.h
··· 488 488 struct nfs4_change_info cinfo; 489 489 __u32 rflags; 490 490 struct nfs_fattr * f_attr; 491 - struct nfs4_label *f_label; 492 491 struct nfs_seqid * seqid; 493 492 const struct nfs_server *server; 494 493 fmode_t delegation_type; ··· 752 753 int eof; 753 754 struct nfs_fh * fh; 754 755 struct nfs_fattr * fattr; 755 - struct nfs4_label *label; 756 756 unsigned char d_type; 757 757 struct nfs_server * server; 758 758 }; ··· 832 834 struct nfs_setattrres { 833 835 struct nfs4_sequence_res seq_res; 834 836 struct nfs_fattr * fattr; 835 - struct nfs4_label *label; 836 837 const struct nfs_server * server; 837 838 }; 838 839 ··· 1038 1041 const struct nfs_server * server; 1039 1042 struct nfs_fh * fh; 1040 1043 struct nfs_fattr * fattr; 1041 - struct nfs4_label *label; 1042 1044 struct nfs4_change_info dir_cinfo; 1043 1045 }; 1044 1046 ··· 1062 1066 struct nfs4_sequence_res seq_res; 1063 1067 const struct nfs_server * server; 1064 1068 struct nfs_fattr * fattr; 1065 - struct nfs4_label *label; 1066 1069 }; 1067 1070 1068 1071 struct nfs4_link_arg { ··· 1076 1081 struct nfs4_sequence_res seq_res; 1077 1082 const struct nfs_server * server; 1078 1083 struct nfs_fattr * fattr; 1079 - struct nfs4_label *label; 1080 1084 struct nfs4_change_info cinfo; 1081 1085 struct nfs_fattr * dir_attr; 1082 1086 }; ··· 1092 1098 const struct nfs_server * server; 1093 1099 struct nfs_fattr * fattr; 1094 1100 struct nfs_fh * fh; 1095 - struct nfs4_label *label; 1096 1101 }; 1097 1102 1098 1103 struct nfs4_lookupp_arg { ··· 1105 1112 const struct nfs_server *server; 1106 1113 struct nfs_fattr *fattr; 1107 1114 struct nfs_fh *fh; 1108 - struct nfs4_label *label; 1109 1115 }; 1110 1116 1111 1117 struct nfs4_lookup_root_arg { ··· 1730 1738 int (*submount) (struct fs_context *, struct nfs_server *); 1731 1739 int (*try_get_tree) (struct fs_context *); 1732 1740 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1733 - struct nfs_fattr *, struct nfs4_label *, 1734 - struct inode *); 1741 + struct nfs_fattr *, struct inode *); 1735 1742 int (*setattr) (struct dentry *, struct nfs_fattr *, 1736 1743 struct iattr *); 1737 1744 int (*lookup) (struct inode *, struct dentry *, 1738 - struct nfs_fh *, struct nfs_fattr *, 1739 - struct nfs4_label *); 1745 + struct nfs_fh *, struct nfs_fattr *); 1740 1746 int (*lookupp) (struct inode *, struct nfs_fh *, 1741 - struct nfs_fattr *, struct nfs4_label *); 1747 + struct nfs_fattr *); 1742 1748 int (*access) (struct inode *, struct nfs_access_entry *); 1743 1749 int (*readlink)(struct inode *, struct page *, unsigned int, 1744 1750 unsigned int);
-317
include/linux/pnfs_osd_xdr.h
··· 1 - /* 2 - * pNFS-osd on-the-wire data structures 3 - * 4 - * Copyright (C) 2007 Panasas Inc. [year of first publication] 5 - * All rights reserved. 6 - * 7 - * Benny Halevy <bhalevy@panasas.com> 8 - * Boaz Harrosh <ooo@electrozaur.com> 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 12 - * See the file COPYING included with this distribution for more details. 13 - * 14 - * Redistribution and use in source and binary forms, with or without 15 - * modification, are permitted provided that the following conditions 16 - * are met: 17 - * 18 - * 1. Redistributions of source code must retain the above copyright 19 - * notice, this list of conditions and the following disclaimer. 20 - * 2. Redistributions in binary form must reproduce the above copyright 21 - * notice, this list of conditions and the following disclaimer in the 22 - * documentation and/or other materials provided with the distribution. 23 - * 3. Neither the name of the Panasas company nor the names of its 24 - * contributors may be used to endorse or promote products derived 25 - * from this software without specific prior written permission. 26 - * 27 - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 28 - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 29 - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 30 - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 31 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 34 - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 35 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 37 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 - */ 39 - #ifndef __PNFS_OSD_XDR_H__ 40 - #define __PNFS_OSD_XDR_H__ 41 - 42 - #include <linux/nfs_fs.h> 43 - 44 - /* 45 - * draft-ietf-nfsv4-minorversion-22 46 - * draft-ietf-nfsv4-pnfs-obj-12 47 - */ 48 - 49 - /* Layout Structure */ 50 - 51 - enum pnfs_osd_raid_algorithm4 { 52 - PNFS_OSD_RAID_0 = 1, 53 - PNFS_OSD_RAID_4 = 2, 54 - PNFS_OSD_RAID_5 = 3, 55 - PNFS_OSD_RAID_PQ = 4 /* Reed-Solomon P+Q */ 56 - }; 57 - 58 - /* struct pnfs_osd_data_map4 { 59 - * uint32_t odm_num_comps; 60 - * length4 odm_stripe_unit; 61 - * uint32_t odm_group_width; 62 - * uint32_t odm_group_depth; 63 - * uint32_t odm_mirror_cnt; 64 - * pnfs_osd_raid_algorithm4 odm_raid_algorithm; 65 - * }; 66 - */ 67 - struct pnfs_osd_data_map { 68 - u32 odm_num_comps; 69 - u64 odm_stripe_unit; 70 - u32 odm_group_width; 71 - u32 odm_group_depth; 72 - u32 odm_mirror_cnt; 73 - u32 odm_raid_algorithm; 74 - }; 75 - 76 - /* struct pnfs_osd_objid4 { 77 - * deviceid4 oid_device_id; 78 - * uint64_t oid_partition_id; 79 - * uint64_t oid_object_id; 80 - * }; 81 - */ 82 - struct pnfs_osd_objid { 83 - struct nfs4_deviceid oid_device_id; 84 - u64 oid_partition_id; 85 - u64 oid_object_id; 86 - }; 87 - 88 - /* For printout. I use: 89 - * kprint("dev(%llx:%llx)", _DEVID_LO(pointer), _DEVID_HI(pointer)); 90 - * BE style 91 - */ 92 - #define _DEVID_LO(oid_device_id) \ 93 - (unsigned long long)be64_to_cpup((__be64 *)(oid_device_id)->data) 94 - 95 - #define _DEVID_HI(oid_device_id) \ 96 - (unsigned long long)be64_to_cpup(((__be64 *)(oid_device_id)->data) + 1) 97 - 98 - enum pnfs_osd_version { 99 - PNFS_OSD_MISSING = 0, 100 - PNFS_OSD_VERSION_1 = 1, 101 - PNFS_OSD_VERSION_2 = 2 102 - }; 103 - 104 - struct pnfs_osd_opaque_cred { 105 - u32 cred_len; 106 - void *cred; 107 - }; 108 - 109 - enum pnfs_osd_cap_key_sec { 110 - PNFS_OSD_CAP_KEY_SEC_NONE = 0, 111 - PNFS_OSD_CAP_KEY_SEC_SSV = 1, 112 - }; 113 - 114 - /* struct pnfs_osd_object_cred4 { 115 - * pnfs_osd_objid4 oc_object_id; 116 - * pnfs_osd_version4 oc_osd_version; 117 - * pnfs_osd_cap_key_sec4 oc_cap_key_sec; 118 - * opaque oc_capability_key<>; 119 - * opaque oc_capability<>; 120 - * }; 121 - */ 122 - struct pnfs_osd_object_cred { 123 - struct pnfs_osd_objid oc_object_id; 124 - u32 oc_osd_version; 125 - u32 oc_cap_key_sec; 126 - struct pnfs_osd_opaque_cred oc_cap_key; 127 - struct pnfs_osd_opaque_cred oc_cap; 128 - }; 129 - 130 - /* struct pnfs_osd_layout4 { 131 - * pnfs_osd_data_map4 olo_map; 132 - * uint32_t olo_comps_index; 133 - * pnfs_osd_object_cred4 olo_components<>; 134 - * }; 135 - */ 136 - struct pnfs_osd_layout { 137 - struct pnfs_osd_data_map olo_map; 138 - u32 olo_comps_index; 139 - u32 olo_num_comps; 140 - struct pnfs_osd_object_cred *olo_comps; 141 - }; 142 - 143 - /* Device Address */ 144 - enum pnfs_osd_targetid_type { 145 - OBJ_TARGET_ANON = 1, 146 - OBJ_TARGET_SCSI_NAME = 2, 147 - OBJ_TARGET_SCSI_DEVICE_ID = 3, 148 - }; 149 - 150 - /* union pnfs_osd_targetid4 switch (pnfs_osd_targetid_type4 oti_type) { 151 - * case OBJ_TARGET_SCSI_NAME: 152 - * string oti_scsi_name<>; 153 - * 154 - * case OBJ_TARGET_SCSI_DEVICE_ID: 155 - * opaque oti_scsi_device_id<>; 156 - * 157 - * default: 158 - * void; 159 - * }; 160 - * 161 - * union pnfs_osd_targetaddr4 switch (bool ota_available) { 162 - * case TRUE: 163 - * netaddr4 ota_netaddr; 164 - * case FALSE: 165 - * void; 166 - * }; 167 - * 168 - * struct pnfs_osd_deviceaddr4 { 169 - * pnfs_osd_targetid4 oda_targetid; 170 - * pnfs_osd_targetaddr4 oda_targetaddr; 171 - * uint64_t oda_lun; 172 - * opaque oda_systemid<>; 173 - * pnfs_osd_object_cred4 oda_root_obj_cred; 174 - * opaque oda_osdname<>; 175 - * }; 176 - */ 177 - struct pnfs_osd_targetid { 178 - u32 oti_type; 179 - struct nfs4_string oti_scsi_device_id; 180 - }; 181 - 182 - /* struct netaddr4 { 183 - * // see struct rpcb in RFC1833 184 - * string r_netid<>; // network id 185 - * string r_addr<>; // universal address 186 - * }; 187 - */ 188 - struct pnfs_osd_net_addr { 189 - struct nfs4_string r_netid; 190 - struct nfs4_string r_addr; 191 - }; 192 - 193 - struct pnfs_osd_targetaddr { 194 - u32 ota_available; 195 - struct pnfs_osd_net_addr ota_netaddr; 196 - }; 197 - 198 - struct pnfs_osd_deviceaddr { 199 - struct pnfs_osd_targetid oda_targetid; 200 - struct pnfs_osd_targetaddr oda_targetaddr; 201 - u8 oda_lun[8]; 202 - struct nfs4_string oda_systemid; 203 - struct pnfs_osd_object_cred oda_root_obj_cred; 204 - struct nfs4_string oda_osdname; 205 - }; 206 - 207 - /* LAYOUTCOMMIT: layoutupdate */ 208 - 209 - /* union pnfs_osd_deltaspaceused4 switch (bool dsu_valid) { 210 - * case TRUE: 211 - * int64_t dsu_delta; 212 - * case FALSE: 213 - * void; 214 - * }; 215 - * 216 - * struct pnfs_osd_layoutupdate4 { 217 - * pnfs_osd_deltaspaceused4 olu_delta_space_used; 218 - * bool olu_ioerr_flag; 219 - * }; 220 - */ 221 - struct pnfs_osd_layoutupdate { 222 - u32 dsu_valid; 223 - s64 dsu_delta; 224 - u32 olu_ioerr_flag; 225 - }; 226 - 227 - /* LAYOUTRETURN: I/O Rrror Report */ 228 - 229 - enum pnfs_osd_errno { 230 - PNFS_OSD_ERR_EIO = 1, 231 - PNFS_OSD_ERR_NOT_FOUND = 2, 232 - PNFS_OSD_ERR_NO_SPACE = 3, 233 - PNFS_OSD_ERR_BAD_CRED = 4, 234 - PNFS_OSD_ERR_NO_ACCESS = 5, 235 - PNFS_OSD_ERR_UNREACHABLE = 6, 236 - PNFS_OSD_ERR_RESOURCE = 7 237 - }; 238 - 239 - /* struct pnfs_osd_ioerr4 { 240 - * pnfs_osd_objid4 oer_component; 241 - * length4 oer_comp_offset; 242 - * length4 oer_comp_length; 243 - * bool oer_iswrite; 244 - * pnfs_osd_errno4 oer_errno; 245 - * }; 246 - */ 247 - struct pnfs_osd_ioerr { 248 - struct pnfs_osd_objid oer_component; 249 - u64 oer_comp_offset; 250 - u64 oer_comp_length; 251 - u32 oer_iswrite; 252 - u32 oer_errno; 253 - }; 254 - 255 - /* OSD XDR Client API */ 256 - /* Layout helpers */ 257 - /* Layout decoding is done in two parts: 258 - * 1. First Call pnfs_osd_xdr_decode_layout_map to read in only the header part 259 - * of the layout. @iter members need not be initialized. 260 - * Returned: 261 - * @layout members are set. (@layout->olo_comps set to NULL). 262 - * 263 - * Zero on success, or negative error if passed xdr is broken. 264 - * 265 - * 2. 2nd Call pnfs_osd_xdr_decode_layout_comp() in a loop until it returns 266 - * false, to decode the next component. 267 - * Returned: 268 - * true if there is more to decode or false if we are done or error. 269 - * 270 - * Example: 271 - * struct pnfs_osd_xdr_decode_layout_iter iter; 272 - * struct pnfs_osd_layout layout; 273 - * struct pnfs_osd_object_cred comp; 274 - * int status; 275 - * 276 - * status = pnfs_osd_xdr_decode_layout_map(&layout, &iter, xdr); 277 - * if (unlikely(status)) 278 - * goto err; 279 - * while(pnfs_osd_xdr_decode_layout_comp(&comp, &iter, xdr, &status)) { 280 - * // All of @comp strings point to inside the xdr_buffer 281 - * // or scrach buffer. Copy them out to user memory eg. 282 - * copy_single_comp(dest_comp++, &comp); 283 - * } 284 - * if (unlikely(status)) 285 - * goto err; 286 - */ 287 - 288 - struct pnfs_osd_xdr_decode_layout_iter { 289 - unsigned total_comps; 290 - unsigned decoded_comps; 291 - }; 292 - 293 - extern int pnfs_osd_xdr_decode_layout_map(struct pnfs_osd_layout *layout, 294 - struct pnfs_osd_xdr_decode_layout_iter *iter, struct xdr_stream *xdr); 295 - 296 - extern bool pnfs_osd_xdr_decode_layout_comp(struct pnfs_osd_object_cred *comp, 297 - struct pnfs_osd_xdr_decode_layout_iter *iter, struct xdr_stream *xdr, 298 - int *err); 299 - 300 - /* Device Info helpers */ 301 - 302 - /* Note: All strings inside @deviceaddr point to space inside @p. 303 - * @p should stay valid while @deviceaddr is in use. 304 - */ 305 - extern void pnfs_osd_xdr_decode_deviceaddr( 306 - struct pnfs_osd_deviceaddr *deviceaddr, __be32 *p); 307 - 308 - /* layoutupdate (layout_commit) xdr helpers */ 309 - extern int 310 - pnfs_osd_xdr_encode_layoutupdate(struct xdr_stream *xdr, 311 - struct pnfs_osd_layoutupdate *lou); 312 - 313 - /* osd_ioerror encoding (layout_return) */ 314 - extern __be32 *pnfs_osd_xdr_ioerr_reserve_space(struct xdr_stream *xdr); 315 - extern void pnfs_osd_xdr_encode_ioerr(__be32 *p, struct pnfs_osd_ioerr *ioerr); 316 - 317 - #endif /* __PNFS_OSD_XDR_H__ */
+1
include/linux/sunrpc/clnt.h
··· 40 40 unsigned int cl_clid; /* client id */ 41 41 struct list_head cl_clients; /* Global list of clients */ 42 42 struct list_head cl_tasks; /* List of tasks */ 43 + atomic_t cl_pid; /* task PID counter */ 43 44 spinlock_t cl_lock; /* spinlock */ 44 45 struct rpc_xprt __rcu * cl_xprt; /* transport */ 45 46 const struct rpc_procinfo *cl_procinfo; /* procedure info */
+2 -14
include/linux/sunrpc/sched.h
··· 150 150 #define RPC_TASK_MSG_PIN_WAIT 5 151 151 #define RPC_TASK_SIGNALLED 6 152 152 153 - #define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 154 - #define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 155 153 #define rpc_test_and_set_running(t) \ 156 154 test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 157 - #define rpc_clear_running(t) \ 158 - do { \ 159 - smp_mb__before_atomic(); \ 160 - clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \ 161 - smp_mb__after_atomic(); \ 162 - } while (0) 155 + #define rpc_clear_running(t) clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 163 156 164 157 #define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 165 158 #define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 166 - #define rpc_clear_queued(t) \ 167 - do { \ 168 - smp_mb__before_atomic(); \ 169 - clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \ 170 - smp_mb__after_atomic(); \ 171 - } while (0) 159 + #define rpc_clear_queued(t) clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate) 172 160 173 161 #define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 174 162
+122
include/trace/events/fs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Display helpers for generic filesystem items 4 + * 5 + * Author: Chuck Lever <chuck.lever@oracle.com> 6 + * 7 + * Copyright (c) 2020, Oracle and/or its affiliates. 8 + */ 9 + 10 + #include <linux/fs.h> 11 + 12 + #define show_fs_dirent_type(x) \ 13 + __print_symbolic(x, \ 14 + { DT_UNKNOWN, "UNKNOWN" }, \ 15 + { DT_FIFO, "FIFO" }, \ 16 + { DT_CHR, "CHR" }, \ 17 + { DT_DIR, "DIR" }, \ 18 + { DT_BLK, "BLK" }, \ 19 + { DT_REG, "REG" }, \ 20 + { DT_LNK, "LNK" }, \ 21 + { DT_SOCK, "SOCK" }, \ 22 + { DT_WHT, "WHT" }) 23 + 24 + #define show_fs_fcntl_open_flags(x) \ 25 + __print_flags(x, "|", \ 26 + { O_WRONLY, "O_WRONLY" }, \ 27 + { O_RDWR, "O_RDWR" }, \ 28 + { O_CREAT, "O_CREAT" }, \ 29 + { O_EXCL, "O_EXCL" }, \ 30 + { O_NOCTTY, "O_NOCTTY" }, \ 31 + { O_TRUNC, "O_TRUNC" }, \ 32 + { O_APPEND, "O_APPEND" }, \ 33 + { O_NONBLOCK, "O_NONBLOCK" }, \ 34 + { O_DSYNC, "O_DSYNC" }, \ 35 + { O_DIRECT, "O_DIRECT" }, \ 36 + { O_LARGEFILE, "O_LARGEFILE" }, \ 37 + { O_DIRECTORY, "O_DIRECTORY" }, \ 38 + { O_NOFOLLOW, "O_NOFOLLOW" }, \ 39 + { O_NOATIME, "O_NOATIME" }, \ 40 + { O_CLOEXEC, "O_CLOEXEC" }) 41 + 42 + #define __fmode_flag(x) { (__force unsigned long)FMODE_##x, #x } 43 + #define show_fs_fmode_flags(x) \ 44 + __print_flags(x, "|", \ 45 + __fmode_flag(READ), \ 46 + __fmode_flag(WRITE), \ 47 + __fmode_flag(EXEC)) 48 + 49 + #ifdef CONFIG_64BIT 50 + #define show_fs_fcntl_cmd(x) \ 51 + __print_symbolic(x, \ 52 + { F_DUPFD, "DUPFD" }, \ 53 + { F_GETFD, "GETFD" }, \ 54 + { F_SETFD, "SETFD" }, \ 55 + { F_GETFL, "GETFL" }, \ 56 + { F_SETFL, "SETFL" }, \ 57 + { F_GETLK, "GETLK" }, \ 58 + { F_SETLK, "SETLK" }, \ 59 + { F_SETLKW, "SETLKW" }, \ 60 + { F_SETOWN, "SETOWN" }, \ 61 + { F_GETOWN, "GETOWN" }, \ 62 + { F_SETSIG, "SETSIG" }, \ 63 + { F_GETSIG, "GETSIG" }, \ 64 + { F_SETOWN_EX, "SETOWN_EX" }, \ 65 + { F_GETOWN_EX, "GETOWN_EX" }, \ 66 + { F_GETOWNER_UIDS, "GETOWNER_UIDS" }, \ 67 + { F_OFD_GETLK, "OFD_GETLK" }, \ 68 + { F_OFD_SETLK, "OFD_SETLK" }, \ 69 + { F_OFD_SETLKW, "OFD_SETLKW" }) 70 + #else /* CONFIG_64BIT */ 71 + #define show_fs_fcntl_cmd(x) \ 72 + __print_symbolic(x, \ 73 + { F_DUPFD, "DUPFD" }, \ 74 + { F_GETFD, "GETFD" }, \ 75 + { F_SETFD, "SETFD" }, \ 76 + { F_GETFL, "GETFL" }, \ 77 + { F_SETFL, "SETFL" }, \ 78 + { F_GETLK, "GETLK" }, \ 79 + { F_SETLK, "SETLK" }, \ 80 + { F_SETLKW, "SETLKW" }, \ 81 + { F_SETOWN, "SETOWN" }, \ 82 + { F_GETOWN, "GETOWN" }, \ 83 + { F_SETSIG, "SETSIG" }, \ 84 + { F_GETSIG, "GETSIG" }, \ 85 + { F_GETLK64, "GETLK64" }, \ 86 + { F_SETLK64, "SETLK64" }, \ 87 + { F_SETLKW64, "SETLKW64" }, \ 88 + { F_SETOWN_EX, "SETOWN_EX" }, \ 89 + { F_GETOWN_EX, "GETOWN_EX" }, \ 90 + { F_GETOWNER_UIDS, "GETOWNER_UIDS" }, \ 91 + { F_OFD_GETLK, "OFD_GETLK" }, \ 92 + { F_OFD_SETLK, "OFD_SETLK" }, \ 93 + { F_OFD_SETLKW, "OFD_SETLKW" }) 94 + #endif /* CONFIG_64BIT */ 95 + 96 + #define show_fs_fcntl_lock_type(x) \ 97 + __print_symbolic(x, \ 98 + { F_RDLCK, "RDLCK" }, \ 99 + { F_WRLCK, "WRLCK" }, \ 100 + { F_UNLCK, "UNLCK" }) 101 + 102 + #define show_fs_lookup_flags(flags) \ 103 + __print_flags(flags, "|", \ 104 + { LOOKUP_FOLLOW, "FOLLOW" }, \ 105 + { LOOKUP_DIRECTORY, "DIRECTORY" }, \ 106 + { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \ 107 + { LOOKUP_EMPTY, "EMPTY" }, \ 108 + { LOOKUP_DOWN, "DOWN" }, \ 109 + { LOOKUP_MOUNTPOINT, "MOUNTPOINT" }, \ 110 + { LOOKUP_REVAL, "REVAL" }, \ 111 + { LOOKUP_RCU, "RCU" }, \ 112 + { LOOKUP_OPEN, "OPEN" }, \ 113 + { LOOKUP_CREATE, "CREATE" }, \ 114 + { LOOKUP_EXCL, "EXCL" }, \ 115 + { LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \ 116 + { LOOKUP_PARENT, "PARENT" }, \ 117 + { LOOKUP_NO_SYMLINKS, "NO_SYMLINKS" }, \ 118 + { LOOKUP_NO_MAGICLINKS, "NO_MAGICLINKS" }, \ 119 + { LOOKUP_NO_XDEV, "NO_XDEV" }, \ 120 + { LOOKUP_BENEATH, "BENEATH" }, \ 121 + { LOOKUP_IN_ROOT, "IN_ROOT" }, \ 122 + { LOOKUP_CACHED, "CACHED" })
+375
include/trace/events/nfs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Display helpers for NFS protocol elements 4 + * 5 + * Author: Chuck Lever <chuck.lever@oracle.com> 6 + * 7 + * Copyright (c) 2020, Oracle and/or its affiliates. 8 + */ 9 + 10 + #include <linux/nfs.h> 11 + #include <linux/nfs4.h> 12 + #include <uapi/linux/nfs.h> 13 + 14 + TRACE_DEFINE_ENUM(NFS_OK); 15 + TRACE_DEFINE_ENUM(NFSERR_PERM); 16 + TRACE_DEFINE_ENUM(NFSERR_NOENT); 17 + TRACE_DEFINE_ENUM(NFSERR_IO); 18 + TRACE_DEFINE_ENUM(NFSERR_NXIO); 19 + TRACE_DEFINE_ENUM(NFSERR_EAGAIN); 20 + TRACE_DEFINE_ENUM(NFSERR_ACCES); 21 + TRACE_DEFINE_ENUM(NFSERR_EXIST); 22 + TRACE_DEFINE_ENUM(NFSERR_XDEV); 23 + TRACE_DEFINE_ENUM(NFSERR_NODEV); 24 + TRACE_DEFINE_ENUM(NFSERR_NOTDIR); 25 + TRACE_DEFINE_ENUM(NFSERR_ISDIR); 26 + TRACE_DEFINE_ENUM(NFSERR_INVAL); 27 + TRACE_DEFINE_ENUM(NFSERR_FBIG); 28 + TRACE_DEFINE_ENUM(NFSERR_NOSPC); 29 + TRACE_DEFINE_ENUM(NFSERR_ROFS); 30 + TRACE_DEFINE_ENUM(NFSERR_MLINK); 31 + TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP); 32 + TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG); 33 + TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY); 34 + TRACE_DEFINE_ENUM(NFSERR_DQUOT); 35 + TRACE_DEFINE_ENUM(NFSERR_STALE); 36 + TRACE_DEFINE_ENUM(NFSERR_REMOTE); 37 + TRACE_DEFINE_ENUM(NFSERR_WFLUSH); 38 + TRACE_DEFINE_ENUM(NFSERR_BADHANDLE); 39 + TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC); 40 + TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE); 41 + TRACE_DEFINE_ENUM(NFSERR_NOTSUPP); 42 + TRACE_DEFINE_ENUM(NFSERR_TOOSMALL); 43 + TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT); 44 + TRACE_DEFINE_ENUM(NFSERR_BADTYPE); 45 + TRACE_DEFINE_ENUM(NFSERR_JUKEBOX); 46 + 47 + #define show_nfs_status(x) \ 48 + __print_symbolic(x, \ 49 + { NFS_OK, "OK" }, \ 50 + { NFSERR_PERM, "PERM" }, \ 51 + { NFSERR_NOENT, "NOENT" }, \ 52 + { NFSERR_IO, "IO" }, \ 53 + { NFSERR_NXIO, "NXIO" }, \ 54 + { ECHILD, "CHILD" }, \ 55 + { NFSERR_EAGAIN, "AGAIN" }, \ 56 + { NFSERR_ACCES, "ACCES" }, \ 57 + { NFSERR_EXIST, "EXIST" }, \ 58 + { NFSERR_XDEV, "XDEV" }, \ 59 + { NFSERR_NODEV, "NODEV" }, \ 60 + { NFSERR_NOTDIR, "NOTDIR" }, \ 61 + { NFSERR_ISDIR, "ISDIR" }, \ 62 + { NFSERR_INVAL, "INVAL" }, \ 63 + { NFSERR_FBIG, "FBIG" }, \ 64 + { NFSERR_NOSPC, "NOSPC" }, \ 65 + { NFSERR_ROFS, "ROFS" }, \ 66 + { NFSERR_MLINK, "MLINK" }, \ 67 + { NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \ 68 + { NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \ 69 + { NFSERR_NOTEMPTY, "NOTEMPTY" }, \ 70 + { NFSERR_DQUOT, "DQUOT" }, \ 71 + { NFSERR_STALE, "STALE" }, \ 72 + { NFSERR_REMOTE, "REMOTE" }, \ 73 + { NFSERR_WFLUSH, "WFLUSH" }, \ 74 + { NFSERR_BADHANDLE, "BADHANDLE" }, \ 75 + { NFSERR_NOT_SYNC, "NOTSYNC" }, \ 76 + { NFSERR_BAD_COOKIE, "BADCOOKIE" }, \ 77 + { NFSERR_NOTSUPP, "NOTSUPP" }, \ 78 + { NFSERR_TOOSMALL, "TOOSMALL" }, \ 79 + { NFSERR_SERVERFAULT, "REMOTEIO" }, \ 80 + { NFSERR_BADTYPE, "BADTYPE" }, \ 81 + { NFSERR_JUKEBOX, "JUKEBOX" }) 82 + 83 + TRACE_DEFINE_ENUM(NFS_UNSTABLE); 84 + TRACE_DEFINE_ENUM(NFS_DATA_SYNC); 85 + TRACE_DEFINE_ENUM(NFS_FILE_SYNC); 86 + 87 + #define show_nfs_stable_how(x) \ 88 + __print_symbolic(x, \ 89 + { NFS_UNSTABLE, "UNSTABLE" }, \ 90 + { NFS_DATA_SYNC, "DATA_SYNC" }, \ 91 + { NFS_FILE_SYNC, "FILE_SYNC" }) 92 + 93 + TRACE_DEFINE_ENUM(NFS4_OK); 94 + TRACE_DEFINE_ENUM(NFS4ERR_ACCESS); 95 + TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP); 96 + TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED); 97 + TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY); 98 + TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR); 99 + TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE); 100 + TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE); 101 + TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT); 102 + TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL); 103 + TRACE_DEFINE_ENUM(NFS4ERR_BADNAME); 104 + TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER); 105 + TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION); 106 + TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT); 107 + TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE); 108 + TRACE_DEFINE_ENUM(NFS4ERR_BADXDR); 109 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE); 110 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT); 111 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE); 112 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID); 113 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST); 114 + TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID); 115 + TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN); 116 + TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE); 117 + TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY); 118 + TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY); 119 + TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION); 120 + TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK); 121 + TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION); 122 + TRACE_DEFINE_ENUM(NFS4ERR_DELAY); 123 + TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED); 124 + TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED); 125 + TRACE_DEFINE_ENUM(NFS4ERR_DENIED); 126 + TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL); 127 + TRACE_DEFINE_ENUM(NFS4ERR_DQUOT); 128 + TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP); 129 + TRACE_DEFINE_ENUM(NFS4ERR_EXIST); 130 + TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED); 131 + TRACE_DEFINE_ENUM(NFS4ERR_FBIG); 132 + TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED); 133 + TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN); 134 + TRACE_DEFINE_ENUM(NFS4ERR_GRACE); 135 + TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP); 136 + TRACE_DEFINE_ENUM(NFS4ERR_INVAL); 137 + TRACE_DEFINE_ENUM(NFS4ERR_IO); 138 + TRACE_DEFINE_ENUM(NFS4ERR_ISDIR); 139 + TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER); 140 + TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE); 141 + TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED); 142 + TRACE_DEFINE_ENUM(NFS4ERR_LOCKED); 143 + TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD); 144 + TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE); 145 + TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH); 146 + TRACE_DEFINE_ENUM(NFS4ERR_MLINK); 147 + TRACE_DEFINE_ENUM(NFS4ERR_MOVED); 148 + TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG); 149 + TRACE_DEFINE_ENUM(NFS4ERR_NOENT); 150 + TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE); 151 + TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT); 152 + TRACE_DEFINE_ENUM(NFS4ERR_NOSPC); 153 + TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR); 154 + TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY); 155 + TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP); 156 + TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP); 157 + TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME); 158 + TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE); 159 + TRACE_DEFINE_ENUM(NFS4ERR_NXIO); 160 + TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID); 161 + TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE); 162 + TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL); 163 + TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION); 164 + TRACE_DEFINE_ENUM(NFS4ERR_PERM); 165 + TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE); 166 + TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT); 167 + TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT); 168 + TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD); 169 + TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT); 170 + TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG); 171 + TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG); 172 + TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE); 173 + TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG); 174 + TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE); 175 + TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH); 176 + TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP); 177 + TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT); 178 + TRACE_DEFINE_ENUM(NFS4ERR_ROFS); 179 + TRACE_DEFINE_ENUM(NFS4ERR_SAME); 180 + TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED); 181 + TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS); 182 + TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY); 183 + TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED); 184 + TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT); 185 + TRACE_DEFINE_ENUM(NFS4ERR_STALE); 186 + TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID); 187 + TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID); 188 + TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK); 189 + TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL); 190 + TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS); 191 + TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE); 192 + TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND); 193 + TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC); 194 + TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED); 195 + TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE); 196 + TRACE_DEFINE_ENUM(NFS4ERR_XDEV); 197 + 198 + TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS); 199 + TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS); 200 + 201 + #define show_nfs4_status(x) \ 202 + __print_symbolic(x, \ 203 + { NFS4_OK, "OK" }, \ 204 + { EPERM, "EPERM" }, \ 205 + { ENOENT, "ENOENT" }, \ 206 + { EIO, "EIO" }, \ 207 + { ENXIO, "ENXIO" }, \ 208 + { EACCES, "EACCES" }, \ 209 + { EEXIST, "EEXIST" }, \ 210 + { EXDEV, "EXDEV" }, \ 211 + { ENOTDIR, "ENOTDIR" }, \ 212 + { EISDIR, "EISDIR" }, \ 213 + { EFBIG, "EFBIG" }, \ 214 + { ENOSPC, "ENOSPC" }, \ 215 + { EROFS, "EROFS" }, \ 216 + { EMLINK, "EMLINK" }, \ 217 + { ENAMETOOLONG, "ENAMETOOLONG" }, \ 218 + { ENOTEMPTY, "ENOTEMPTY" }, \ 219 + { EDQUOT, "EDQUOT" }, \ 220 + { ESTALE, "ESTALE" }, \ 221 + { EBADHANDLE, "EBADHANDLE" }, \ 222 + { EBADCOOKIE, "EBADCOOKIE" }, \ 223 + { ENOTSUPP, "ENOTSUPP" }, \ 224 + { ETOOSMALL, "ETOOSMALL" }, \ 225 + { EREMOTEIO, "EREMOTEIO" }, \ 226 + { EBADTYPE, "EBADTYPE" }, \ 227 + { EAGAIN, "EAGAIN" }, \ 228 + { ELOOP, "ELOOP" }, \ 229 + { EOPNOTSUPP, "EOPNOTSUPP" }, \ 230 + { EDEADLK, "EDEADLK" }, \ 231 + { ENOMEM, "ENOMEM" }, \ 232 + { EKEYEXPIRED, "EKEYEXPIRED" }, \ 233 + { ETIMEDOUT, "ETIMEDOUT" }, \ 234 + { ERESTARTSYS, "ERESTARTSYS" }, \ 235 + { ECONNREFUSED, "ECONNREFUSED" }, \ 236 + { ECONNRESET, "ECONNRESET" }, \ 237 + { ENETUNREACH, "ENETUNREACH" }, \ 238 + { EHOSTUNREACH, "EHOSTUNREACH" }, \ 239 + { EHOSTDOWN, "EHOSTDOWN" }, \ 240 + { EPIPE, "EPIPE" }, \ 241 + { EPFNOSUPPORT, "EPFNOSUPPORT" }, \ 242 + { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \ 243 + { NFS4ERR_ACCESS, "ACCESS" }, \ 244 + { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \ 245 + { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \ 246 + { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \ 247 + { NFS4ERR_BADCHAR, "BADCHAR" }, \ 248 + { NFS4ERR_BADHANDLE, "BADHANDLE" }, \ 249 + { NFS4ERR_BADIOMODE, "BADIOMODE" }, \ 250 + { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \ 251 + { NFS4ERR_BADLABEL, "BADLABEL" }, \ 252 + { NFS4ERR_BADNAME, "BADNAME" }, \ 253 + { NFS4ERR_BADOWNER, "BADOWNER" }, \ 254 + { NFS4ERR_BADSESSION, "BADSESSION" }, \ 255 + { NFS4ERR_BADSLOT, "BADSLOT" }, \ 256 + { NFS4ERR_BADTYPE, "BADTYPE" }, \ 257 + { NFS4ERR_BADXDR, "BADXDR" }, \ 258 + { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \ 259 + { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \ 260 + { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \ 261 + { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \ 262 + { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \ 263 + { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \ 264 + { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 265 + { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \ 266 + { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \ 267 + { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \ 268 + { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, "CONN_NOT_BOUND_TO_SESSION" }, \ 269 + { NFS4ERR_DEADLOCK, "DEADLOCK" }, \ 270 + { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \ 271 + { NFS4ERR_DELAY, "DELAY" }, \ 272 + { NFS4ERR_DELEG_ALREADY_WANTED, "DELEG_ALREADY_WANTED" }, \ 273 + { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \ 274 + { NFS4ERR_DENIED, "DENIED" }, \ 275 + { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \ 276 + { NFS4ERR_DQUOT, "DQUOT" }, \ 277 + { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \ 278 + { NFS4ERR_EXIST, "EXIST" }, \ 279 + { NFS4ERR_EXPIRED, "EXPIRED" }, \ 280 + { NFS4ERR_FBIG, "FBIG" }, \ 281 + { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \ 282 + { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \ 283 + { NFS4ERR_GRACE, "GRACE" }, \ 284 + { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \ 285 + { NFS4ERR_INVAL, "INVAL" }, \ 286 + { NFS4ERR_IO, "IO" }, \ 287 + { NFS4ERR_ISDIR, "ISDIR" }, \ 288 + { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \ 289 + { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \ 290 + { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \ 291 + { NFS4ERR_LOCKED, "LOCKED" }, \ 292 + { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \ 293 + { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \ 294 + { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \ 295 + { NFS4ERR_MLINK, "MLINK" }, \ 296 + { NFS4ERR_MOVED, "MOVED" }, \ 297 + { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \ 298 + { NFS4ERR_NOENT, "NOENT" }, \ 299 + { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \ 300 + { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \ 301 + { NFS4ERR_NOSPC, "NOSPC" }, \ 302 + { NFS4ERR_NOTDIR, "NOTDIR" }, \ 303 + { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \ 304 + { NFS4ERR_NOTSUPP, "NOTSUPP" }, \ 305 + { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \ 306 + { NFS4ERR_NOT_SAME, "NOT_SAME" }, \ 307 + { NFS4ERR_NO_GRACE, "NO_GRACE" }, \ 308 + { NFS4ERR_NXIO, "NXIO" }, \ 309 + { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \ 310 + { NFS4ERR_OPENMODE, "OPENMODE" }, \ 311 + { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \ 312 + { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \ 313 + { NFS4ERR_PERM, "PERM" }, \ 314 + { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \ 315 + { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \ 316 + { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \ 317 + { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \ 318 + { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \ 319 + { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \ 320 + { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \ 321 + { NFS4ERR_REP_TOO_BIG_TO_CACHE, "REP_TOO_BIG_TO_CACHE" }, \ 322 + { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \ 323 + { NFS4ERR_RESOURCE, "RESOURCE" }, \ 324 + { NFS4ERR_RESTOREFH, "RESTOREFH" }, \ 325 + { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \ 326 + { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \ 327 + { NFS4ERR_ROFS, "ROFS" }, \ 328 + { NFS4ERR_SAME, "SAME" }, \ 329 + { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \ 330 + { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \ 331 + { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \ 332 + { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \ 333 + { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \ 334 + { NFS4ERR_STALE, "STALE" }, \ 335 + { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \ 336 + { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \ 337 + { NFS4ERR_SYMLINK, "SYMLINK" }, \ 338 + { NFS4ERR_TOOSMALL, "TOOSMALL" }, \ 339 + { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \ 340 + { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \ 341 + { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \ 342 + { NFS4ERR_WRONGSEC, "WRONGSEC" }, \ 343 + { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \ 344 + { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \ 345 + { NFS4ERR_XDEV, "XDEV" }, \ 346 + /* ***** Internal to Linux NFS client ***** */ \ 347 + { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \ 348 + { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" }) 349 + 350 + #define show_nfs4_verifier(x) \ 351 + __print_hex_str(x, NFS4_VERIFIER_SIZE) 352 + 353 + TRACE_DEFINE_ENUM(IOMODE_READ); 354 + TRACE_DEFINE_ENUM(IOMODE_RW); 355 + TRACE_DEFINE_ENUM(IOMODE_ANY); 356 + 357 + #define show_pnfs_layout_iomode(x) \ 358 + __print_symbolic(x, \ 359 + { IOMODE_READ, "READ" }, \ 360 + { IOMODE_RW, "RW" }, \ 361 + { IOMODE_ANY, "ANY" }) 362 + 363 + #define show_nfs4_seq4_status(x) \ 364 + __print_flags(x, "|", \ 365 + { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \ 366 + { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, "CB_GSS_CONTEXTS_EXPIRING" }, \ 367 + { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, "CB_GSS_CONTEXTS_EXPIRED" }, \ 368 + { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, "EXPIRED_ALL_STATE_REVOKED" }, \ 369 + { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, "EXPIRED_SOME_STATE_REVOKED" }, \ 370 + { SEQ4_STATUS_ADMIN_STATE_REVOKED, "ADMIN_STATE_REVOKED" }, \ 371 + { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, "RECALLABLE_STATE_REVOKED" }, \ 372 + { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \ 373 + { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, "RESTART_RECLAIM_NEEDED" }, \ 374 + { SEQ4_STATUS_CB_PATH_DOWN_SESSION, "CB_PATH_DOWN_SESSION" }, \ 375 + { SEQ4_STATUS_BACKCHANNEL_FAULT, "BACKCHANNEL_FAULT" })
+12 -6
include/trace/events/rpcgss.h
··· 13 13 14 14 #include <linux/tracepoint.h> 15 15 16 + #include <trace/events/sunrpc_base.h> 17 + 16 18 /** 17 19 ** GSS-API related trace events 18 20 **/ ··· 101 99 __entry->maj_stat = maj_stat; 102 100 ), 103 101 104 - TP_printk("task:%u@%u maj_stat=%s", 102 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " maj_stat=%s", 105 103 __entry->task_id, __entry->client_id, 106 104 __entry->maj_stat == 0 ? 107 105 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat)) ··· 334 332 __entry->client_id = task->tk_client->cl_clid; 335 333 ), 336 334 337 - TP_printk("task:%u@%u", __entry->task_id, __entry->client_id) 335 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 336 + __entry->task_id, __entry->client_id) 338 337 ); 339 338 340 339 TRACE_EVENT(rpcgss_bad_seqno, ··· 361 358 __entry->received = received; 362 359 ), 363 360 364 - TP_printk("task:%u@%u expected seqno %u, received seqno %u", 361 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 362 + " expected seqno %u, received seqno %u", 365 363 __entry->task_id, __entry->client_id, 366 364 __entry->expected, __entry->received) 367 365 ); ··· 390 386 __entry->seqno = rqst->rq_seqno; 391 387 ), 392 388 393 - TP_printk("task:%u@%u xid=0x%08x seqno=%u", 389 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x seqno=%u", 394 390 __entry->task_id, __entry->client_id, 395 391 __entry->xid, __entry->seqno) 396 392 ); ··· 422 418 __entry->ret = ret; 423 419 ), 424 420 425 - TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded", 421 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 422 + " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded", 426 423 __entry->task_id, __entry->client_id, 427 424 __entry->xid, __entry->seqno, __entry->seq_xmit, 428 425 __entry->ret ? "" : "un") ··· 457 452 __entry->verfsize = auth->au_verfsize; 458 453 ), 459 454 460 - TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n", 455 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 456 + " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n", 461 457 __entry->task_id, __entry->client_id, __entry->xid, 462 458 __entry->auth, __entry->rslack, __entry->ralign, 463 459 __entry->verfsize)
+34 -21
include/trace/events/rpcrdma.h
··· 14 14 #include <linux/sunrpc/rpc_rdma_cid.h> 15 15 #include <linux/tracepoint.h> 16 16 #include <rdma/ib_cm.h> 17 + 17 18 #include <trace/events/rdma.h> 19 + #include <trace/events/sunrpc_base.h> 18 20 19 21 /** 20 22 ** Event classes ··· 281 279 __entry->nsegs = nsegs; 282 280 ), 283 281 284 - TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)", 282 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 283 + " pos=%u %u@0x%016llx:0x%08x (%s)", 285 284 __entry->task_id, __entry->client_id, 286 285 __entry->pos, __entry->length, 287 286 (unsigned long long)__entry->offset, __entry->handle, ··· 329 326 __entry->nsegs = nsegs; 330 327 ), 331 328 332 - TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)", 329 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 330 + " %u@0x%016llx:0x%08x (%s)", 333 331 __entry->task_id, __entry->client_id, 334 332 __entry->length, (unsigned long long)__entry->offset, 335 333 __entry->handle, ··· 379 375 380 376 TP_fast_assign( 381 377 const struct rpcrdma_req *req = mr->mr_req; 382 - const struct rpc_task *task = req->rl_slot.rq_task; 383 378 384 - __entry->task_id = task->tk_pid; 385 - __entry->client_id = task->tk_client->cl_clid; 379 + if (req) { 380 + const struct rpc_task *task = req->rl_slot.rq_task; 381 + 382 + __entry->task_id = task->tk_pid; 383 + __entry->client_id = task->tk_client->cl_clid; 384 + } else { 385 + __entry->task_id = 0; 386 + __entry->client_id = -1; 387 + } 386 388 __entry->mr_id = mr->mr_ibmr->res.id; 387 389 __entry->nents = mr->mr_nents; 388 390 __entry->handle = mr->mr_handle; ··· 397 387 __entry->dir = mr->mr_dir; 398 388 ), 399 389 400 - TP_printk("task:%u@%u mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)", 390 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 391 + " mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)", 401 392 __entry->task_id, __entry->client_id, 402 393 __entry->mr_id, __entry->nents, __entry->length, 403 394 (unsigned long long)__entry->offset, __entry->handle, ··· 641 630 __assign_str(port, rpcrdma_portstr(r_xprt)); 642 631 ), 643 632 644 - TP_printk("peer=[%s]:%s task:%u@%u", 645 - __get_str(addr), __get_str(port), 646 - __entry->task_id, __entry->client_id 633 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " peer=[%s]:%s", 634 + __entry->task_id, __entry->client_id, 635 + __get_str(addr), __get_str(port) 647 636 ) 648 637 ); 649 638 650 639 DEFINE_RDCH_EVENT(read); 651 640 DEFINE_WRCH_EVENT(write); 652 641 DEFINE_WRCH_EVENT(reply); 642 + DEFINE_WRCH_EVENT(wp); 653 643 654 644 TRACE_DEFINE_ENUM(rpcrdma_noch); 655 645 TRACE_DEFINE_ENUM(rpcrdma_noch_pullup); ··· 705 693 __entry->wtype = wtype; 706 694 ), 707 695 708 - TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s", 696 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 697 + " xid=0x%08x hdr=%u xdr=%u/%u/%u %s/%s", 709 698 __entry->task_id, __entry->client_id, __entry->xid, 710 699 __entry->hdrlen, 711 700 __entry->headlen, __entry->pagelen, __entry->taillen, ··· 736 723 __entry->ret = ret; 737 724 ), 738 725 739 - TP_printk("task:%u@%u xid=0x%08x: ret=%d", 726 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d", 740 727 __entry->task_id, __entry->client_id, __entry->xid, 741 728 __entry->ret 742 729 ) ··· 763 750 __entry->ret = ret; 764 751 ), 765 752 766 - TP_printk("task:%u@%u xid=0x%08x: ret=%d", 753 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d", 767 754 __entry->task_id, __entry->client_id, __entry->xid, 768 755 __entry->ret 769 756 ) ··· 798 785 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED; 799 786 ), 800 787 801 - TP_printk("task:%u@%u cq.id=%u cid=%d (%d SGE%s) %s", 788 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u cid=%d (%d SGE%s) %s", 802 789 __entry->task_id, __entry->client_id, 803 790 __entry->cq_id, __entry->completion_id, 804 791 __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"), ··· 833 820 __entry->rc = rc; 834 821 ), 835 822 836 - TP_printk("task:%u@%u cq.id=%u rc=%d", 823 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u rc=%d", 837 824 __entry->task_id, __entry->client_id, 838 825 __entry->cq_id, __entry->rc 839 826 ) ··· 945 932 __entry->status = status; 946 933 ), 947 934 948 - TP_printk("task:%u@%u status=%d", 935 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d", 949 936 __entry->task_id, __entry->client_id, __entry->status 950 937 ) 951 938 ); ··· 1133 1120 __entry->credits = credits; 1134 1121 ), 1135 1122 1136 - TP_printk("task:%u@%u xid=0x%08x credits=%u", 1123 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x credits=%u", 1137 1124 __entry->task_id, __entry->client_id, __entry->xid, 1138 1125 __entry->credits 1139 1126 ) ··· 1169 1156 __entry->max = be32_to_cpup(max); 1170 1157 ), 1171 1158 1172 - TP_printk("task:%u@%u xid=0x%08x versions=[%u, %u]", 1159 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x versions=[%u, %u]", 1173 1160 __entry->task_id, __entry->client_id, __entry->xid, 1174 1161 __entry->min, __entry->max 1175 1162 ) ··· 1194 1181 __entry->xid = be32_to_cpu(rqst->rq_xid); 1195 1182 ), 1196 1183 1197 - TP_printk("task:%u@%u xid=0x%08x", 1184 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x", 1198 1185 __entry->task_id, __entry->client_id, __entry->xid 1199 1186 ) 1200 1187 ); ··· 1220 1207 __entry->procedure = be32_to_cpup(procedure); 1221 1208 ), 1222 1209 1223 - TP_printk("task:%u@%u xid=0x%08x procedure=%u", 1210 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x procedure=%u", 1224 1211 __entry->task_id, __entry->client_id, __entry->xid, 1225 1212 __entry->procedure 1226 1213 ) ··· 1252 1239 __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len; 1253 1240 ), 1254 1241 1255 - TP_printk("task:%u@%u fixup=%lu xdr=%zu/%u/%zu", 1242 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " fixup=%lu xdr=%zu/%u/%zu", 1256 1243 __entry->task_id, __entry->client_id, __entry->fixup, 1257 1244 __entry->headlen, __entry->pagelen, __entry->taillen 1258 1245 ) ··· 1302 1289 __entry->client_id = task->tk_client->cl_clid; 1303 1290 ), 1304 1291 1305 - TP_printk("task:%u@%u", 1292 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 1306 1293 __entry->task_id, __entry->client_id 1307 1294 ) 1308 1295 );
+58 -41
include/trace/events/sunrpc.h
··· 14 14 #include <linux/net.h> 15 15 #include <linux/tracepoint.h> 16 16 17 + #include <trace/events/sunrpc_base.h> 18 + 17 19 TRACE_DEFINE_ENUM(SOCK_STREAM); 18 20 TRACE_DEFINE_ENUM(SOCK_DGRAM); 19 21 TRACE_DEFINE_ENUM(SOCK_RAW); ··· 80 78 __entry->msg_len = xdr->len; 81 79 ), 82 80 83 - TP_printk("task:%u@%u head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 81 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 82 + " head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 84 83 __entry->task_id, __entry->client_id, 85 84 __entry->head_base, __entry->head_len, __entry->page_len, 86 85 __entry->tail_base, __entry->tail_len, __entry->msg_len ··· 117 114 __entry->client_id = clnt->cl_clid; 118 115 ), 119 116 120 - TP_printk("clid=%u", __entry->client_id) 117 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER, __entry->client_id) 121 118 ); 122 119 123 120 #define DEFINE_RPC_CLNT_EVENT(name) \ ··· 161 158 __assign_str(server, server); 162 159 ), 163 160 164 - TP_printk("client=%u peer=[%s]:%s program=%s server=%s", 161 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER 162 + " peer=[%s]:%s program=%s server=%s", 165 163 __entry->client_id, __get_str(addr), __get_str(port), 166 164 __get_str(program), __get_str(server)) 167 165 ); ··· 210 206 __entry->error = error; 211 207 ), 212 208 213 - TP_printk("client=%u error=%d", __entry->client_id, __entry->error) 209 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER " error=%d", 210 + __entry->client_id, __entry->error) 214 211 ); 215 212 216 213 ··· 253 248 __entry->status = task->tk_status; 254 249 ), 255 250 256 - TP_printk("task:%u@%u status=%d", 251 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d", 257 252 __entry->task_id, __entry->client_id, 258 253 __entry->status) 259 254 ); ··· 293 288 __assign_str(procname, rpc_proc_name(task)); 294 289 ), 295 290 296 - TP_printk("task:%u@%u %sv%d %s (%ssync)", 291 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " %sv%d %s (%ssync)", 297 292 __entry->task_id, __entry->client_id, 298 293 __get_str(progname), __entry->version, 299 294 __get_str(procname), __entry->async ? "a": "" ··· 353 348 __entry->flags = task->tk_flags; 354 349 ), 355 350 356 - TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps", 351 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 352 + " flags=%s runstate=%s status=%d action=%ps", 357 353 __entry->task_id, __entry->client_id, 358 354 rpc_show_task_flags(__entry->flags), 359 355 rpc_show_runstate(__entry->runstate), ··· 378 372 DEFINE_RPC_RUNNING_EVENT(timeout); 379 373 DEFINE_RPC_RUNNING_EVENT(signalled); 380 374 DEFINE_RPC_RUNNING_EVENT(end); 375 + DEFINE_RPC_RUNNING_EVENT(call_done); 381 376 382 377 DECLARE_EVENT_CLASS(rpc_task_queued, 383 378 ··· 407 400 __assign_str(q_name, rpc_qname(q)); 408 401 ), 409 402 410 - TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s", 403 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 404 + " flags=%s runstate=%s status=%d timeout=%lu queue=%s", 411 405 __entry->task_id, __entry->client_id, 412 406 rpc_show_task_flags(__entry->flags), 413 407 rpc_show_runstate(__entry->runstate), ··· 444 436 __entry->client_id = task->tk_client->cl_clid; 445 437 ), 446 438 447 - TP_printk("task:%u@%u", 439 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 448 440 __entry->task_id, __entry->client_id) 449 441 ); 450 442 ··· 486 478 __assign_str(servername, task->tk_xprt->servername); 487 479 ), 488 480 489 - TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s", 481 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 482 + " server=%s xid=0x%08x %sv%d %s", 490 483 __entry->task_id, __entry->client_id, __get_str(servername), 491 484 __entry->xid, __get_str(progname), __entry->version, 492 485 __get_str(procname)) ··· 547 538 __entry->status = status; 548 539 ), 549 540 550 - TP_printk("task:%u@%u callsize=%zu recvsize=%zu status=%d", 541 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 542 + " callsize=%zu recvsize=%zu status=%d", 551 543 __entry->task_id, __entry->client_id, 552 544 __entry->callsize, __entry->recvsize, __entry->status 553 545 ) ··· 577 567 __entry->rpc_status = rpc_status; 578 568 ), 579 569 580 - TP_printk("task:%u@%u tk_status=%d rpc_status=%d", 570 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 571 + " tk_status=%d rpc_status=%d", 581 572 __entry->task_id, __entry->client_id, 582 573 __entry->tk_status, __entry->rpc_status) 583 574 ); ··· 618 607 __entry->execute = ktime_to_us(execute); 619 608 ), 620 609 621 - TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 610 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 611 + " xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 622 612 __entry->task_id, __entry->client_id, __entry->xid, 623 613 __get_str(progname), __entry->version, __get_str(procname), 624 614 __entry->backlog, __entry->rtt, __entry->execute) ··· 663 651 __entry->version = task->tk_client->cl_vers; 664 652 __assign_str(procedure, task->tk_msg.rpc_proc->p_name); 665 653 } else { 666 - __entry->task_id = 0; 667 - __entry->client_id = 0; 654 + __entry->task_id = -1; 655 + __entry->client_id = -1; 668 656 __assign_str(progname, "unknown"); 669 657 __entry->version = 0; 670 658 __assign_str(procedure, "unknown"); ··· 680 668 __entry->len = xdr->buf->len; 681 669 ), 682 670 683 - TP_printk( 684 - "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 671 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 672 + " %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 685 673 __entry->task_id, __entry->client_id, 686 674 __get_str(progname), __entry->version, __get_str(procedure), 687 675 __entry->requested, __entry->p, __entry->end, ··· 739 727 __entry->len = xdr->buf->len; 740 728 ), 741 729 742 - TP_printk( 743 - "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 730 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 731 + " %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 744 732 __entry->task_id, __entry->client_id, 745 733 __get_str(progname), __entry->version, __get_str(procedure), 746 734 __entry->offset, __entry->copied, ··· 929 917 __entry->remaining = rqst->rq_slen - transport->xmit.offset; 930 918 ), 931 919 932 - TP_printk("task:%u@%u total=%u remaining=%u", 920 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 921 + " total=%u remaining=%u", 933 922 __entry->task_id, __entry->client_id, 934 923 __entry->total, __entry->remaining 935 924 ) ··· 938 925 939 926 #define rpc_show_xprt_state(x) \ 940 927 __print_flags(x, "|", \ 941 - { (1UL << XPRT_LOCKED), "LOCKED"}, \ 942 - { (1UL << XPRT_CONNECTED), "CONNECTED"}, \ 943 - { (1UL << XPRT_CONNECTING), "CONNECTING"}, \ 944 - { (1UL << XPRT_CLOSE_WAIT), "CLOSE_WAIT"}, \ 945 - { (1UL << XPRT_BOUND), "BOUND"}, \ 946 - { (1UL << XPRT_BINDING), "BINDING"}, \ 947 - { (1UL << XPRT_CLOSING), "CLOSING"}, \ 948 - { (1UL << XPRT_OFFLINE), "OFFLINE"}, \ 949 - { (1UL << XPRT_REMOVE), "REMOVE"}, \ 950 - { (1UL << XPRT_CONGESTED), "CONGESTED"}, \ 951 - { (1UL << XPRT_CWND_WAIT), "CWND_WAIT"}, \ 952 - { (1UL << XPRT_WRITE_SPACE), "WRITE_SPACE"}) 928 + { BIT(XPRT_LOCKED), "LOCKED" }, \ 929 + { BIT(XPRT_CONNECTED), "CONNECTED" }, \ 930 + { BIT(XPRT_CONNECTING), "CONNECTING" }, \ 931 + { BIT(XPRT_CLOSE_WAIT), "CLOSE_WAIT" }, \ 932 + { BIT(XPRT_BOUND), "BOUND" }, \ 933 + { BIT(XPRT_BINDING), "BINDING" }, \ 934 + { BIT(XPRT_CLOSING), "CLOSING" }, \ 935 + { BIT(XPRT_OFFLINE), "OFFLINE" }, \ 936 + { BIT(XPRT_REMOVE), "REMOVE" }, \ 937 + { BIT(XPRT_CONGESTED), "CONGESTED" }, \ 938 + { BIT(XPRT_CWND_WAIT), "CWND_WAIT" }, \ 939 + { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }) 953 940 954 941 DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class, 955 942 TP_PROTO( ··· 1055 1042 __entry->status = status; 1056 1043 ), 1057 1044 1058 - TP_printk( 1059 - "task:%u@%u xid=0x%08x seqno=%u status=%d", 1045 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1046 + " xid=0x%08x seqno=%u status=%d", 1060 1047 __entry->task_id, __entry->client_id, __entry->xid, 1061 1048 __entry->seqno, __entry->status) 1062 1049 ); ··· 1095 1082 __assign_str(procname, rpc_proc_name(task)); 1096 1083 ), 1097 1084 1098 - TP_printk( 1099 - "task:%u@%u xid=0x%08x %sv%d %s ntrans=%d timeout=%lu", 1085 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1086 + " xid=0x%08x %sv%d %s ntrans=%d timeout=%lu", 1100 1087 __entry->task_id, __entry->client_id, __entry->xid, 1101 1088 __get_str(progname), __entry->version, __get_str(procname), 1102 1089 __entry->ntrans, __entry->timeout ··· 1150 1137 xprt->snd_task->tk_pid : -1; 1151 1138 ), 1152 1139 1153 - TP_printk("task:%u@%u snd_task:%u", 1140 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1141 + " snd_task:" SUNRPC_TRACE_PID_SPECIFIER, 1154 1142 __entry->task_id, __entry->client_id, 1155 1143 __entry->snd_task_id) 1156 1144 ); ··· 1199 1185 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); 1200 1186 ), 1201 1187 1202 - TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s", 1188 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1189 + " snd_task:" SUNRPC_TRACE_PID_SPECIFIER 1190 + " cong=%lu cwnd=%lu%s", 1203 1191 __entry->task_id, __entry->client_id, 1204 1192 __entry->snd_task_id, __entry->cong, __entry->cwnd, 1205 1193 __entry->wait ? " (wait)" : "") ··· 1239 1223 __entry->xid = be32_to_cpu(rqst->rq_xid); 1240 1224 ), 1241 1225 1242 - TP_printk("task:%u@%u xid=0x%08x", 1226 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x", 1243 1227 __entry->task_id, __entry->client_id, __entry->xid 1244 1228 ) 1245 1229 ); ··· 1328 1312 __assign_str(servername, task->tk_xprt->servername); 1329 1313 ), 1330 1314 1331 - TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u", 1315 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1316 + " server=%s program=%u version=%u protocol=%d bind_version=%u", 1332 1317 __entry->task_id, __entry->client_id, __get_str(servername), 1333 1318 __entry->program, __entry->version, __entry->protocol, 1334 1319 __entry->bind_version ··· 1359 1342 __entry->port = port; 1360 1343 ), 1361 1344 1362 - TP_printk("task:%u@%u status=%d port=%u", 1345 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d port=%u", 1363 1346 __entry->task_id, __entry->client_id, 1364 1347 __entry->status, __entry->port 1365 1348 )
+18
include/trace/events/sunrpc_base.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2021 Oracle and/or its affiliates. 4 + * 5 + * Common types and format specifiers for sunrpc. 6 + */ 7 + 8 + #if !defined(_TRACE_SUNRPC_BASE_H) 9 + #define _TRACE_SUNRPC_BASE_H 10 + 11 + #include <linux/tracepoint.h> 12 + 13 + #define SUNRPC_TRACE_PID_SPECIFIER "%08x" 14 + #define SUNRPC_TRACE_CLID_SPECIFIER "%08x" 15 + #define SUNRPC_TRACE_TASK_SPECIFIER \ 16 + "task:" SUNRPC_TRACE_PID_SPECIFIER "@" SUNRPC_TRACE_CLID_SPECIFIER 17 + 18 + #endif /* _TRACE_SUNRPC_BASE_H */
+15 -18
net/sunrpc/clnt.c
··· 1076 1076 static 1077 1077 void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt) 1078 1078 { 1079 - 1080 - if (clnt != NULL) { 1081 - rpc_task_set_transport(task, clnt); 1082 - task->tk_client = clnt; 1083 - refcount_inc(&clnt->cl_count); 1084 - if (clnt->cl_softrtry) 1085 - task->tk_flags |= RPC_TASK_SOFT; 1086 - if (clnt->cl_softerr) 1087 - task->tk_flags |= RPC_TASK_TIMEOUT; 1088 - if (clnt->cl_noretranstimeo) 1089 - task->tk_flags |= RPC_TASK_NO_RETRANS_TIMEOUT; 1090 - if (atomic_read(&clnt->cl_swapper)) 1091 - task->tk_flags |= RPC_TASK_SWAPPER; 1092 - /* Add to the client's list of all tasks */ 1093 - spin_lock(&clnt->cl_lock); 1094 - list_add_tail(&task->tk_task, &clnt->cl_tasks); 1095 - spin_unlock(&clnt->cl_lock); 1096 - } 1079 + rpc_task_set_transport(task, clnt); 1080 + task->tk_client = clnt; 1081 + refcount_inc(&clnt->cl_count); 1082 + if (clnt->cl_softrtry) 1083 + task->tk_flags |= RPC_TASK_SOFT; 1084 + if (clnt->cl_softerr) 1085 + task->tk_flags |= RPC_TASK_TIMEOUT; 1086 + if (clnt->cl_noretranstimeo) 1087 + task->tk_flags |= RPC_TASK_NO_RETRANS_TIMEOUT; 1088 + if (atomic_read(&clnt->cl_swapper)) 1089 + task->tk_flags |= RPC_TASK_SWAPPER; 1090 + /* Add to the client's list of all tasks */ 1091 + spin_lock(&clnt->cl_lock); 1092 + list_add_tail(&task->tk_task, &clnt->cl_tasks); 1093 + spin_unlock(&clnt->cl_lock); 1097 1094 } 1098 1095 1099 1096 static void
+15 -5
net/sunrpc/sched.c
··· 277 277 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS) 278 278 static void rpc_task_set_debuginfo(struct rpc_task *task) 279 279 { 280 - static atomic_t rpc_pid; 280 + struct rpc_clnt *clnt = task->tk_client; 281 281 282 - task->tk_pid = atomic_inc_return(&rpc_pid); 282 + /* Might be a task carrying a reverse-direction operation */ 283 + if (!clnt) { 284 + static atomic_t rpc_pid; 285 + 286 + task->tk_pid = atomic_inc_return(&rpc_pid); 287 + return; 288 + } 289 + 290 + task->tk_pid = atomic_inc_return(&clnt->cl_pid); 283 291 } 284 292 #else 285 293 static inline void rpc_task_set_debuginfo(struct rpc_task *task) ··· 837 829 else if (task->tk_client) 838 830 rpc_count_iostats(task, task->tk_client->cl_metrics); 839 831 if (task->tk_ops->rpc_call_done != NULL) { 832 + trace_rpc_task_call_done(task, task->tk_ops->rpc_call_done); 840 833 task->tk_ops->rpc_call_done(task, task->tk_calldata); 841 834 if (task->tk_action != NULL) { 842 835 /* Always release the RPC slot and buffer memory */ ··· 912 903 /* 913 904 * Lockless check for whether task is sleeping or not. 914 905 */ 915 - if (!RPC_IS_QUEUED(task)) 906 + if (!RPC_IS_QUEUED(task)) { 907 + cond_resched(); 916 908 continue; 909 + } 917 910 918 911 /* 919 912 * Signalled tasks should exit rather than sleep. ··· 1241 1230 if (!wq) 1242 1231 goto out_failed; 1243 1232 rpciod_workqueue = wq; 1244 - /* Note: highpri because network receive is latency sensitive */ 1245 - wq = alloc_workqueue("xprtiod", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_HIGHPRI, 0); 1233 + wq = alloc_workqueue("xprtiod", WQ_UNBOUND | WQ_MEM_RECLAIM, 0); 1246 1234 if (!wq) 1247 1235 goto free_rpciod; 1248 1236 xprtiod_workqueue = wq;
+8 -4
net/sunrpc/sysfs.c
··· 109 109 struct sock_xprt *sock; 110 110 ssize_t ret = -1; 111 111 112 - if (!xprt) 113 - return 0; 112 + if (!xprt || !xprt_connected(xprt)) { 113 + xprt_put(xprt); 114 + return -ENOTCONN; 115 + } 114 116 115 117 sock = container_of(xprt, struct sock_xprt, xprt); 116 118 if (kernel_getsockname(sock->sock, (struct sockaddr *)&saddr) < 0) ··· 131 129 struct rpc_xprt *xprt = rpc_sysfs_xprt_kobj_get_xprt(kobj); 132 130 ssize_t ret; 133 131 134 - if (!xprt) 135 - return 0; 132 + if (!xprt || !xprt_connected(xprt)) { 133 + xprt_put(xprt); 134 + return -ENOTCONN; 135 + } 136 136 137 137 ret = sprintf(buf, "last_used=%lu\ncur_cong=%lu\ncong_win=%lu\n" 138 138 "max_num_slots=%u\nmin_num_slots=%u\nnum_reqs=%u\n"
+22 -19
net/sunrpc/xprt.c
··· 246 246 static void xprt_clear_locked(struct rpc_xprt *xprt) 247 247 { 248 248 xprt->snd_task = NULL; 249 - if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) { 250 - smp_mb__before_atomic(); 251 - clear_bit(XPRT_LOCKED, &xprt->state); 252 - smp_mb__after_atomic(); 253 - } else 249 + if (!test_bit(XPRT_CLOSE_WAIT, &xprt->state)) 250 + clear_bit_unlock(XPRT_LOCKED, &xprt->state); 251 + else 254 252 queue_work(xprtiod_workqueue, &xprt->task_cleanup); 255 253 } 256 254 ··· 735 737 unsigned int pflags = memalloc_nofs_save(); 736 738 737 739 trace_xprt_disconnect_auto(xprt); 740 + xprt->connect_cookie++; 741 + smp_mb__before_atomic(); 738 742 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 739 743 xprt->ops->close(xprt); 740 744 xprt_release_write(xprt, NULL); ··· 767 767 */ 768 768 static void xprt_schedule_autoclose_locked(struct rpc_xprt *xprt) 769 769 { 770 - set_bit(XPRT_CLOSE_WAIT, &xprt->state); 770 + if (test_and_set_bit(XPRT_CLOSE_WAIT, &xprt->state)) 771 + return; 771 772 if (test_and_set_bit(XPRT_LOCKED, &xprt->state) == 0) 772 773 queue_work(xprtiod_workqueue, &xprt->task_cleanup); 773 774 else if (xprt->snd_task && !test_bit(XPRT_SND_IS_COOKIE, &xprt->state)) ··· 1604 1603 { 1605 1604 struct rpc_rqst *next, *req = task->tk_rqstp; 1606 1605 struct rpc_xprt *xprt = req->rq_xprt; 1607 - int counter, status; 1606 + int status; 1608 1607 1609 1608 spin_lock(&xprt->queue_lock); 1610 - counter = 0; 1611 - while (!list_empty(&xprt->xmit_queue)) { 1612 - if (++counter == 20) 1609 + for (;;) { 1610 + next = list_first_entry_or_null(&xprt->xmit_queue, 1611 + struct rpc_rqst, rq_xmit); 1612 + if (!next) 1613 1613 break; 1614 - next = list_first_entry(&xprt->xmit_queue, 1615 - struct rpc_rqst, rq_xmit); 1616 1614 xprt_pin_rqst(next); 1617 1615 spin_unlock(&xprt->queue_lock); 1618 1616 status = xprt_request_transmit(next, task); ··· 1619 1619 status = 0; 1620 1620 spin_lock(&xprt->queue_lock); 1621 1621 xprt_unpin_rqst(next); 1622 - if (status == 0) { 1623 - if (!xprt_request_data_received(task) || 1624 - test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) 1625 - continue; 1626 - } else if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) 1627 - task->tk_status = status; 1628 - break; 1622 + if (status < 0) { 1623 + if (test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) 1624 + task->tk_status = status; 1625 + break; 1626 + } 1627 + /* Was @task transmitted, and has it received a reply? */ 1628 + if (xprt_request_data_received(task) && 1629 + !test_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate)) 1630 + break; 1631 + cond_resched_lock(&xprt->queue_lock); 1629 1632 } 1630 1633 spin_unlock(&xprt->queue_lock); 1631 1634 }
+42 -6
net/sunrpc/xprtrdma/frwr_ops.c
··· 515 515 * a single ib_post_send() call. 516 516 */ 517 517 prev = &first; 518 - while ((mr = rpcrdma_mr_pop(&req->rl_registered))) { 519 - 518 + mr = rpcrdma_mr_pop(&req->rl_registered); 519 + do { 520 520 trace_xprtrdma_mr_localinv(mr); 521 521 r_xprt->rx_stats.local_inv_needed++; 522 522 ··· 533 533 534 534 *prev = last; 535 535 prev = &last->next; 536 - } 536 + } while ((mr = rpcrdma_mr_pop(&req->rl_registered))); 537 + 537 538 mr = container_of(last, struct rpcrdma_mr, mr_invwr); 538 539 539 540 /* Strong send queue ordering guarantees that when the ··· 618 617 * a single ib_post_send() call. 619 618 */ 620 619 prev = &first; 621 - while ((mr = rpcrdma_mr_pop(&req->rl_registered))) { 622 - 620 + mr = rpcrdma_mr_pop(&req->rl_registered); 621 + do { 623 622 trace_xprtrdma_mr_localinv(mr); 624 623 r_xprt->rx_stats.local_inv_needed++; 625 624 ··· 636 635 637 636 *prev = last; 638 637 prev = &last->next; 639 - } 638 + } while ((mr = rpcrdma_mr_pop(&req->rl_registered))); 640 639 641 640 /* Strong send queue ordering guarantees that when the 642 641 * last WR in the chain completes, all WRs in the chain ··· 666 665 /* Force a connection loss to ensure complete recovery. 667 666 */ 668 667 rpcrdma_force_disconnect(ep); 668 + } 669 + 670 + /** 671 + * frwr_wp_create - Create an MR for padding Write chunks 672 + * @r_xprt: transport resources to use 673 + * 674 + * Return 0 on success, negative errno on failure. 675 + */ 676 + int frwr_wp_create(struct rpcrdma_xprt *r_xprt) 677 + { 678 + struct rpcrdma_ep *ep = r_xprt->rx_ep; 679 + struct rpcrdma_mr_seg seg; 680 + struct rpcrdma_mr *mr; 681 + 682 + mr = rpcrdma_mr_get(r_xprt); 683 + if (!mr) 684 + return -EAGAIN; 685 + mr->mr_req = NULL; 686 + ep->re_write_pad_mr = mr; 687 + 688 + seg.mr_len = XDR_UNIT; 689 + seg.mr_page = virt_to_page(ep->re_write_pad); 690 + seg.mr_offset = offset_in_page(ep->re_write_pad); 691 + if (IS_ERR(frwr_map(r_xprt, &seg, 1, true, xdr_zero, mr))) 692 + return -EIO; 693 + trace_xprtrdma_mr_fastreg(mr); 694 + 695 + mr->mr_cqe.done = frwr_wc_fastreg; 696 + mr->mr_regwr.wr.next = NULL; 697 + mr->mr_regwr.wr.wr_cqe = &mr->mr_cqe; 698 + mr->mr_regwr.wr.num_sge = 0; 699 + mr->mr_regwr.wr.opcode = IB_WR_REG_MR; 700 + mr->mr_regwr.wr.send_flags = 0; 701 + 702 + return ib_post_send(ep->re_id->qp, &mr->mr_regwr.wr, NULL); 669 703 }
+14 -9
net/sunrpc/xprtrdma/rpc_rdma.c
··· 255 255 page_base = 0; 256 256 } 257 257 258 - if (type == rpcrdma_readch) 259 - goto out; 260 - 261 - /* When encoding a Write chunk, some servers need to see an 262 - * extra segment for non-XDR-aligned Write chunks. The upper 263 - * layer provides space in the tail iovec that may be used 264 - * for this purpose. 265 - */ 266 - if (type == rpcrdma_writech && r_xprt->rx_ep->re_implicit_roundup) 258 + if (type == rpcrdma_readch || type == rpcrdma_writech) 267 259 goto out; 268 260 269 261 if (xdrbuf->tail[0].iov_len) ··· 397 405 enum rpcrdma_chunktype wtype) 398 406 { 399 407 struct xdr_stream *xdr = &req->rl_stream; 408 + struct rpcrdma_ep *ep = r_xprt->rx_ep; 400 409 struct rpcrdma_mr_seg *seg; 401 410 struct rpcrdma_mr *mr; 402 411 int nsegs, nchunks; ··· 435 442 nchunks++; 436 443 nsegs -= mr->mr_nents; 437 444 } while (nsegs); 445 + 446 + if (xdr_pad_size(rqst->rq_rcv_buf.page_len)) { 447 + if (encode_rdma_segment(xdr, ep->re_write_pad_mr) < 0) 448 + return -EMSGSIZE; 449 + 450 + trace_xprtrdma_chunk_wp(rqst->rq_task, ep->re_write_pad_mr, 451 + nsegs); 452 + r_xprt->rx_stats.write_chunk_count++; 453 + r_xprt->rx_stats.total_rdma_request += mr->mr_length; 454 + nchunks++; 455 + nsegs -= mr->mr_nents; 456 + } 438 457 439 458 /* Update count of segments in this Write chunk */ 440 459 *segcount = cpu_to_be32(nchunks);
+1 -2
net/sunrpc/xprtrdma/verbs.c
··· 205 205 unsigned int rsize, wsize; 206 206 207 207 /* Default settings for RPC-over-RDMA Version One */ 208 - ep->re_implicit_roundup = xprt_rdma_pad_optimize; 209 208 rsize = RPCRDMA_V1_DEF_INLINE_SIZE; 210 209 wsize = RPCRDMA_V1_DEF_INLINE_SIZE; 211 210 212 211 if (pmsg && 213 212 pmsg->cp_magic == rpcrdma_cmp_magic && 214 213 pmsg->cp_version == RPCRDMA_CMP_VERSION) { 215 - ep->re_implicit_roundup = true; 216 214 rsize = rpcrdma_decode_buffer_size(pmsg->cp_send_size); 217 215 wsize = rpcrdma_decode_buffer_size(pmsg->cp_recv_size); 218 216 } ··· 549 551 goto out; 550 552 } 551 553 rpcrdma_mrs_create(r_xprt); 554 + frwr_wp_create(r_xprt); 552 555 553 556 out: 554 557 trace_xprtrdma_connect(r_xprt, rc);
+5 -1
net/sunrpc/xprtrdma/xprt_rdma.h
··· 68 68 /* 69 69 * RDMA Endpoint -- connection endpoint details 70 70 */ 71 + struct rpcrdma_mr; 71 72 struct rpcrdma_ep { 72 73 struct kref re_kref; 73 74 struct rdma_cm_id *re_id; 74 75 struct ib_pd *re_pd; 75 76 unsigned int re_max_rdma_segs; 76 77 unsigned int re_max_fr_depth; 77 - bool re_implicit_roundup; 78 + struct rpcrdma_mr *re_write_pad_mr; 78 79 enum ib_mr_type re_mrtype; 79 80 struct completion re_done; 80 81 unsigned int re_send_count; ··· 98 97 unsigned int re_inline_recv; /* negotiated */ 99 98 100 99 atomic_t re_completion_ids; 100 + 101 + char re_write_pad[XDR_UNIT]; 101 102 }; 102 103 103 104 /* Pre-allocate extra Work Requests for handling reverse-direction ··· 538 535 void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs); 539 536 void frwr_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req); 540 537 void frwr_unmap_async(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req); 538 + int frwr_wp_create(struct rpcrdma_xprt *r_xprt); 541 539 542 540 /* 543 541 * RPC/RDMA protocol calls - xprtrdma/rpc_rdma.c
+41 -68
net/sunrpc/xprtsock.c
··· 1134 1134 1135 1135 static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) 1136 1136 { 1137 + xprt->connect_cookie++; 1137 1138 smp_mb__before_atomic(); 1138 1139 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); 1139 1140 clear_bit(XPRT_CLOSING, &xprt->state); ··· 1154 1153 struct sock_xprt *transport; 1155 1154 struct rpc_xprt *xprt; 1156 1155 1157 - read_lock_bh(&sk->sk_callback_lock); 1158 1156 if (!(xprt = xprt_from_sock(sk))) 1159 - goto out; 1157 + return; 1160 1158 1161 1159 transport = container_of(xprt, struct sock_xprt, xprt); 1162 1160 transport->xprt_err = -sk->sk_err; 1163 1161 if (transport->xprt_err == 0) 1164 - goto out; 1162 + return; 1165 1163 dprintk("RPC: xs_error_report client %p, error=%d...\n", 1166 1164 xprt, -transport->xprt_err); 1167 1165 trace_rpc_socket_error(xprt, sk->sk_socket, transport->xprt_err); ··· 1168 1168 /* barrier ensures xprt_err is set before XPRT_SOCK_WAKE_ERROR */ 1169 1169 smp_mb__before_atomic(); 1170 1170 xs_run_error_worker(transport, XPRT_SOCK_WAKE_ERROR); 1171 - out: 1172 - read_unlock_bh(&sk->sk_callback_lock); 1173 1171 } 1174 1172 1175 1173 static void xs_reset_transport(struct sock_xprt *transport) ··· 1186 1188 kernel_sock_shutdown(sock, SHUT_RDWR); 1187 1189 1188 1190 mutex_lock(&transport->recv_mutex); 1189 - write_lock_bh(&sk->sk_callback_lock); 1191 + lock_sock(sk); 1190 1192 transport->inet = NULL; 1191 1193 transport->sock = NULL; 1192 1194 transport->file = NULL; ··· 1195 1197 1196 1198 xs_restore_old_callbacks(transport, sk); 1197 1199 xprt_clear_connected(xprt); 1198 - write_unlock_bh(&sk->sk_callback_lock); 1199 1200 xs_sock_reset_connection_flags(xprt); 1200 1201 /* Reset stream record info */ 1201 1202 xs_stream_reset_connect(transport); 1203 + release_sock(sk); 1202 1204 mutex_unlock(&transport->recv_mutex); 1203 1205 1204 1206 trace_rpc_socket_close(xprt, sock); ··· 1362 1364 { 1363 1365 struct rpc_xprt *xprt; 1364 1366 1365 - read_lock_bh(&sk->sk_callback_lock); 1366 1367 dprintk("RPC: xs_data_ready...\n"); 1367 1368 xprt = xprt_from_sock(sk); 1368 1369 if (xprt != NULL) { ··· 1376 1379 if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) 1377 1380 queue_work(xprtiod_workqueue, &transport->recv_worker); 1378 1381 } 1379 - read_unlock_bh(&sk->sk_callback_lock); 1380 1382 } 1381 1383 1382 1384 /* ··· 1404 1408 struct rpc_xprt *xprt; 1405 1409 struct sock_xprt *transport; 1406 1410 1407 - read_lock_bh(&sk->sk_callback_lock); 1408 1411 if (!(xprt = xprt_from_sock(sk))) 1409 - goto out; 1412 + return; 1410 1413 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); 1411 1414 dprintk("RPC: state %x conn %d dead %d zapped %d sk_shutdown %d\n", 1412 1415 sk->sk_state, xprt_connected(xprt), ··· 1466 1471 /* Trigger the socket release */ 1467 1472 xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT); 1468 1473 } 1469 - out: 1470 - read_unlock_bh(&sk->sk_callback_lock); 1471 1474 } 1472 1475 1473 1476 static void xs_write_space(struct sock *sk) ··· 1504 1511 */ 1505 1512 static void xs_udp_write_space(struct sock *sk) 1506 1513 { 1507 - read_lock_bh(&sk->sk_callback_lock); 1508 - 1509 1514 /* from net/core/sock.c:sock_def_write_space */ 1510 1515 if (sock_writeable(sk)) 1511 1516 xs_write_space(sk); 1512 - 1513 - read_unlock_bh(&sk->sk_callback_lock); 1514 1517 } 1515 1518 1516 1519 /** ··· 1521 1532 */ 1522 1533 static void xs_tcp_write_space(struct sock *sk) 1523 1534 { 1524 - read_lock_bh(&sk->sk_callback_lock); 1525 - 1526 1535 /* from net/core/stream.c:sk_stream_write_space */ 1527 1536 if (sk_stream_is_writeable(sk)) 1528 1537 xs_write_space(sk); 1529 - 1530 - read_unlock_bh(&sk->sk_callback_lock); 1531 1538 } 1532 1539 1533 1540 static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt) ··· 1818 1833 if (!transport->inet) { 1819 1834 struct sock *sk = sock->sk; 1820 1835 1821 - write_lock_bh(&sk->sk_callback_lock); 1836 + lock_sock(sk); 1822 1837 1823 1838 xs_save_old_callbacks(transport, sk); 1824 1839 ··· 1834 1849 transport->sock = sock; 1835 1850 transport->inet = sk; 1836 1851 1837 - write_unlock_bh(&sk->sk_callback_lock); 1852 + release_sock(sk); 1838 1853 } 1839 1854 1840 1855 xs_stream_start_connect(transport); ··· 2016 2031 if (!transport->inet) { 2017 2032 struct sock *sk = sock->sk; 2018 2033 2019 - write_lock_bh(&sk->sk_callback_lock); 2034 + lock_sock(sk); 2020 2035 2021 2036 xs_save_old_callbacks(transport, sk); 2022 2037 ··· 2033 2048 2034 2049 xs_set_memalloc(xprt); 2035 2050 2036 - write_unlock_bh(&sk->sk_callback_lock); 2051 + release_sock(sk); 2037 2052 } 2038 2053 xs_udp_do_set_buffer_size(xprt); 2039 2054 ··· 2159 2174 static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) 2160 2175 { 2161 2176 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 2162 - int ret = -ENOTCONN; 2163 2177 2164 2178 if (!transport->inet) { 2165 2179 struct sock *sk = sock->sk; ··· 2178 2194 xs_tcp_set_socket_timeouts(xprt, sock); 2179 2195 tcp_sock_set_nodelay(sk); 2180 2196 2181 - write_lock_bh(&sk->sk_callback_lock); 2197 + lock_sock(sk); 2182 2198 2183 2199 xs_save_old_callbacks(transport, sk); 2184 2200 ··· 2198 2214 transport->sock = sock; 2199 2215 transport->inet = sk; 2200 2216 2201 - write_unlock_bh(&sk->sk_callback_lock); 2217 + release_sock(sk); 2202 2218 } 2203 2219 2204 2220 if (!xprt_bound(xprt)) 2205 - goto out; 2221 + return -ENOTCONN; 2206 2222 2207 2223 xs_set_memalloc(xprt); 2208 2224 ··· 2210 2226 2211 2227 /* Tell the socket layer to start connecting... */ 2212 2228 set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); 2213 - ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); 2214 - switch (ret) { 2215 - case 0: 2216 - xs_set_srcport(transport, sock); 2217 - fallthrough; 2218 - case -EINPROGRESS: 2219 - /* SYN_SENT! */ 2220 - if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) 2221 - xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; 2222 - break; 2223 - case -EADDRNOTAVAIL: 2224 - /* Source port number is unavailable. Try a new one! */ 2225 - transport->srcport = 0; 2226 - } 2227 - out: 2228 - return ret; 2229 + return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); 2229 2230 } 2230 2231 2231 2232 /** ··· 2225 2256 container_of(work, struct sock_xprt, connect_worker.work); 2226 2257 struct socket *sock = transport->sock; 2227 2258 struct rpc_xprt *xprt = &transport->xprt; 2228 - int status = -EIO; 2259 + int status; 2229 2260 2230 2261 if (!sock) { 2231 2262 sock = xs_create_sock(xprt, transport, 2232 2263 xs_addr(xprt)->sa_family, SOCK_STREAM, 2233 2264 IPPROTO_TCP, true); 2234 2265 if (IS_ERR(sock)) { 2235 - status = PTR_ERR(sock); 2266 + xprt_wake_pending_tasks(xprt, PTR_ERR(sock)); 2236 2267 goto out; 2237 2268 } 2238 2269 } ··· 2249 2280 xprt, -status, xprt_connected(xprt), 2250 2281 sock->sk->sk_state); 2251 2282 switch (status) { 2252 - default: 2253 - printk("%s: connect returned unhandled error %d\n", 2254 - __func__, status); 2255 - fallthrough; 2256 - case -EADDRNOTAVAIL: 2257 - /* We're probably in TIME_WAIT. Get rid of existing socket, 2258 - * and retry 2259 - */ 2260 - xs_tcp_force_close(xprt); 2261 - break; 2262 2283 case 0: 2284 + xs_set_srcport(transport, sock); 2285 + fallthrough; 2263 2286 case -EINPROGRESS: 2287 + /* SYN_SENT! */ 2288 + if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) 2289 + xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; 2290 + fallthrough; 2264 2291 case -EALREADY: 2265 - xprt_unlock_connect(xprt, transport); 2266 - return; 2292 + goto out_unlock; 2293 + case -EADDRNOTAVAIL: 2294 + /* Source port number is unavailable. Try a new one! */ 2295 + transport->srcport = 0; 2296 + status = -EAGAIN; 2297 + break; 2267 2298 case -EINVAL: 2268 2299 /* Happens, for instance, if the user specified a link 2269 2300 * local IPv6 address without a scope-id. ··· 2275 2306 case -EHOSTUNREACH: 2276 2307 case -EADDRINUSE: 2277 2308 case -ENOBUFS: 2278 - /* xs_tcp_force_close() wakes tasks with a fixed error code. 2279 - * We need to wake them first to ensure the correct error code. 2280 - */ 2281 - xprt_wake_pending_tasks(xprt, status); 2282 - xs_tcp_force_close(xprt); 2283 - goto out; 2309 + break; 2310 + default: 2311 + printk("%s: connect returned unhandled error %d\n", 2312 + __func__, status); 2313 + status = -EAGAIN; 2284 2314 } 2285 - status = -EAGAIN; 2315 + 2316 + /* xs_tcp_force_close() wakes tasks with a fixed error code. 2317 + * We need to wake them first to ensure the correct error code. 2318 + */ 2319 + xprt_wake_pending_tasks(xprt, status); 2320 + xs_tcp_force_close(xprt); 2286 2321 out: 2287 2322 xprt_clear_connecting(xprt); 2323 + out_unlock: 2288 2324 xprt_unlock_connect(xprt, transport); 2289 - xprt_wake_pending_tasks(xprt, status); 2290 2325 } 2291 2326 2292 2327 /** ··· 2314 2341 2315 2342 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); 2316 2343 2317 - if (transport->sock != NULL) { 2344 + if (transport->sock != NULL && !xprt_connecting(xprt)) { 2318 2345 dprintk("RPC: xs_connect delayed xprt %p for %lu " 2319 2346 "seconds\n", 2320 2347 xprt, xprt->reestablish_timeout / HZ);