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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'nfsd-5.5' of git://linux-nfs.org/~bfields/linux

Pull nfsd updates from Bruce Fields:
"This is a relatively quiet cycle for nfsd, mainly various bugfixes.

Possibly most interesting is Trond's fixes for some callback races
that were due to my incomplete understanding of rpc client shutdown.
Unfortunately at the last minute I've started noticing a new
intermittent failure to send callbacks. As the logic seems basically
correct, I'm leaving Trond's patches in for now, and hope to find a
fix in the next week so I don't have to revert those patches"

* tag 'nfsd-5.5' of git://linux-nfs.org/~bfields/linux: (24 commits)
nfsd: depend on CRYPTO_MD5 for legacy client tracking
NFSD fixing possible null pointer derefering in copy offload
nfsd: check for EBUSY from vfs_rmdir/vfs_unink.
nfsd: Ensure CLONE persists data and metadata changes to the target file
SUNRPC: Fix backchannel latency metrics
nfsd: restore NFSv3 ACL support
nfsd: v4 support requires CRYPTO_SHA256
nfsd: Fix cld_net->cn_tfm initialization
lockd: remove __KERNEL__ ifdefs
sunrpc: remove __KERNEL__ ifdefs
race in exportfs_decode_fh()
nfsd: Drop LIST_HEAD where the variable it declares is never used.
nfsd: document callback_wq serialization of callback code
nfsd: mark cb path down on unknown errors
nfsd: Fix races between nfsd4_cb_release() and nfsd4_shutdown_callback()
nfsd: minor 4.1 callback cleanup
SUNRPC: Fix svcauth_gss_proxy_init()
SUNRPC: Trace gssproxy upcall results
sunrpc: fix crash when cache_head become valid before update
nfsd: remove private bin2hex implementation
...

