cifs_debug.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. *
  4. * Copyright (C) International Business Machines Corp., 2000,2005
  5. *
  6. * Modified by Steve French ([email protected])
  7. */
  8. #include <linux/fs.h>
  9. #include <linux/string.h>
  10. #include <linux/ctype.h>
  11. #include <linux/module.h>
  12. #include <linux/proc_fs.h>
  13. #include <linux/uaccess.h>
  14. #include "cifspdu.h"
  15. #include "cifsglob.h"
  16. #include "cifsproto.h"
  17. #include "cifs_debug.h"
  18. #include "cifsfs.h"
  19. #include "fs_context.h"
  20. #ifdef CONFIG_CIFS_DFS_UPCALL
  21. #include "dfs_cache.h"
  22. #endif
  23. #ifdef CONFIG_CIFS_SMB_DIRECT
  24. #include "smbdirect.h"
  25. #endif
  26. #include "cifs_swn.h"
  27. void
  28. cifs_dump_mem(char *label, void *data, int length)
  29. {
  30. pr_debug("%s: dump of %d bytes of data at 0x%p\n", label, length, data);
  31. print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 16, 4,
  32. data, length, true);
  33. }
  34. void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
  35. {
  36. #ifdef CONFIG_CIFS_DEBUG2
  37. struct smb_hdr *smb = buf;
  38. cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n",
  39. smb->Command, smb->Status.CifsError,
  40. smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
  41. cifs_dbg(VFS, "smb buf %p len %u\n", smb,
  42. server->ops->calc_smb_size(smb));
  43. #endif /* CONFIG_CIFS_DEBUG2 */
  44. }
  45. void cifs_dump_mids(struct TCP_Server_Info *server)
  46. {
  47. #ifdef CONFIG_CIFS_DEBUG2
  48. struct mid_q_entry *mid_entry;
  49. if (server == NULL)
  50. return;
  51. cifs_dbg(VFS, "Dump pending requests:\n");
  52. spin_lock(&server->mid_lock);
  53. list_for_each_entry(mid_entry, &server->pending_mid_q, qhead) {
  54. cifs_dbg(VFS, "State: %d Cmd: %d Pid: %d Cbdata: %p Mid %llu\n",
  55. mid_entry->mid_state,
  56. le16_to_cpu(mid_entry->command),
  57. mid_entry->pid,
  58. mid_entry->callback_data,
  59. mid_entry->mid);
  60. #ifdef CONFIG_CIFS_STATS2
  61. cifs_dbg(VFS, "IsLarge: %d buf: %p time rcv: %ld now: %ld\n",
  62. mid_entry->large_buf,
  63. mid_entry->resp_buf,
  64. mid_entry->when_received,
  65. jiffies);
  66. #endif /* STATS2 */
  67. cifs_dbg(VFS, "IsMult: %d IsEnd: %d\n",
  68. mid_entry->multiRsp, mid_entry->multiEnd);
  69. if (mid_entry->resp_buf) {
  70. cifs_dump_detail(mid_entry->resp_buf, server);
  71. cifs_dump_mem("existing buf: ",
  72. mid_entry->resp_buf, 62);
  73. }
  74. }
  75. spin_unlock(&server->mid_lock);
  76. #endif /* CONFIG_CIFS_DEBUG2 */
  77. }
  78. #ifdef CONFIG_PROC_FS
  79. static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
  80. {
  81. __u32 dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
  82. seq_printf(m, "%s Mounts: %d ", tcon->tree_name, tcon->tc_count);
  83. if (tcon->nativeFileSystem)
  84. seq_printf(m, "Type: %s ", tcon->nativeFileSystem);
  85. seq_printf(m, "DevInfo: 0x%x Attributes: 0x%x\n\tPathComponentMax: %d Status: %d",
  86. le32_to_cpu(tcon->fsDevInfo.DeviceCharacteristics),
  87. le32_to_cpu(tcon->fsAttrInfo.Attributes),
  88. le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength),
  89. tcon->status);
  90. if (dev_type == FILE_DEVICE_DISK)
  91. seq_puts(m, " type: DISK ");
  92. else if (dev_type == FILE_DEVICE_CD_ROM)
  93. seq_puts(m, " type: CDROM ");
  94. else
  95. seq_printf(m, " type: %d ", dev_type);
  96. seq_printf(m, "Serial Number: 0x%x", tcon->vol_serial_number);
  97. if ((tcon->seal) ||
  98. (tcon->ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) ||
  99. (tcon->share_flags & SHI1005_FLAGS_ENCRYPT_DATA))
  100. seq_printf(m, " Encrypted");
  101. if (tcon->nocase)
  102. seq_printf(m, " nocase");
  103. if (tcon->unix_ext)
  104. seq_printf(m, " POSIX Extensions");
  105. if (tcon->ses->server->ops->dump_share_caps)
  106. tcon->ses->server->ops->dump_share_caps(m, tcon);
  107. if (tcon->use_witness)
  108. seq_puts(m, " Witness");
  109. if (tcon->broken_sparse_sup)
  110. seq_puts(m, " nosparse");
  111. if (tcon->need_reconnect)
  112. seq_puts(m, "\tDISCONNECTED ");
  113. seq_putc(m, '\n');
  114. }
  115. static void
  116. cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
  117. {
  118. struct TCP_Server_Info *server = chan->server;
  119. seq_printf(m, "\n\n\t\tChannel: %d ConnectionId: 0x%llx"
  120. "\n\t\tNumber of credits: %d Dialect 0x%x"
  121. "\n\t\tTCP status: %d Instance: %d"
  122. "\n\t\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d"
  123. "\n\t\tIn Send: %d In MaxReq Wait: %d",
  124. i+1, server->conn_id,
  125. server->credits,
  126. server->dialect,
  127. server->tcpStatus,
  128. server->reconnect_instance,
  129. server->srv_count,
  130. server->sec_mode,
  131. in_flight(server),
  132. atomic_read(&server->in_send),
  133. atomic_read(&server->num_waiters));
  134. }
  135. static void
  136. cifs_dump_iface(struct seq_file *m, struct cifs_server_iface *iface)
  137. {
  138. struct sockaddr_in *ipv4 = (struct sockaddr_in *)&iface->sockaddr;
  139. struct sockaddr_in6 *ipv6 = (struct sockaddr_in6 *)&iface->sockaddr;
  140. seq_printf(m, "\tSpeed: %zu bps\n", iface->speed);
  141. seq_puts(m, "\t\tCapabilities: ");
  142. if (iface->rdma_capable)
  143. seq_puts(m, "rdma ");
  144. if (iface->rss_capable)
  145. seq_puts(m, "rss ");
  146. seq_putc(m, '\n');
  147. if (iface->sockaddr.ss_family == AF_INET)
  148. seq_printf(m, "\t\tIPv4: %pI4\n", &ipv4->sin_addr);
  149. else if (iface->sockaddr.ss_family == AF_INET6)
  150. seq_printf(m, "\t\tIPv6: %pI6\n", &ipv6->sin6_addr);
  151. if (!iface->is_active)
  152. seq_puts(m, "\t\t[for-cleanup]\n");
  153. }
  154. static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
  155. {
  156. struct TCP_Server_Info *server;
  157. struct cifs_ses *ses;
  158. struct cifs_tcon *tcon;
  159. struct cifsFileInfo *cfile;
  160. seq_puts(m, "# Version:1\n");
  161. seq_puts(m, "# Format:\n");
  162. seq_puts(m, "# <tree id> <ses id> <persistent fid> <flags> <count> <pid> <uid>");
  163. #ifdef CONFIG_CIFS_DEBUG2
  164. seq_printf(m, " <filename> <mid>\n");
  165. #else
  166. seq_printf(m, " <filename>\n");
  167. #endif /* CIFS_DEBUG2 */
  168. spin_lock(&cifs_tcp_ses_lock);
  169. list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
  170. list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
  171. list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
  172. spin_lock(&tcon->open_file_lock);
  173. list_for_each_entry(cfile, &tcon->openFileList, tlist) {
  174. seq_printf(m,
  175. "0x%x 0x%llx 0x%llx 0x%x %d %d %d %pd",
  176. tcon->tid,
  177. ses->Suid,
  178. cfile->fid.persistent_fid,
  179. cfile->f_flags,
  180. cfile->count,
  181. cfile->pid,
  182. from_kuid(&init_user_ns, cfile->uid),
  183. cfile->dentry);
  184. #ifdef CONFIG_CIFS_DEBUG2
  185. seq_printf(m, " %llu\n", cfile->fid.mid);
  186. #else
  187. seq_printf(m, "\n");
  188. #endif /* CIFS_DEBUG2 */
  189. }
  190. spin_unlock(&tcon->open_file_lock);
  191. }
  192. }
  193. }
  194. spin_unlock(&cifs_tcp_ses_lock);
  195. seq_putc(m, '\n');
  196. return 0;
  197. }
  198. static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
  199. {
  200. struct mid_q_entry *mid_entry;
  201. struct TCP_Server_Info *server;
  202. struct TCP_Server_Info *chan_server;
  203. struct cifs_ses *ses;
  204. struct cifs_tcon *tcon;
  205. struct cifs_server_iface *iface;
  206. size_t iface_weight = 0, iface_min_speed = 0;
  207. struct cifs_server_iface *last_iface = NULL;
  208. int c, i, j;
  209. seq_puts(m,
  210. "Display Internal CIFS Data Structures for Debugging\n"
  211. "---------------------------------------------------\n");
  212. seq_printf(m, "CIFS Version %s\n", CIFS_VERSION);
  213. seq_printf(m, "Features:");
  214. #ifdef CONFIG_CIFS_DFS_UPCALL
  215. seq_printf(m, " DFS");
  216. #endif
  217. #ifdef CONFIG_CIFS_FSCACHE
  218. seq_printf(m, ",FSCACHE");
  219. #endif
  220. #ifdef CONFIG_CIFS_SMB_DIRECT
  221. seq_printf(m, ",SMB_DIRECT");
  222. #endif
  223. #ifdef CONFIG_CIFS_STATS2
  224. seq_printf(m, ",STATS2");
  225. #else
  226. seq_printf(m, ",STATS");
  227. #endif
  228. #ifdef CONFIG_CIFS_DEBUG2
  229. seq_printf(m, ",DEBUG2");
  230. #elif defined(CONFIG_CIFS_DEBUG)
  231. seq_printf(m, ",DEBUG");
  232. #endif
  233. #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
  234. seq_printf(m, ",ALLOW_INSECURE_LEGACY");
  235. #endif
  236. #ifdef CONFIG_CIFS_POSIX
  237. seq_printf(m, ",CIFS_POSIX");
  238. #endif
  239. #ifdef CONFIG_CIFS_UPCALL
  240. seq_printf(m, ",UPCALL(SPNEGO)");
  241. #endif
  242. #ifdef CONFIG_CIFS_XATTR
  243. seq_printf(m, ",XATTR");
  244. #endif
  245. seq_printf(m, ",ACL");
  246. #ifdef CONFIG_CIFS_SWN_UPCALL
  247. seq_puts(m, ",WITNESS");
  248. #endif
  249. seq_putc(m, '\n');
  250. seq_printf(m, "CIFSMaxBufSize: %d\n", CIFSMaxBufSize);
  251. seq_printf(m, "Active VFS Requests: %d\n", GlobalTotalActiveXid);
  252. seq_printf(m, "\nServers: ");
  253. c = 0;
  254. spin_lock(&cifs_tcp_ses_lock);
  255. list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
  256. /* channel info will be printed as a part of sessions below */
  257. if (CIFS_SERVER_IS_CHAN(server))
  258. continue;
  259. c++;
  260. seq_printf(m, "\n%d) ConnectionId: 0x%llx ",
  261. c, server->conn_id);
  262. spin_lock(&server->srv_lock);
  263. if (server->hostname)
  264. seq_printf(m, "Hostname: %s ", server->hostname);
  265. spin_unlock(&server->srv_lock);
  266. #ifdef CONFIG_CIFS_SMB_DIRECT
  267. if (!server->rdma)
  268. goto skip_rdma;
  269. if (!server->smbd_conn) {
  270. seq_printf(m, "\nSMBDirect transport not available");
  271. goto skip_rdma;
  272. }
  273. seq_printf(m, "\nSMBDirect (in hex) protocol version: %x "
  274. "transport status: %x",
  275. server->smbd_conn->protocol,
  276. server->smbd_conn->transport_status);
  277. seq_printf(m, "\nConn receive_credit_max: %x "
  278. "send_credit_target: %x max_send_size: %x",
  279. server->smbd_conn->receive_credit_max,
  280. server->smbd_conn->send_credit_target,
  281. server->smbd_conn->max_send_size);
  282. seq_printf(m, "\nConn max_fragmented_recv_size: %x "
  283. "max_fragmented_send_size: %x max_receive_size:%x",
  284. server->smbd_conn->max_fragmented_recv_size,
  285. server->smbd_conn->max_fragmented_send_size,
  286. server->smbd_conn->max_receive_size);
  287. seq_printf(m, "\nConn keep_alive_interval: %x "
  288. "max_readwrite_size: %x rdma_readwrite_threshold: %x",
  289. server->smbd_conn->keep_alive_interval,
  290. server->smbd_conn->max_readwrite_size,
  291. server->smbd_conn->rdma_readwrite_threshold);
  292. seq_printf(m, "\nDebug count_get_receive_buffer: %x "
  293. "count_put_receive_buffer: %x count_send_empty: %x",
  294. server->smbd_conn->count_get_receive_buffer,
  295. server->smbd_conn->count_put_receive_buffer,
  296. server->smbd_conn->count_send_empty);
  297. seq_printf(m, "\nRead Queue count_reassembly_queue: %x "
  298. "count_enqueue_reassembly_queue: %x "
  299. "count_dequeue_reassembly_queue: %x "
  300. "fragment_reassembly_remaining: %x "
  301. "reassembly_data_length: %x "
  302. "reassembly_queue_length: %x",
  303. server->smbd_conn->count_reassembly_queue,
  304. server->smbd_conn->count_enqueue_reassembly_queue,
  305. server->smbd_conn->count_dequeue_reassembly_queue,
  306. server->smbd_conn->fragment_reassembly_remaining,
  307. server->smbd_conn->reassembly_data_length,
  308. server->smbd_conn->reassembly_queue_length);
  309. seq_printf(m, "\nCurrent Credits send_credits: %x "
  310. "receive_credits: %x receive_credit_target: %x",
  311. atomic_read(&server->smbd_conn->send_credits),
  312. atomic_read(&server->smbd_conn->receive_credits),
  313. server->smbd_conn->receive_credit_target);
  314. seq_printf(m, "\nPending send_pending: %x ",
  315. atomic_read(&server->smbd_conn->send_pending));
  316. seq_printf(m, "\nReceive buffers count_receive_queue: %x "
  317. "count_empty_packet_queue: %x",
  318. server->smbd_conn->count_receive_queue,
  319. server->smbd_conn->count_empty_packet_queue);
  320. seq_printf(m, "\nMR responder_resources: %x "
  321. "max_frmr_depth: %x mr_type: %x",
  322. server->smbd_conn->responder_resources,
  323. server->smbd_conn->max_frmr_depth,
  324. server->smbd_conn->mr_type);
  325. seq_printf(m, "\nMR mr_ready_count: %x mr_used_count: %x",
  326. atomic_read(&server->smbd_conn->mr_ready_count),
  327. atomic_read(&server->smbd_conn->mr_used_count));
  328. skip_rdma:
  329. #endif
  330. seq_printf(m, "\nNumber of credits: %d Dialect 0x%x",
  331. server->credits, server->dialect);
  332. if (server->compress_algorithm == SMB3_COMPRESS_LZNT1)
  333. seq_printf(m, " COMPRESS_LZNT1");
  334. else if (server->compress_algorithm == SMB3_COMPRESS_LZ77)
  335. seq_printf(m, " COMPRESS_LZ77");
  336. else if (server->compress_algorithm == SMB3_COMPRESS_LZ77_HUFF)
  337. seq_printf(m, " COMPRESS_LZ77_HUFF");
  338. if (server->sign)
  339. seq_printf(m, " signed");
  340. if (server->posix_ext_supported)
  341. seq_printf(m, " posix");
  342. if (server->nosharesock)
  343. seq_printf(m, " nosharesock");
  344. if (server->rdma)
  345. seq_printf(m, "\nRDMA ");
  346. seq_printf(m, "\nTCP status: %d Instance: %d"
  347. "\nLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d",
  348. server->tcpStatus,
  349. server->reconnect_instance,
  350. server->srv_count,
  351. server->sec_mode, in_flight(server));
  352. seq_printf(m, "\nIn Send: %d In MaxReq Wait: %d",
  353. atomic_read(&server->in_send),
  354. atomic_read(&server->num_waiters));
  355. seq_printf(m, "\n\n\tSessions: ");
  356. i = 0;
  357. list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
  358. spin_lock(&ses->ses_lock);
  359. if (ses->ses_status == SES_EXITING) {
  360. spin_unlock(&ses->ses_lock);
  361. continue;
  362. }
  363. i++;
  364. if ((ses->serverDomain == NULL) ||
  365. (ses->serverOS == NULL) ||
  366. (ses->serverNOS == NULL)) {
  367. seq_printf(m, "\n\t%d) Address: %s Uses: %d Capability: 0x%x\tSession Status: %d ",
  368. i, ses->ip_addr, ses->ses_count,
  369. ses->capabilities, ses->ses_status);
  370. if (ses->session_flags & SMB2_SESSION_FLAG_IS_GUEST)
  371. seq_printf(m, "Guest ");
  372. else if (ses->session_flags & SMB2_SESSION_FLAG_IS_NULL)
  373. seq_printf(m, "Anonymous ");
  374. } else {
  375. seq_printf(m,
  376. "\n\t%d) Name: %s Domain: %s Uses: %d OS: %s "
  377. "\n\tNOS: %s\tCapability: 0x%x"
  378. "\n\tSMB session status: %d ",
  379. i, ses->ip_addr, ses->serverDomain,
  380. ses->ses_count, ses->serverOS, ses->serverNOS,
  381. ses->capabilities, ses->ses_status);
  382. }
  383. spin_unlock(&ses->ses_lock);
  384. seq_printf(m, "\n\tSecurity type: %s ",
  385. get_security_type_str(server->ops->select_sectype(server, ses->sectype)));
  386. /* dump session id helpful for use with network trace */
  387. seq_printf(m, " SessionId: 0x%llx", ses->Suid);
  388. if (ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA)
  389. seq_puts(m, " encrypted");
  390. if (ses->sign)
  391. seq_puts(m, " signed");
  392. seq_printf(m, "\n\tUser: %d Cred User: %d",
  393. from_kuid(&init_user_ns, ses->linux_uid),
  394. from_kuid(&init_user_ns, ses->cred_uid));
  395. spin_lock(&ses->chan_lock);
  396. if (CIFS_CHAN_NEEDS_RECONNECT(ses, 0))
  397. seq_puts(m, "\tPrimary channel: DISCONNECTED ");
  398. if (CIFS_CHAN_IN_RECONNECT(ses, 0))
  399. seq_puts(m, "\t[RECONNECTING] ");
  400. if (ses->chan_count > 1) {
  401. seq_printf(m, "\n\n\tExtra Channels: %zu ",
  402. ses->chan_count-1);
  403. for (j = 1; j < ses->chan_count; j++) {
  404. cifs_dump_channel(m, j, &ses->chans[j]);
  405. if (CIFS_CHAN_NEEDS_RECONNECT(ses, j))
  406. seq_puts(m, "\tDISCONNECTED ");
  407. if (CIFS_CHAN_IN_RECONNECT(ses, j))
  408. seq_puts(m, "\t[RECONNECTING] ");
  409. }
  410. }
  411. spin_unlock(&ses->chan_lock);
  412. seq_puts(m, "\n\n\tShares: ");
  413. j = 0;
  414. seq_printf(m, "\n\t%d) IPC: ", j);
  415. if (ses->tcon_ipc)
  416. cifs_debug_tcon(m, ses->tcon_ipc);
  417. else
  418. seq_puts(m, "none\n");
  419. list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
  420. ++j;
  421. seq_printf(m, "\n\t%d) ", j);
  422. cifs_debug_tcon(m, tcon);
  423. }
  424. spin_lock(&ses->iface_lock);
  425. if (ses->iface_count)
  426. seq_printf(m, "\n\n\tServer interfaces: %zu"
  427. "\tLast updated: %lu seconds ago",
  428. ses->iface_count,
  429. (jiffies - ses->iface_last_update) / HZ);
  430. last_iface = list_last_entry(&ses->iface_list,
  431. struct cifs_server_iface,
  432. iface_head);
  433. iface_min_speed = last_iface->speed;
  434. j = 0;
  435. list_for_each_entry(iface, &ses->iface_list,
  436. iface_head) {
  437. seq_printf(m, "\n\t%d)", ++j);
  438. cifs_dump_iface(m, iface);
  439. iface_weight = iface->speed / iface_min_speed;
  440. seq_printf(m, "\t\tWeight (cur,total): (%zu,%zu)"
  441. "\n\t\tAllocated channels: %u\n",
  442. iface->weight_fulfilled,
  443. iface_weight,
  444. iface->num_channels);
  445. if (is_ses_using_iface(ses, iface))
  446. seq_puts(m, "\t\t[CONNECTED]\n");
  447. }
  448. spin_unlock(&ses->iface_lock);
  449. seq_puts(m, "\n\n\tMIDs: ");
  450. spin_lock(&ses->chan_lock);
  451. for (j = 0; j < ses->chan_count; j++) {
  452. chan_server = ses->chans[j].server;
  453. if (!chan_server)
  454. continue;
  455. if (list_empty(&chan_server->pending_mid_q))
  456. continue;
  457. seq_printf(m, "\n\tServer ConnectionId: 0x%llx",
  458. chan_server->conn_id);
  459. spin_lock(&chan_server->mid_lock);
  460. list_for_each_entry(mid_entry, &chan_server->pending_mid_q, qhead) {
  461. seq_printf(m, "\n\t\tState: %d com: %d pid: %d cbdata: %p mid %llu",
  462. mid_entry->mid_state,
  463. le16_to_cpu(mid_entry->command),
  464. mid_entry->pid,
  465. mid_entry->callback_data,
  466. mid_entry->mid);
  467. }
  468. spin_unlock(&chan_server->mid_lock);
  469. }
  470. spin_unlock(&ses->chan_lock);
  471. seq_puts(m, "\n--\n");
  472. }
  473. if (i == 0)
  474. seq_printf(m, "\n\t\t[NONE]");
  475. }
  476. if (c == 0)
  477. seq_printf(m, "\n\t[NONE]");
  478. spin_unlock(&cifs_tcp_ses_lock);
  479. seq_putc(m, '\n');
  480. cifs_swn_dump(m);
  481. /* BB add code to dump additional info such as TCP session info now */
  482. return 0;
  483. }
  484. static ssize_t cifs_stats_proc_write(struct file *file,
  485. const char __user *buffer, size_t count, loff_t *ppos)
  486. {
  487. bool bv;
  488. int rc;
  489. struct TCP_Server_Info *server;
  490. struct cifs_ses *ses;
  491. struct cifs_tcon *tcon;
  492. rc = kstrtobool_from_user(buffer, count, &bv);
  493. if (rc == 0) {
  494. #ifdef CONFIG_CIFS_STATS2
  495. int i;
  496. atomic_set(&total_buf_alloc_count, 0);
  497. atomic_set(&total_small_buf_alloc_count, 0);
  498. #endif /* CONFIG_CIFS_STATS2 */
  499. atomic_set(&tcpSesReconnectCount, 0);
  500. atomic_set(&tconInfoReconnectCount, 0);
  501. spin_lock(&GlobalMid_Lock);
  502. GlobalMaxActiveXid = 0;
  503. GlobalCurrentXid = 0;
  504. spin_unlock(&GlobalMid_Lock);
  505. spin_lock(&cifs_tcp_ses_lock);
  506. list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
  507. server->max_in_flight = 0;
  508. #ifdef CONFIG_CIFS_STATS2
  509. for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
  510. atomic_set(&server->num_cmds[i], 0);
  511. atomic_set(&server->smb2slowcmd[i], 0);
  512. server->time_per_cmd[i] = 0;
  513. server->slowest_cmd[i] = 0;
  514. server->fastest_cmd[0] = 0;
  515. }
  516. #endif /* CONFIG_CIFS_STATS2 */
  517. list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
  518. list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
  519. atomic_set(&tcon->num_smbs_sent, 0);
  520. spin_lock(&tcon->stat_lock);
  521. tcon->bytes_read = 0;
  522. tcon->bytes_written = 0;
  523. spin_unlock(&tcon->stat_lock);
  524. if (server->ops->clear_stats)
  525. server->ops->clear_stats(tcon);
  526. }
  527. }
  528. }
  529. spin_unlock(&cifs_tcp_ses_lock);
  530. } else {
  531. return rc;
  532. }
  533. return count;
  534. }
  535. static int cifs_stats_proc_show(struct seq_file *m, void *v)
  536. {
  537. int i;
  538. #ifdef CONFIG_CIFS_STATS2
  539. int j;
  540. #endif /* STATS2 */
  541. struct TCP_Server_Info *server;
  542. struct cifs_ses *ses;
  543. struct cifs_tcon *tcon;
  544. seq_printf(m, "Resources in use\nCIFS Session: %d\n",
  545. sesInfoAllocCount.counter);
  546. seq_printf(m, "Share (unique mount targets): %d\n",
  547. tconInfoAllocCount.counter);
  548. seq_printf(m, "SMB Request/Response Buffer: %d Pool size: %d\n",
  549. buf_alloc_count.counter,
  550. cifs_min_rcv + tcpSesAllocCount.counter);
  551. seq_printf(m, "SMB Small Req/Resp Buffer: %d Pool size: %d\n",
  552. small_buf_alloc_count.counter, cifs_min_small);
  553. #ifdef CONFIG_CIFS_STATS2
  554. seq_printf(m, "Total Large %d Small %d Allocations\n",
  555. atomic_read(&total_buf_alloc_count),
  556. atomic_read(&total_small_buf_alloc_count));
  557. #endif /* CONFIG_CIFS_STATS2 */
  558. seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&mid_count));
  559. seq_printf(m,
  560. "\n%d session %d share reconnects\n",
  561. tcpSesReconnectCount.counter, tconInfoReconnectCount.counter);
  562. seq_printf(m,
  563. "Total vfs operations: %d maximum at one time: %d\n",
  564. GlobalCurrentXid, GlobalMaxActiveXid);
  565. i = 0;
  566. spin_lock(&cifs_tcp_ses_lock);
  567. list_for_each_entry(server, &cifs_tcp_ses_list, tcp_ses_list) {
  568. seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
  569. #ifdef CONFIG_CIFS_STATS2
  570. seq_puts(m, "\nTotal time spent processing by command. Time ");
  571. seq_printf(m, "units are jiffies (%d per second)\n", HZ);
  572. seq_puts(m, " SMB3 CMD\tNumber\tTotal Time\tFastest\tSlowest\n");
  573. seq_puts(m, " --------\t------\t----------\t-------\t-------\n");
  574. for (j = 0; j < NUMBER_OF_SMB2_COMMANDS; j++)
  575. seq_printf(m, " %d\t\t%d\t%llu\t\t%u\t%u\n", j,
  576. atomic_read(&server->num_cmds[j]),
  577. server->time_per_cmd[j],
  578. server->fastest_cmd[j],
  579. server->slowest_cmd[j]);
  580. for (j = 0; j < NUMBER_OF_SMB2_COMMANDS; j++)
  581. if (atomic_read(&server->smb2slowcmd[j])) {
  582. spin_lock(&server->srv_lock);
  583. seq_printf(m, " %d slow responses from %s for command %d\n",
  584. atomic_read(&server->smb2slowcmd[j]),
  585. server->hostname, j);
  586. spin_unlock(&server->srv_lock);
  587. }
  588. #endif /* STATS2 */
  589. list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
  590. list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
  591. i++;
  592. seq_printf(m, "\n%d) %s", i, tcon->tree_name);
  593. if (tcon->need_reconnect)
  594. seq_puts(m, "\tDISCONNECTED ");
  595. seq_printf(m, "\nSMBs: %d",
  596. atomic_read(&tcon->num_smbs_sent));
  597. if (server->ops->print_stats)
  598. server->ops->print_stats(m, tcon);
  599. }
  600. }
  601. }
  602. spin_unlock(&cifs_tcp_ses_lock);
  603. seq_putc(m, '\n');
  604. return 0;
  605. }
  606. static int cifs_stats_proc_open(struct inode *inode, struct file *file)
  607. {
  608. return single_open(file, cifs_stats_proc_show, NULL);
  609. }
  610. static const struct proc_ops cifs_stats_proc_ops = {
  611. .proc_open = cifs_stats_proc_open,
  612. .proc_read = seq_read,
  613. .proc_lseek = seq_lseek,
  614. .proc_release = single_release,
  615. .proc_write = cifs_stats_proc_write,
  616. };
  617. #ifdef CONFIG_CIFS_SMB_DIRECT
  618. #define PROC_FILE_DEFINE(name) \
  619. static ssize_t name##_write(struct file *file, const char __user *buffer, \
  620. size_t count, loff_t *ppos) \
  621. { \
  622. int rc; \
  623. rc = kstrtoint_from_user(buffer, count, 10, & name); \
  624. if (rc) \
  625. return rc; \
  626. return count; \
  627. } \
  628. static int name##_proc_show(struct seq_file *m, void *v) \
  629. { \
  630. seq_printf(m, "%d\n", name ); \
  631. return 0; \
  632. } \
  633. static int name##_open(struct inode *inode, struct file *file) \
  634. { \
  635. return single_open(file, name##_proc_show, NULL); \
  636. } \
  637. \
  638. static const struct proc_ops cifs_##name##_proc_fops = { \
  639. .proc_open = name##_open, \
  640. .proc_read = seq_read, \
  641. .proc_lseek = seq_lseek, \
  642. .proc_release = single_release, \
  643. .proc_write = name##_write, \
  644. }
  645. PROC_FILE_DEFINE(rdma_readwrite_threshold);
  646. PROC_FILE_DEFINE(smbd_max_frmr_depth);
  647. PROC_FILE_DEFINE(smbd_keep_alive_interval);
  648. PROC_FILE_DEFINE(smbd_max_receive_size);
  649. PROC_FILE_DEFINE(smbd_max_fragmented_recv_size);
  650. PROC_FILE_DEFINE(smbd_max_send_size);
  651. PROC_FILE_DEFINE(smbd_send_credit_target);
  652. PROC_FILE_DEFINE(smbd_receive_credit_max);
  653. #endif
  654. static struct proc_dir_entry *proc_fs_cifs;
  655. static const struct proc_ops cifsFYI_proc_ops;
  656. static const struct proc_ops cifs_lookup_cache_proc_ops;
  657. static const struct proc_ops traceSMB_proc_ops;
  658. static const struct proc_ops cifs_security_flags_proc_ops;
  659. static const struct proc_ops cifs_linux_ext_proc_ops;
  660. static const struct proc_ops cifs_mount_params_proc_ops;
  661. void
  662. cifs_proc_init(void)
  663. {
  664. proc_fs_cifs = proc_mkdir("fs/cifs", NULL);
  665. if (proc_fs_cifs == NULL)
  666. return;
  667. proc_create_single("DebugData", 0, proc_fs_cifs,
  668. cifs_debug_data_proc_show);
  669. proc_create_single("open_files", 0400, proc_fs_cifs,
  670. cifs_debug_files_proc_show);
  671. proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
  672. proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
  673. proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
  674. proc_create("LinuxExtensionsEnabled", 0644, proc_fs_cifs,
  675. &cifs_linux_ext_proc_ops);
  676. proc_create("SecurityFlags", 0644, proc_fs_cifs,
  677. &cifs_security_flags_proc_ops);
  678. proc_create("LookupCacheEnabled", 0644, proc_fs_cifs,
  679. &cifs_lookup_cache_proc_ops);
  680. proc_create("mount_params", 0444, proc_fs_cifs, &cifs_mount_params_proc_ops);
  681. #ifdef CONFIG_CIFS_DFS_UPCALL
  682. proc_create("dfscache", 0644, proc_fs_cifs, &dfscache_proc_ops);
  683. #endif
  684. #ifdef CONFIG_CIFS_SMB_DIRECT
  685. proc_create("rdma_readwrite_threshold", 0644, proc_fs_cifs,
  686. &cifs_rdma_readwrite_threshold_proc_fops);
  687. proc_create("smbd_max_frmr_depth", 0644, proc_fs_cifs,
  688. &cifs_smbd_max_frmr_depth_proc_fops);
  689. proc_create("smbd_keep_alive_interval", 0644, proc_fs_cifs,
  690. &cifs_smbd_keep_alive_interval_proc_fops);
  691. proc_create("smbd_max_receive_size", 0644, proc_fs_cifs,
  692. &cifs_smbd_max_receive_size_proc_fops);
  693. proc_create("smbd_max_fragmented_recv_size", 0644, proc_fs_cifs,
  694. &cifs_smbd_max_fragmented_recv_size_proc_fops);
  695. proc_create("smbd_max_send_size", 0644, proc_fs_cifs,
  696. &cifs_smbd_max_send_size_proc_fops);
  697. proc_create("smbd_send_credit_target", 0644, proc_fs_cifs,
  698. &cifs_smbd_send_credit_target_proc_fops);
  699. proc_create("smbd_receive_credit_max", 0644, proc_fs_cifs,
  700. &cifs_smbd_receive_credit_max_proc_fops);
  701. #endif
  702. }
  703. void
  704. cifs_proc_clean(void)
  705. {
  706. if (proc_fs_cifs == NULL)
  707. return;
  708. remove_proc_entry("DebugData", proc_fs_cifs);
  709. remove_proc_entry("open_files", proc_fs_cifs);
  710. remove_proc_entry("cifsFYI", proc_fs_cifs);
  711. remove_proc_entry("traceSMB", proc_fs_cifs);
  712. remove_proc_entry("Stats", proc_fs_cifs);
  713. remove_proc_entry("SecurityFlags", proc_fs_cifs);
  714. remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs);
  715. remove_proc_entry("LookupCacheEnabled", proc_fs_cifs);
  716. remove_proc_entry("mount_params", proc_fs_cifs);
  717. #ifdef CONFIG_CIFS_DFS_UPCALL
  718. remove_proc_entry("dfscache", proc_fs_cifs);
  719. #endif
  720. #ifdef CONFIG_CIFS_SMB_DIRECT
  721. remove_proc_entry("rdma_readwrite_threshold", proc_fs_cifs);
  722. remove_proc_entry("smbd_max_frmr_depth", proc_fs_cifs);
  723. remove_proc_entry("smbd_keep_alive_interval", proc_fs_cifs);
  724. remove_proc_entry("smbd_max_receive_size", proc_fs_cifs);
  725. remove_proc_entry("smbd_max_fragmented_recv_size", proc_fs_cifs);
  726. remove_proc_entry("smbd_max_send_size", proc_fs_cifs);
  727. remove_proc_entry("smbd_send_credit_target", proc_fs_cifs);
  728. remove_proc_entry("smbd_receive_credit_max", proc_fs_cifs);
  729. #endif
  730. remove_proc_entry("fs/cifs", NULL);
  731. }
  732. static int cifsFYI_proc_show(struct seq_file *m, void *v)
  733. {
  734. seq_printf(m, "%d\n", cifsFYI);
  735. return 0;
  736. }
  737. static int cifsFYI_proc_open(struct inode *inode, struct file *file)
  738. {
  739. return single_open(file, cifsFYI_proc_show, NULL);
  740. }
  741. static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
  742. size_t count, loff_t *ppos)
  743. {
  744. char c[2] = { '\0' };
  745. bool bv;
  746. int rc;
  747. rc = get_user(c[0], buffer);
  748. if (rc)
  749. return rc;
  750. if (strtobool(c, &bv) == 0)
  751. cifsFYI = bv;
  752. else if ((c[0] > '1') && (c[0] <= '9'))
  753. cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */
  754. else
  755. return -EINVAL;
  756. return count;
  757. }
  758. static const struct proc_ops cifsFYI_proc_ops = {
  759. .proc_open = cifsFYI_proc_open,
  760. .proc_read = seq_read,
  761. .proc_lseek = seq_lseek,
  762. .proc_release = single_release,
  763. .proc_write = cifsFYI_proc_write,
  764. };
  765. static int cifs_linux_ext_proc_show(struct seq_file *m, void *v)
  766. {
  767. seq_printf(m, "%d\n", linuxExtEnabled);
  768. return 0;
  769. }
  770. static int cifs_linux_ext_proc_open(struct inode *inode, struct file *file)
  771. {
  772. return single_open(file, cifs_linux_ext_proc_show, NULL);
  773. }
  774. static ssize_t cifs_linux_ext_proc_write(struct file *file,
  775. const char __user *buffer, size_t count, loff_t *ppos)
  776. {
  777. int rc;
  778. rc = kstrtobool_from_user(buffer, count, &linuxExtEnabled);
  779. if (rc)
  780. return rc;
  781. return count;
  782. }
  783. static const struct proc_ops cifs_linux_ext_proc_ops = {
  784. .proc_open = cifs_linux_ext_proc_open,
  785. .proc_read = seq_read,
  786. .proc_lseek = seq_lseek,
  787. .proc_release = single_release,
  788. .proc_write = cifs_linux_ext_proc_write,
  789. };
  790. static int cifs_lookup_cache_proc_show(struct seq_file *m, void *v)
  791. {
  792. seq_printf(m, "%d\n", lookupCacheEnabled);
  793. return 0;
  794. }
  795. static int cifs_lookup_cache_proc_open(struct inode *inode, struct file *file)
  796. {
  797. return single_open(file, cifs_lookup_cache_proc_show, NULL);
  798. }
  799. static ssize_t cifs_lookup_cache_proc_write(struct file *file,
  800. const char __user *buffer, size_t count, loff_t *ppos)
  801. {
  802. int rc;
  803. rc = kstrtobool_from_user(buffer, count, &lookupCacheEnabled);
  804. if (rc)
  805. return rc;
  806. return count;
  807. }
  808. static const struct proc_ops cifs_lookup_cache_proc_ops = {
  809. .proc_open = cifs_lookup_cache_proc_open,
  810. .proc_read = seq_read,
  811. .proc_lseek = seq_lseek,
  812. .proc_release = single_release,
  813. .proc_write = cifs_lookup_cache_proc_write,
  814. };
  815. static int traceSMB_proc_show(struct seq_file *m, void *v)
  816. {
  817. seq_printf(m, "%d\n", traceSMB);
  818. return 0;
  819. }
  820. static int traceSMB_proc_open(struct inode *inode, struct file *file)
  821. {
  822. return single_open(file, traceSMB_proc_show, NULL);
  823. }
  824. static ssize_t traceSMB_proc_write(struct file *file, const char __user *buffer,
  825. size_t count, loff_t *ppos)
  826. {
  827. int rc;
  828. rc = kstrtobool_from_user(buffer, count, &traceSMB);
  829. if (rc)
  830. return rc;
  831. return count;
  832. }
  833. static const struct proc_ops traceSMB_proc_ops = {
  834. .proc_open = traceSMB_proc_open,
  835. .proc_read = seq_read,
  836. .proc_lseek = seq_lseek,
  837. .proc_release = single_release,
  838. .proc_write = traceSMB_proc_write,
  839. };
  840. static int cifs_security_flags_proc_show(struct seq_file *m, void *v)
  841. {
  842. seq_printf(m, "0x%x\n", global_secflags);
  843. return 0;
  844. }
  845. static int cifs_security_flags_proc_open(struct inode *inode, struct file *file)
  846. {
  847. return single_open(file, cifs_security_flags_proc_show, NULL);
  848. }
  849. /*
  850. * Ensure that if someone sets a MUST flag, that we disable all other MAY
  851. * flags except for the ones corresponding to the given MUST flag. If there are
  852. * multiple MUST flags, then try to prefer more secure ones.
  853. */
  854. static void
  855. cifs_security_flags_handle_must_flags(unsigned int *flags)
  856. {
  857. unsigned int signflags = *flags & CIFSSEC_MUST_SIGN;
  858. if ((*flags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
  859. *flags = CIFSSEC_MUST_KRB5;
  860. else if ((*flags & CIFSSEC_MUST_NTLMSSP) == CIFSSEC_MUST_NTLMSSP)
  861. *flags = CIFSSEC_MUST_NTLMSSP;
  862. else if ((*flags & CIFSSEC_MUST_NTLMV2) == CIFSSEC_MUST_NTLMV2)
  863. *flags = CIFSSEC_MUST_NTLMV2;
  864. *flags |= signflags;
  865. }
  866. static ssize_t cifs_security_flags_proc_write(struct file *file,
  867. const char __user *buffer, size_t count, loff_t *ppos)
  868. {
  869. int rc;
  870. unsigned int flags;
  871. char flags_string[12];
  872. bool bv;
  873. if ((count < 1) || (count > 11))
  874. return -EINVAL;
  875. memset(flags_string, 0, 12);
  876. if (copy_from_user(flags_string, buffer, count))
  877. return -EFAULT;
  878. if (count < 3) {
  879. /* single char or single char followed by null */
  880. if (strtobool(flags_string, &bv) == 0) {
  881. global_secflags = bv ? CIFSSEC_MAX : CIFSSEC_DEF;
  882. return count;
  883. } else if (!isdigit(flags_string[0])) {
  884. cifs_dbg(VFS, "Invalid SecurityFlags: %s\n",
  885. flags_string);
  886. return -EINVAL;
  887. }
  888. }
  889. /* else we have a number */
  890. rc = kstrtouint(flags_string, 0, &flags);
  891. if (rc) {
  892. cifs_dbg(VFS, "Invalid SecurityFlags: %s\n",
  893. flags_string);
  894. return rc;
  895. }
  896. cifs_dbg(FYI, "sec flags 0x%x\n", flags);
  897. if (flags == 0) {
  898. cifs_dbg(VFS, "Invalid SecurityFlags: %s\n", flags_string);
  899. return -EINVAL;
  900. }
  901. if (flags & ~CIFSSEC_MASK) {
  902. cifs_dbg(VFS, "Unsupported security flags: 0x%x\n",
  903. flags & ~CIFSSEC_MASK);
  904. return -EINVAL;
  905. }
  906. cifs_security_flags_handle_must_flags(&flags);
  907. /* flags look ok - update the global security flags for cifs module */
  908. global_secflags = flags;
  909. if (global_secflags & CIFSSEC_MUST_SIGN) {
  910. /* requiring signing implies signing is allowed */
  911. global_secflags |= CIFSSEC_MAY_SIGN;
  912. cifs_dbg(FYI, "packet signing now required\n");
  913. } else if ((global_secflags & CIFSSEC_MAY_SIGN) == 0) {
  914. cifs_dbg(FYI, "packet signing disabled\n");
  915. }
  916. /* BB should we turn on MAY flags for other MUST options? */
  917. return count;
  918. }
  919. static const struct proc_ops cifs_security_flags_proc_ops = {
  920. .proc_open = cifs_security_flags_proc_open,
  921. .proc_read = seq_read,
  922. .proc_lseek = seq_lseek,
  923. .proc_release = single_release,
  924. .proc_write = cifs_security_flags_proc_write,
  925. };
  926. /* To make it easier to debug, can help to show mount params */
  927. static int cifs_mount_params_proc_show(struct seq_file *m, void *v)
  928. {
  929. const struct fs_parameter_spec *p;
  930. const char *type;
  931. for (p = smb3_fs_parameters; p->name; p++) {
  932. /* cannot use switch with pointers... */
  933. if (!p->type) {
  934. if (p->flags == fs_param_neg_with_no)
  935. type = "noflag";
  936. else
  937. type = "flag";
  938. } else if (p->type == fs_param_is_bool)
  939. type = "bool";
  940. else if (p->type == fs_param_is_u32)
  941. type = "u32";
  942. else if (p->type == fs_param_is_u64)
  943. type = "u64";
  944. else if (p->type == fs_param_is_string)
  945. type = "string";
  946. else
  947. type = "unknown";
  948. seq_printf(m, "%s:%s\n", p->name, type);
  949. }
  950. return 0;
  951. }
  952. static int cifs_mount_params_proc_open(struct inode *inode, struct file *file)
  953. {
  954. return single_open(file, cifs_mount_params_proc_show, NULL);
  955. }
  956. static const struct proc_ops cifs_mount_params_proc_ops = {
  957. .proc_open = cifs_mount_params_proc_open,
  958. .proc_read = seq_read,
  959. .proc_lseek = seq_lseek,
  960. .proc_release = single_release,
  961. /* No need for write for now */
  962. /* .proc_write = cifs_mount_params_proc_write, */
  963. };
  964. #else
  965. inline void cifs_proc_init(void)
  966. {
  967. }
  968. inline void cifs_proc_clean(void)
  969. {
  970. }
  971. #endif /* PROC_FS */