+343 -137
+2 -1
fs/nfsd/Kconfig
··· 73 73 select NFSD_V3 74 74 select FS_POSIX_ACL 75 75 select SUNRPC_GSS 76 - select CRYPTO 76 + select CRYPTO_MD5 77 + select CRYPTO_SHA256 77 78 select GRACE_PERIOD 78 79 help 79 80 This option enables support in your system's NFS server for
-2
fs/nfsd/filecache.c
··· 685 685 void 686 686 nfsd_file_cache_shutdown(void) 687 687 { 688 - LIST_HEAD(dispose); 689 - 690 688 set_bit(NFSD_FILE_SHUTDOWN, &nfsd_file_lru_flags); 691 689 692 690 lease_unregister_notifier(&nfsd_file_lease_notifier);
+85 -19
fs/nfsd/nfs4callback.c
··· 826 826 return max(nn->nfsd4_lease/10, (time_t)1) * HZ; 827 827 } 828 828 829 + static struct workqueue_struct *callback_wq; 830 + 831 + static bool nfsd4_queue_cb(struct nfsd4_callback *cb) 832 + { 833 + return queue_work(callback_wq, &cb->cb_work); 834 + } 835 + 836 + static void nfsd41_cb_inflight_begin(struct nfs4_client *clp) 837 + { 838 + atomic_inc(&clp->cl_cb_inflight); 839 + } 840 + 841 + static void nfsd41_cb_inflight_end(struct nfs4_client *clp) 842 + { 843 + 844 + if (atomic_dec_and_test(&clp->cl_cb_inflight)) 845 + wake_up_var(&clp->cl_cb_inflight); 846 + } 847 + 848 + static void nfsd41_cb_inflight_wait_complete(struct nfs4_client *clp) 849 + { 850 + wait_var_event(&clp->cl_cb_inflight, 851 + !atomic_read(&clp->cl_cb_inflight)); 852 + } 853 + 829 854 static const struct cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc_clnt *client, struct nfsd4_session *ses) 830 855 { 831 856 if (clp->cl_minorversion == 0) { ··· 962 937 clp->cl_cb_state = NFSD4_CB_UP; 963 938 } 964 939 940 + static void nfsd4_cb_probe_release(void *calldata) 941 + { 942 + struct nfs4_client *clp = container_of(calldata, struct nfs4_client, cl_cb_null); 943 + 944 + nfsd41_cb_inflight_end(clp); 945 + 946 + } 947 + 965 948 static const struct rpc_call_ops nfsd4_cb_probe_ops = { 966 949 /* XXX: release method to ensure we set the cb channel down if 967 950 * necessary on early failure? */ 968 951 .rpc_call_done = nfsd4_cb_probe_done, 952 + .rpc_release = nfsd4_cb_probe_release, 969 953 }; 970 - 971 - static struct workqueue_struct *callback_wq; 972 954 973 955 /* 974 956 * Poke the callback thread to process any updates to the callback ··· 1007 975 * If the slot is available, then mark it busy. Otherwise, set the 1008 976 * thread for sleeping on the callback RPC wait queue. 1009 977 */ 1010 - static bool nfsd41_cb_get_slot(struct nfs4_client *clp, struct rpc_task *task) 978 + static bool nfsd41_cb_get_slot(struct nfsd4_callback *cb, struct rpc_task *task) 1011 979 { 1012 - if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { 980 + struct nfs4_client *clp = cb->cb_clp; 981 + 982 + if (!cb->cb_holds_slot && 983 + test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { 1013 984 rpc_sleep_on(&clp->cl_cb_waitq, task, NULL); 1014 985 /* Race breaker */ 1015 986 if (test_and_set_bit(0, &clp->cl_cb_slot_busy) != 0) { ··· 1021 986 } 1022 987 rpc_wake_up_queued_task(&clp->cl_cb_waitq, task); 1023 988 } 989 + cb->cb_holds_slot = true; 1024 990 return true; 991 + } 992 + 993 + static void nfsd41_cb_release_slot(struct nfsd4_callback *cb) 994 + { 995 + struct nfs4_client *clp = cb->cb_clp; 996 + 997 + if (cb->cb_holds_slot) { 998 + cb->cb_holds_slot = false; 999 + clear_bit(0, &clp->cl_cb_slot_busy); 1000 + rpc_wake_up_next(&clp->cl_cb_waitq); 1001 + } 1002 + } 1003 + 1004 + static void nfsd41_destroy_cb(struct nfsd4_callback *cb) 1005 + { 1006 + struct nfs4_client *clp = cb->cb_clp; 1007 + 1008 + nfsd41_cb_release_slot(cb); 1009 + if (cb->cb_ops && cb->cb_ops->release) 1010 + cb->cb_ops->release(cb); 1011 + nfsd41_cb_inflight_end(clp); 1025 1012 } 1026 1013 1027 1014 /* ··· 1062 1005 */ 1063 1006 cb->cb_seq_status = 1; 1064 1007 cb->cb_status = 0; 1065 - if (minorversion) { 1066 - if (!cb->cb_holds_slot && !nfsd41_cb_get_slot(clp, task)) 1067 - return; 1068 - cb->cb_holds_slot = true; 1069 - } 1008 + if (minorversion && !nfsd41_cb_get_slot(cb, task)) 1009 + return; 1070 1010 rpc_call_start(task); 1071 1011 } 1072 1012 ··· 1126 1072 } 1127 1073 break; 1128 1074 default: 1075 + nfsd4_mark_cb_fault(cb->cb_clp, cb->cb_seq_status); 1129 1076 dprintk("%s: unprocessed error %d\n", __func__, 1130 1077 cb->cb_seq_status); 1131 1078 } 1132 1079 1133 - cb->cb_holds_slot = false; 1134 - clear_bit(0, &clp->cl_cb_slot_busy); 1135 - rpc_wake_up_next(&clp->cl_cb_waitq); 1080 + nfsd41_cb_release_slot(cb); 1136 1081 dprintk("%s: freed slot, new seqid=%d\n", __func__, 1137 1082 clp->cl_cb_session->se_cb_seq_nr); 1138 1083 ··· 1144 1091 ret = false; 1145 1092 goto out; 1146 1093 need_restart: 1147 - task->tk_status = 0; 1148 - cb->cb_need_restart = true; 1094 + if (!test_bit(NFSD4_CLIENT_CB_KILL, &clp->cl_flags)) { 1095 + task->tk_status = 0; 1096 + cb->cb_need_restart = true; 1097 + } 1149 1098 return false; 1150 1099 } 1151 1100 ··· 1189 1134 struct nfsd4_callback *cb = calldata; 1190 1135 1191 1136 if (cb->cb_need_restart) 1192 - nfsd4_run_cb(cb); 1137 + nfsd4_queue_cb(cb); 1193 1138 else 1194 - cb->cb_ops->release(cb); 1139 + nfsd41_destroy_cb(cb); 1195 1140 1196 1141 } 1197 1142 ··· 1225 1170 */ 1226 1171 nfsd4_run_cb(&clp->cl_cb_null); 1227 1172 flush_workqueue(callback_wq); 1173 + nfsd41_cb_inflight_wait_complete(clp); 1228 1174 } 1229 1175 1230 1176 /* requires cl_lock: */ ··· 1243 1187 return NULL; 1244 1188 } 1245 1189 1190 + /* 1191 + * Note there isn't a lot of locking in this code; instead we depend on 1192 + * the fact that it is run from the callback_wq, which won't run two 1193 + * work items at once. So, for example, callback_wq handles all access 1194 + * of cl_cb_client and all calls to rpc_create or rpc_shutdown_client. 1195 + */ 1246 1196 static void nfsd4_process_cb_update(struct nfsd4_callback *cb) 1247 1197 { 1248 1198 struct nfs4_cb_conn conn; ··· 1317 1255 clnt = clp->cl_cb_client; 1318 1256 if (!clnt) { 1319 1257 /* Callback channel broken, or client killed; give up: */ 1320 - if (cb->cb_ops && cb->cb_ops->release) 1321 - cb->cb_ops->release(cb); 1258 + nfsd41_destroy_cb(cb); 1322 1259 return; 1323 1260 } 1324 1261 ··· 1326 1265 */ 1327 1266 if (!cb->cb_ops && clp->cl_minorversion) { 1328 1267 clp->cl_cb_state = NFSD4_CB_UP; 1268 + nfsd41_destroy_cb(cb); 1329 1269 return; 1330 1270 } 1331 1271 ··· 1352 1290 1353 1291 void nfsd4_run_cb(struct nfsd4_callback *cb) 1354 1292 { 1355 - queue_work(callback_wq, &cb->cb_work); 1293 + struct nfs4_client *clp = cb->cb_clp; 1294 + 1295 + nfsd41_cb_inflight_begin(clp); 1296 + if (!nfsd4_queue_cb(cb)) 1297 + nfsd41_cb_inflight_end(clp); 1356 1298 }
+4 -2
fs/nfsd/nfs4proc.c
··· 1077 1077 goto out; 1078 1078 1079 1079 status = nfsd4_clone_file_range(src->nf_file, clone->cl_src_pos, 1080 - dst->nf_file, clone->cl_dst_pos, clone->cl_count); 1080 + dst->nf_file, clone->cl_dst_pos, clone->cl_count, 1081 + EX_ISSYNC(cstate->current_fh.fh_export)); 1081 1082 1082 1083 nfsd_file_put(dst); 1083 1084 nfsd_file_put(src); ··· 1298 1297 out: 1299 1298 return status; 1300 1299 out_err: 1301 - cleanup_async_copy(async_copy); 1300 + if (async_copy) 1301 + cleanup_async_copy(async_copy); 1302 1302 goto out; 1303 1303 } 1304 1304
+10 -13
fs/nfsd/nfs4recover.c
··· 1578 1578 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 1579 1579 bool running; 1580 1580 int retries = 10; 1581 + struct crypto_shash *tfm; 1581 1582 1582 1583 status = nfs4_cld_state_init(net); 1583 1584 if (status) ··· 1587 1586 status = __nfsd4_init_cld_pipe(net); 1588 1587 if (status) 1589 1588 goto err_shutdown; 1590 - nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0); 1591 - if (IS_ERR(nn->cld_net->cn_tfm)) { 1592 - status = PTR_ERR(nn->cld_net->cn_tfm); 1593 - goto err_remove; 1594 - } 1595 1589 1596 1590 /* 1597 1591 * rpc pipe upcalls take 30 seconds to time out, so we don't want to ··· 1603 1607 status = -ETIMEDOUT; 1604 1608 goto err_remove; 1605 1609 } 1610 + tfm = crypto_alloc_shash("sha256", 0, 0); 1611 + if (IS_ERR(tfm)) { 1612 + status = PTR_ERR(tfm); 1613 + goto err_remove; 1614 + } 1615 + nn->cld_net->cn_tfm = tfm; 1606 1616 1607 1617 status = nfsd4_cld_get_version(nn); 1608 1618 if (status == -EOPNOTSUPP) ··· 1852 1850 static char * 1853 1851 bin_to_hex_dup(const unsigned char *src, int srclen) 1854 1852 { 1855 - int i; 1856 - char *buf, *hex; 1853 + char *buf; 1857 1854 1858 1855 /* +1 for terminating NULL */ 1859 - buf = kmalloc((srclen * 2) + 1, GFP_KERNEL); 1856 + buf = kzalloc((srclen * 2) + 1, GFP_KERNEL); 1860 1857 if (!buf) 1861 1858 return buf; 1862 1859 1863 - hex = buf; 1864 - for (i = 0; i < srclen; i++) { 1865 - sprintf(hex, "%2.2x", *src++); 1866 - hex += 2; 1867 - } 1860 + bin2hex(buf, src, srclen); 1868 1861 return buf; 1869 1862 } 1870 1863
+12 -7
fs/nfsd/nfs4state.c
··· 2382 2382 access = bmap_to_share_mode(ols->st_access_bmap); 2383 2383 deny = bmap_to_share_mode(ols->st_deny_bmap); 2384 2384 2385 - seq_printf(s, "access: \%s\%s, ", 2385 + seq_printf(s, "access: %s%s, ", 2386 2386 access & NFS4_SHARE_ACCESS_READ ? "r" : "-", 2387 2387 access & NFS4_SHARE_ACCESS_WRITE ? "w" : "-"); 2388 - seq_printf(s, "deny: \%s\%s, ", 2388 + seq_printf(s, "deny: %s%s, ", 2389 2389 deny & NFS4_SHARE_ACCESS_READ ? "r" : "-", 2390 2390 deny & NFS4_SHARE_ACCESS_WRITE ? "w" : "-"); 2391 2391 ··· 3548 3548 (bool)seq->cachethis) 3549 3549 return false; 3550 3550 /* 3551 - * If there's an error than the reply can have fewer ops than 3552 - * the call. But if we cached a reply with *more* ops than the 3553 - * call you're sending us now, then this new call is clearly not 3554 - * really a replay of the old one: 3551 + * If there's an error then the reply can have fewer ops than 3552 + * the call. 3555 3553 */ 3556 - if (slot->sl_opcnt < argp->opcnt) 3554 + if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) 3555 + return false; 3556 + /* 3557 + * But if we cached a reply with *more* ops than the call you're 3558 + * sending us now, then this new call is clearly not really a 3559 + * replay of the old one: 3560 + */ 3561 + if (slot->sl_opcnt > argp->opcnt) 3557 3562 return false; 3558 3563 /* This is the only check explicitly called by spec: */ 3559 3564 if (!same_creds(&rqstp->rq_cred, &slot->sl_cred))
-2
fs/nfsd/nfs4xdr.c
··· 3452 3452 struct xdr_stream *xdr = &resp->xdr; 3453 3453 struct xdr_buf *buf = xdr->buf; 3454 3454 u32 eof; 3455 - long len; 3456 3455 int space_left; 3457 3456 __be32 nfserr; 3458 3457 __be32 *p = xdr->p - 2; ··· 3460 3461 if (xdr->end - xdr->p < 1) 3461 3462 return nfserr_resource; 3462 3463 3463 - len = maxcount; 3464 3464 nfserr = nfsd_splice_read(read->rd_rqstp, read->rd_fhp, 3465 3465 file, read->rd_offset, &maxcount, &eof); 3466 3466 read->rd_length = maxcount;
+2 -1
fs/nfsd/nfsd.h
··· 280 280 #define nfserr_union_notsupp cpu_to_be32(NFS4ERR_UNION_NOTSUPP) 281 281 #define nfserr_offload_denied cpu_to_be32(NFS4ERR_OFFLOAD_DENIED) 282 282 #define nfserr_wrong_lfs cpu_to_be32(NFS4ERR_WRONG_LFS) 283 - #define nfserr_badlabel cpu_to_be32(NFS4ERR_BADLABEL) 283 + #define nfserr_badlabel cpu_to_be32(NFS4ERR_BADLABEL) 284 + #define nfserr_file_open cpu_to_be32(NFS4ERR_FILE_OPEN) 284 285 285 286 /* error codes for internal use */ 286 287 /* if a request fails due to kmalloc failure, it gets dropped.
+1 -2
fs/nfsd/nfssvc.c
··· 95 95 96 96 #define NFSD_ACL_MINVERS 2 97 97 #define NFSD_ACL_NRVERS ARRAY_SIZE(nfsd_acl_version) 98 - static const struct svc_version *nfsd_acl_versions[NFSD_ACL_NRVERS]; 99 98 100 99 static struct svc_program nfsd_acl_program = { 101 100 .pg_prog = NFS_ACL_PROGRAM, 102 101 .pg_nvers = NFSD_ACL_NRVERS, 103 - .pg_vers = nfsd_acl_versions, 102 + .pg_vers = nfsd_acl_version, 104 103 .pg_name = "nfsacl", 105 104 .pg_class = "nfsd", 106 105 .pg_stats = &nfsd_acl_svcstats,
+1
fs/nfsd/state.h
··· 367 367 struct net *net; 368 368 struct list_head async_copies; /* list of async copies */ 369 369 spinlock_t async_lock; /* lock for async copies */ 370 + atomic_t cl_cb_inflight; /* Outstanding callbacks */ 370 371 }; 371 372 372 373 /* struct nfs4_client_reset
+18 -2
fs/nfsd/vfs.c
··· 525 525 #endif 526 526 527 527 __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, 528 - u64 dst_pos, u64 count) 528 + u64 dst_pos, u64 count, bool sync) 529 529 { 530 530 loff_t cloned; 531 531 ··· 534 534 return nfserrno(cloned); 535 535 if (count && cloned != count) 536 536 return nfserrno(-EINVAL); 537 + if (sync) { 538 + loff_t dst_end = count ? dst_pos + count - 1 : LLONG_MAX; 539 + int status = vfs_fsync_range(dst, dst_pos, dst_end, 0); 540 + if (status < 0) 541 + return nfserrno(status); 542 + } 537 543 return 0; 538 544 } 539 545 ··· 1815 1809 out_drop_write: 1816 1810 fh_drop_write(fhp); 1817 1811 out_nfserr: 1818 - err = nfserrno(host_err); 1812 + if (host_err == -EBUSY) { 1813 + /* name is mounted-on. There is no perfect 1814 + * error status. 1815 + */ 1816 + if (nfsd_v4client(rqstp)) 1817 + err = nfserr_file_open; 1818 + else 1819 + err = nfserr_acces; 1820 + } else { 1821 + err = nfserrno(host_err); 1822 + } 1819 1823 out: 1820 1824 return err; 1821 1825 }
+1 -1
fs/nfsd/vfs.h
··· 56 56 __be32 nfsd4_vfs_fallocate(struct svc_rqst *, struct svc_fh *, 57 57 struct file *, loff_t, loff_t, int); 58 58 __be32 nfsd4_clone_file_range(struct file *, u64, struct file *, 59 - u64, u64); 59 + u64, u64, bool); 60 60 #endif /* CONFIG_NFSD_V4 */ 61 61 __be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *, 62 62 char *name, int len, struct iattr *attrs,
-4
include/linux/lockd/debug.h
··· 10 10 #ifndef LINUX_LOCKD_DEBUG_H 11 11 #define LINUX_LOCKD_DEBUG_H 12 12 13 - #ifdef __KERNEL__ 14 - 15 13 #include <linux/sunrpc/debug.h> 16 14 17 15 /* ··· 22 24 #else 23 25 # define ifdebug(flag) if (0) 24 26 #endif 25 - 26 - #endif /* __KERNEL__ */ 27 27 28 28 /* 29 29 * Debug flags
-4
include/linux/lockd/lockd.h
··· 10 10 #ifndef LINUX_LOCKD_LOCKD_H 11 11 #define LINUX_LOCKD_LOCKD_H 12 12 13 - #ifdef __KERNEL__ 14 - 15 13 #include <linux/in.h> 16 14 #include <linux/in6.h> 17 15 #include <net/ipv6.h> ··· 370 372 } 371 373 372 374 extern const struct lock_manager_operations nlmsvc_lock_operations; 373 - 374 - #endif /* __KERNEL__ */ 375 375 376 376 #endif /* LINUX_LOCKD_LOCKD_H */
-3
include/linux/sunrpc/auth.h
··· 10 10 #ifndef _LINUX_SUNRPC_AUTH_H 11 11 #define _LINUX_SUNRPC_AUTH_H 12 12 13 - #ifdef __KERNEL__ 14 - 15 13 #include <linux/sunrpc/sched.h> 16 14 #include <linux/sunrpc/msg_prot.h> 17 15 #include <linux/sunrpc/xdr.h> ··· 192 194 return NULL; 193 195 } 194 196 195 - #endif /* __KERNEL__ */ 196 197 #endif /* _LINUX_SUNRPC_AUTH_H */
-2
include/linux/sunrpc/auth_gss.h
··· 13 13 #ifndef _LINUX_SUNRPC_AUTH_GSS_H 14 14 #define _LINUX_SUNRPC_AUTH_GSS_H 15 15 16 - #ifdef __KERNEL__ 17 16 #include <linux/refcount.h> 18 17 #include <linux/sunrpc/auth.h> 19 18 #include <linux/sunrpc/svc.h> ··· 89 90 unsigned long gc_upcall_timestamp; 90 91 }; 91 92 92 - #endif /* __KERNEL__ */ 93 93 #endif /* _LINUX_SUNRPC_AUTH_GSS_H */ 94 94
-3
include/linux/sunrpc/clnt.h
··· 109 109 const char * p_name; /* name of procedure */ 110 110 }; 111 111 112 - #ifdef __KERNEL__ 113 - 114 112 struct rpc_create_args { 115 113 struct net *net; 116 114 int protocol; ··· 236 238 (task->tk_msg.rpc_proc->p_decode != NULL); 237 239 } 238 240 239 - #endif /* __KERNEL__ */ 240 241 #endif /* _LINUX_SUNRPC_CLNT_H */
-2
include/linux/sunrpc/gss_api.h
··· 13 13 #ifndef _LINUX_SUNRPC_GSS_API_H 14 14 #define _LINUX_SUNRPC_GSS_API_H 15 15 16 - #ifdef __KERNEL__ 17 16 #include <linux/sunrpc/xdr.h> 18 17 #include <linux/sunrpc/msg_prot.h> 19 18 #include <linux/uio.h> ··· 159 160 * corresponding call to gss_mech_put. */ 160 161 void gss_mech_put(struct gss_api_mech *); 161 162 162 - #endif /* __KERNEL__ */ 163 163 #endif /* _LINUX_SUNRPC_GSS_API_H */ 164 164
-3
include/linux/sunrpc/gss_err.h
··· 34 34 #ifndef _LINUX_SUNRPC_GSS_ERR_H 35 35 #define _LINUX_SUNRPC_GSS_ERR_H 36 36 37 - #ifdef __KERNEL__ 38 - 39 37 typedef unsigned int OM_uint32; 40 38 41 39 /* ··· 161 163 /* XXXX This is a necessary evil until the spec is fixed */ 162 164 #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE 163 165 164 - #endif /* __KERNEL__ */ 165 166 #endif /* __LINUX_SUNRPC_GSS_ERR_H */
-3
include/linux/sunrpc/msg_prot.h
··· 8 8 #ifndef _LINUX_SUNRPC_MSGPROT_H_ 9 9 #define _LINUX_SUNRPC_MSGPROT_H_ 10 10 11 - #ifdef __KERNEL__ /* user programs should get these from the rpc header files */ 12 - 13 11 #define RPC_VERSION 2 14 12 15 13 /* size of an XDR encoding unit in bytes, i.e. 32bit */ ··· 215 217 /* Assume INET6_ADDRSTRLEN will always be larger than INET_ADDRSTRLEN... */ 216 218 #define RPCBIND_MAXUADDRLEN RPCBIND_MAXUADDR6LEN 217 219 218 - #endif /* __KERNEL__ */ 219 220 #endif /* _LINUX_SUNRPC_MSGPROT_H_ */
-3
include/linux/sunrpc/rpc_pipe_fs.h
··· 2 2 #ifndef _LINUX_SUNRPC_RPC_PIPE_FS_H 3 3 #define _LINUX_SUNRPC_RPC_PIPE_FS_H 4 4 5 - #ifdef __KERNEL__ 6 - 7 5 #include <linux/workqueue.h> 8 6 9 7 struct rpc_pipe_dir_head { ··· 130 132 131 133 extern bool gssd_running(struct net *net); 132 134 133 - #endif 134 135 #endif
-4
include/linux/sunrpc/svcauth.h
··· 10 10 #ifndef _LINUX_SUNRPC_SVCAUTH_H_ 11 11 #define _LINUX_SUNRPC_SVCAUTH_H_ 12 12 13 - #ifdef __KERNEL__ 14 - 15 13 #include <linux/string.h> 16 14 #include <linux/sunrpc/msg_prot.h> 17 15 #include <linux/sunrpc/cache.h> ··· 182 184 { 183 185 return full_name_hash(NULL, buf, length) >> (32 - bits); 184 186 } 185 - 186 - #endif /* __KERNEL__ */ 187 187 188 188 #endif /* _LINUX_SUNRPC_SVCAUTH_H_ */
-2
include/linux/sunrpc/svcauth_gss.h
··· 9 9 #ifndef _LINUX_SUNRPC_SVCAUTH_GSS_H 10 10 #define _LINUX_SUNRPC_SVCAUTH_GSS_H 11 11 12 - #ifdef __KERNEL__ 13 12 #include <linux/sched.h> 14 13 #include <linux/sunrpc/types.h> 15 14 #include <linux/sunrpc/xdr.h> ··· 23 24 int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 24 25 u32 svcauth_gss_flavor(struct auth_domain *dom); 25 26 26 - #endif /* __KERNEL__ */ 27 27 #endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */
-3
include/linux/sunrpc/xdr.h
··· 11 11 #ifndef _SUNRPC_XDR_H_ 12 12 #define _SUNRPC_XDR_H_ 13 13 14 - #ifdef __KERNEL__ 15 - 16 14 #include <linux/uio.h> 17 15 #include <asm/byteorder.h> 18 16 #include <asm/unaligned.h> ··· 550 552 *array = be32_to_cpup(p); 551 553 return retval; 552 554 } 553 - #endif /* __KERNEL__ */ 554 555 555 556 #endif /* _SUNRPC_XDR_H_ */
-4
include/linux/sunrpc/xprt.h
··· 19 19 #include <linux/sunrpc/xdr.h> 20 20 #include <linux/sunrpc/msg_prot.h> 21 21 22 - #ifdef __KERNEL__ 23 - 24 22 #define RPC_MIN_SLOT_TABLE (2U) 25 23 #define RPC_DEF_SLOT_TABLE (16U) 26 24 #define RPC_MAX_SLOT_TABLE_LIMIT (65536U) ··· 503 505 { 504 506 } 505 507 #endif 506 - 507 - #endif /* __KERNEL__*/ 508 508 509 509 #endif /* _LINUX_SUNRPC_XPRT_H */
-4
include/linux/sunrpc/xprtsock.h
··· 8 8 #ifndef _LINUX_SUNRPC_XPRTSOCK_H 9 9 #define _LINUX_SUNRPC_XPRTSOCK_H 10 10 11 - #ifdef __KERNEL__ 12 - 13 11 int init_socket_xprt(void); 14 12 void cleanup_socket_xprt(void); 15 13 ··· 88 90 #define XPRT_SOCK_WAKE_WRITE (5) 89 91 #define XPRT_SOCK_WAKE_PENDING (6) 90 92 #define XPRT_SOCK_WAKE_DISCONNECT (7) 91 - 92 - #endif /* __KERNEL__ */ 93 93 94 94 #endif /* _LINUX_SUNRPC_XPRTSOCK_H */
+45
include/trace/events/rpcgss.h
··· 126 126 DEFINE_GSSAPI_EVENT(wrap); 127 127 DEFINE_GSSAPI_EVENT(unwrap); 128 128 129 + TRACE_EVENT(rpcgss_accept_upcall, 130 + TP_PROTO( 131 + __be32 xid, 132 + u32 major_status, 133 + u32 minor_status 134 + ), 135 + 136 + TP_ARGS(xid, major_status, minor_status), 137 + 138 + TP_STRUCT__entry( 139 + __field(u32, xid) 140 + __field(u32, minor_status) 141 + __field(unsigned long, major_status) 142 + ), 143 + 144 + TP_fast_assign( 145 + __entry->xid = be32_to_cpu(xid); 146 + __entry->minor_status = minor_status; 147 + __entry->major_status = major_status; 148 + ), 149 + 150 + TP_printk("xid=0x%08x major_status=%s (0x%08lx) minor_status=%u", 151 + __entry->xid, __entry->major_status == 0 ? "GSS_S_COMPLETE" : 152 + show_gss_status(__entry->major_status), 153 + __entry->major_status, __entry->minor_status 154 + ) 155 + ); 156 + 129 157 130 158 /** 131 159 ** GSS auth unwrap failures ··· 383 355 show_pseudoflavor(__entry->flavor), __entry->error) 384 356 ); 385 357 358 + TRACE_EVENT(rpcgss_oid_to_mech, 359 + TP_PROTO( 360 + const char *oid 361 + ), 362 + 363 + TP_ARGS(oid), 364 + 365 + TP_STRUCT__entry( 366 + __string(oid, oid) 367 + ), 368 + 369 + TP_fast_assign( 370 + __assign_str(oid, oid); 371 + ), 372 + 373 + TP_printk("mech for oid %s was not found", __get_str(oid)) 374 + ); 386 375 387 376 #endif /* _TRACE_RPCGSS_H */ 388 377
+23 -7
include/trace/events/rpcrdma.h
··· 1564 1564 ** Server-side RDMA API events 1565 1565 **/ 1566 1566 1567 - TRACE_EVENT(svcrdma_dma_map_page, 1567 + DECLARE_EVENT_CLASS(svcrdma_dma_map_class, 1568 1568 TP_PROTO( 1569 1569 const struct svcxprt_rdma *rdma, 1570 - const void *page 1570 + u64 dma_addr, 1571 + u32 length 1571 1572 ), 1572 1573 1573 - TP_ARGS(rdma, page), 1574 + TP_ARGS(rdma, dma_addr, length), 1574 1575 1575 1576 TP_STRUCT__entry( 1576 - __field(const void *, page); 1577 + __field(u64, dma_addr) 1578 + __field(u32, length) 1577 1579 __string(device, rdma->sc_cm_id->device->name) 1578 1580 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1579 1581 ), 1580 1582 1581 1583 TP_fast_assign( 1582 - __entry->page = page; 1584 + __entry->dma_addr = dma_addr; 1585 + __entry->length = length; 1583 1586 __assign_str(device, rdma->sc_cm_id->device->name); 1584 1587 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1585 1588 ), 1586 1589 1587 - TP_printk("addr=%s device=%s page=%p", 1588 - __get_str(addr), __get_str(device), __entry->page 1590 + TP_printk("addr=%s device=%s dma_addr=%llu length=%u", 1591 + __get_str(addr), __get_str(device), 1592 + __entry->dma_addr, __entry->length 1589 1593 ) 1590 1594 ); 1595 + 1596 + #define DEFINE_SVC_DMA_EVENT(name) \ 1597 + DEFINE_EVENT(svcrdma_dma_map_class, svcrdma_##name, \ 1598 + TP_PROTO( \ 1599 + const struct svcxprt_rdma *rdma,\ 1600 + u64 dma_addr, \ 1601 + u32 length \ 1602 + ), \ 1603 + TP_ARGS(rdma, dma_addr, length)) 1604 + 1605 + DEFINE_SVC_DMA_EVENT(dma_map_page); 1606 + DEFINE_SVC_DMA_EVENT(dma_unmap_page); 1591 1607 1592 1608 TRACE_EVENT(svcrdma_dma_map_rwctx, 1593 1609 TP_PROTO(
+55
include/trace/events/sunrpc.h
··· 14 14 #include <linux/net.h> 15 15 #include <linux/tracepoint.h> 16 16 17 + TRACE_DEFINE_ENUM(RPC_AUTH_OK); 18 + TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED); 19 + TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED); 20 + TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF); 21 + TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF); 22 + TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK); 23 + TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM); 24 + TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM); 25 + 26 + #define rpc_show_auth_stat(status) \ 27 + __print_symbolic(status, \ 28 + { RPC_AUTH_OK, "AUTH_OK" }, \ 29 + { RPC_AUTH_BADCRED, "BADCRED" }, \ 30 + { RPC_AUTH_REJECTEDCRED, "REJECTEDCRED" }, \ 31 + { RPC_AUTH_BADVERF, "BADVERF" }, \ 32 + { RPC_AUTH_REJECTEDVERF, "REJECTEDVERF" }, \ 33 + { RPC_AUTH_TOOWEAK, "TOOWEAK" }, \ 34 + { RPCSEC_GSS_CREDPROBLEM, "GSS_CREDPROBLEM" }, \ 35 + { RPCSEC_GSS_CTXPROBLEM, "GSS_CTXPROBLEM" }) \ 36 + 17 37 DECLARE_EVENT_CLASS(rpc_task_status, 18 38 19 39 TP_PROTO(const struct rpc_task *task), ··· 978 958 TP_printk("addr=%s xid=0x%08x len=%d flags=%s", 979 959 __get_str(addr), __entry->xid, __entry->len, 980 960 show_rqstp_flags(__entry->flags)) 961 + ); 962 + 963 + #define svc_show_status(status) \ 964 + __print_symbolic(status, \ 965 + { SVC_GARBAGE, "SVC_GARBAGE" }, \ 966 + { SVC_SYSERR, "SVC_SYSERR" }, \ 967 + { SVC_VALID, "SVC_VALID" }, \ 968 + { SVC_NEGATIVE, "SVC_NEGATIVE" }, \ 969 + { SVC_OK, "SVC_OK" }, \ 970 + { SVC_DROP, "SVC_DROP" }, \ 971 + { SVC_CLOSE, "SVC_CLOSE" }, \ 972 + { SVC_DENIED, "SVC_DENIED" }, \ 973 + { SVC_PENDING, "SVC_PENDING" }, \ 974 + { SVC_COMPLETE, "SVC_COMPLETE" }) 975 + 976 + TRACE_EVENT(svc_authenticate, 977 + TP_PROTO(const struct svc_rqst *rqst, int auth_res, __be32 auth_stat), 978 + 979 + TP_ARGS(rqst, auth_res, auth_stat), 980 + 981 + TP_STRUCT__entry( 982 + __field(u32, xid) 983 + __field(unsigned long, svc_status) 984 + __field(unsigned long, auth_stat) 985 + ), 986 + 987 + TP_fast_assign( 988 + __entry->xid = be32_to_cpu(rqst->rq_xid); 989 + __entry->svc_status = auth_res; 990 + __entry->auth_stat = be32_to_cpu(auth_stat); 991 + ), 992 + 993 + TP_printk("xid=0x%08x auth_res=%s auth_stat=%s", 994 + __entry->xid, svc_show_status(__entry->svc_status), 995 + rpc_show_auth_stat(__entry->auth_stat)) 981 996 ); 982 997 983 998 TRACE_EVENT(svc_process,
+3 -1
net/sunrpc/auth_gss/gss_mech_switch.c
··· 20 20 #include <linux/sunrpc/sched.h> 21 21 #include <linux/sunrpc/gss_api.h> 22 22 #include <linux/sunrpc/clnt.h> 23 + #include <trace/events/rpcgss.h> 23 24 24 25 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 25 26 # define RPCDBG_FACILITY RPCDBG_AUTH ··· 159 158 160 159 if (sprint_oid(obj->data, obj->len, buf, sizeof(buf)) < 0) 161 160 return NULL; 162 - dprintk("RPC: %s(%s)\n", __func__, buf); 163 161 request_module("rpc-auth-gss-%s", buf); 164 162 165 163 rcu_read_lock(); ··· 172 172 } 173 173 } 174 174 rcu_read_unlock(); 175 + if (!gm) 176 + trace_rpcgss_oid_to_mech(buf); 175 177 return gm; 176 178 } 177 179
+68 -24
net/sunrpc/auth_gss/svcauth_gss.c
··· 49 49 #include <linux/sunrpc/svcauth.h> 50 50 #include <linux/sunrpc/svcauth_gss.h> 51 51 #include <linux/sunrpc/cache.h> 52 + 53 + #include <trace/events/rpcgss.h> 54 + 52 55 #include "gss_rpc_upcall.h" 53 56 54 57 ··· 1078 1075 return 0; 1079 1076 } 1080 1077 1081 - /* Ok this is really heavily depending on a set of semantics in 1082 - * how rqstp is set up by svc_recv and pages laid down by the 1083 - * server when reading a request. We are basically guaranteed that 1084 - * the token lays all down linearly across a set of pages, starting 1085 - * at iov_base in rq_arg.head[0] which happens to be the first of a 1086 - * set of pages stored in rq_pages[]. 1087 - * rq_arg.head[0].iov_base will provide us the page_base to pass 1088 - * to the upcall. 1089 - */ 1090 - static inline int 1091 - gss_read_proxy_verf(struct svc_rqst *rqstp, 1092 - struct rpc_gss_wire_cred *gc, __be32 *authp, 1093 - struct xdr_netobj *in_handle, 1094 - struct gssp_in_token *in_token) 1078 + static void gss_free_in_token_pages(struct gssp_in_token *in_token) 1079 + { 1080 + u32 inlen; 1081 + int i; 1082 + 1083 + i = 0; 1084 + inlen = in_token->page_len; 1085 + while (inlen) { 1086 + if (in_token->pages[i]) 1087 + put_page(in_token->pages[i]); 1088 + inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen; 1089 + } 1090 + 1091 + kfree(in_token->pages); 1092 + in_token->pages = NULL; 1093 + } 1094 + 1095 + static int gss_read_proxy_verf(struct svc_rqst *rqstp, 1096 + struct rpc_gss_wire_cred *gc, __be32 *authp, 1097 + struct xdr_netobj *in_handle, 1098 + struct gssp_in_token *in_token) 1095 1099 { 1096 1100 struct kvec *argv = &rqstp->rq_arg.head[0]; 1097 - u32 inlen; 1098 - int res; 1101 + unsigned int page_base, length; 1102 + int pages, i, res; 1103 + size_t inlen; 1099 1104 1100 1105 res = gss_read_common_verf(gc, argv, authp, in_handle); 1101 1106 if (res) ··· 1113 1102 if (inlen > (argv->iov_len + rqstp->rq_arg.page_len)) 1114 1103 return SVC_DENIED; 1115 1104 1116 - in_token->pages = rqstp->rq_pages; 1117 - in_token->page_base = (ulong)argv->iov_base & ~PAGE_MASK; 1105 + pages = DIV_ROUND_UP(inlen, PAGE_SIZE); 1106 + in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL); 1107 + if (!in_token->pages) 1108 + return SVC_DENIED; 1109 + in_token->page_base = 0; 1118 1110 in_token->page_len = inlen; 1111 + for (i = 0; i < pages; i++) { 1112 + in_token->pages[i] = alloc_page(GFP_KERNEL); 1113 + if (!in_token->pages[i]) { 1114 + gss_free_in_token_pages(in_token); 1115 + return SVC_DENIED; 1116 + } 1117 + } 1119 1118 1119 + length = min_t(unsigned int, inlen, argv->iov_len); 1120 + memcpy(page_address(in_token->pages[0]), argv->iov_base, length); 1121 + inlen -= length; 1122 + 1123 + i = 1; 1124 + page_base = rqstp->rq_arg.page_base; 1125 + while (inlen) { 1126 + length = min_t(unsigned int, inlen, PAGE_SIZE); 1127 + memcpy(page_address(in_token->pages[i]), 1128 + page_address(rqstp->rq_arg.pages[i]) + page_base, 1129 + length); 1130 + 1131 + inlen -= length; 1132 + page_base = 0; 1133 + i++; 1134 + } 1120 1135 return 0; 1121 1136 } 1122 1137 ··· 1307 1270 if (status) 1308 1271 goto out; 1309 1272 1310 - dprintk("RPC: svcauth_gss: gss major status = %d " 1311 - "minor status = %d\n", 1312 - ud.major_status, ud.minor_status); 1273 + trace_rpcgss_accept_upcall(rqstp->rq_xid, ud.major_status, 1274 + ud.minor_status); 1313 1275 1314 1276 switch (ud.major_status) { 1315 1277 case GSS_S_CONTINUE_NEEDED: ··· 1316 1280 break; 1317 1281 case GSS_S_COMPLETE: 1318 1282 status = gss_proxy_save_rsc(sn->rsc_cache, &ud, &handle); 1319 - if (status) 1283 + if (status) { 1284 + pr_info("%s: gss_proxy_save_rsc failed (%d)\n", 1285 + __func__, status); 1320 1286 goto out; 1287 + } 1321 1288 cli_handle.data = (u8 *)&handle; 1322 1289 cli_handle.len = sizeof(handle); 1323 1290 break; ··· 1331 1292 1332 1293 /* Got an answer to the upcall; use it: */ 1333 1294 if (gss_write_init_verf(sn->rsc_cache, rqstp, 1334 - &cli_handle, &ud.major_status)) 1295 + &cli_handle, &ud.major_status)) { 1296 + pr_info("%s: gss_write_init_verf failed\n", __func__); 1335 1297 goto out; 1298 + } 1336 1299 if (gss_write_resv(resv, PAGE_SIZE, 1337 1300 &cli_handle, &ud.out_token, 1338 - ud.major_status, ud.minor_status)) 1301 + ud.major_status, ud.minor_status)) { 1302 + pr_info("%s: gss_write_resv failed\n", __func__); 1339 1303 goto out; 1304 + } 1340 1305 1341 1306 ret = SVC_COMPLETE; 1342 1307 out: 1308 + gss_free_in_token_pages(&ud.in_token); 1343 1309 gssp_free_upcall_data(&ud); 1344 1310 return ret; 1345 1311 }
-6
net/sunrpc/cache.c
··· 53 53 h->last_refresh = now; 54 54 } 55 55 56 - static inline int cache_is_valid(struct cache_head *h); 57 - static void cache_fresh_locked(struct cache_head *head, time_t expiry, 58 - struct cache_detail *detail); 59 56 static void cache_fresh_unlocked(struct cache_head *head, 60 57 struct cache_detail *detail); 61 58 ··· 102 105 if (cache_is_expired(detail, tmp)) { 103 106 hlist_del_init_rcu(&tmp->cache_list); 104 107 detail->entries --; 105 - if (cache_is_valid(tmp) == -EAGAIN) 106 - set_bit(CACHE_NEGATIVE, &tmp->flags); 107 - cache_fresh_locked(tmp, 0, detail); 108 108 freeme = tmp; 109 109 break; 110 110 }
+2
net/sunrpc/svc.c
··· 1337 1337 auth_stat = rpc_autherr_badcred; 1338 1338 auth_res = progp->pg_authenticate(rqstp); 1339 1339 } 1340 + if (auth_res != SVC_OK) 1341 + trace_svc_authenticate(rqstp, auth_res, auth_stat); 1340 1342 switch (auth_res) { 1341 1343 case SVC_OK: 1342 1344 break;
+2
net/sunrpc/svcauth.c
··· 19 19 #include <linux/err.h> 20 20 #include <linux/hash.h> 21 21 22 + #include <trace/events/sunrpc.h> 23 + 22 24 #define RPCDBG_FACILITY RPCDBG_AUTH 23 25 24 26
+1
net/sunrpc/xprtrdma/svc_rdma_backchannel.c
··· 195 195 pr_info("%s: %*ph\n", __func__, 64, rqst->rq_buffer); 196 196 #endif 197 197 198 + rqst->rq_xtime = ktime_get(); 198 199 rc = svc_rdma_bc_sendto(rdma, rqst, ctxt); 199 200 if (rc) { 200 201 svc_rdma_send_ctxt_put(rdma, ctxt);
+6 -2
net/sunrpc/xprtrdma/svc_rdma_sendto.c
··· 233 233 /* The first SGE contains the transport header, which 234 234 * remains mapped until @ctxt is destroyed. 235 235 */ 236 - for (i = 1; i < ctxt->sc_send_wr.num_sge; i++) 236 + for (i = 1; i < ctxt->sc_send_wr.num_sge; i++) { 237 237 ib_dma_unmap_page(device, 238 238 ctxt->sc_sges[i].addr, 239 239 ctxt->sc_sges[i].length, 240 240 DMA_TO_DEVICE); 241 + trace_svcrdma_dma_unmap_page(rdma, 242 + ctxt->sc_sges[i].addr, 243 + ctxt->sc_sges[i].length); 244 + } 241 245 242 246 for (i = 0; i < ctxt->sc_page_count; ++i) 243 247 put_page(ctxt->sc_pages[i]); ··· 494 490 dma_addr_t dma_addr; 495 491 496 492 dma_addr = ib_dma_map_page(dev, page, offset, len, DMA_TO_DEVICE); 493 + trace_svcrdma_dma_map_page(rdma, dma_addr, len); 497 494 if (ib_dma_mapping_error(dev, dma_addr)) 498 495 goto out_maperr; 499 496 ··· 504 499 return 0; 505 500 506 501 out_maperr: 507 - trace_svcrdma_dma_map_page(rdma, page); 508 502 return -EIO; 509 503 } 510 504
+2 -1
net/sunrpc/xprtsock.c
··· 2659 2659 .iov_len = sizeof(marker), 2660 2660 }; 2661 2661 2662 + req->rq_xtime = ktime_get(); 2663 + 2662 2664 len = kernel_sendmsg(transport->sock, &msg, &iov, 1, iov.iov_len); 2663 2665 if (len != iov.iov_len) 2664 2666 return -EAGAIN; ··· 2686 2684 struct svc_xprt *xprt; 2687 2685 int len; 2688 2686 2689 - dprintk("sending request with xid: %08x\n", ntohl(req->rq_xid)); 2690 2687 /* 2691 2688 * Get the server socket associated with this callback xprt 2692 2689 */