orangefs-sysfs.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223
  1. /*
  2. * Documentation/ABI/stable/orangefs-sysfs:
  3. *
  4. * What: /sys/fs/orangefs/perf_counter_reset
  5. * Date: June 2015
  6. * Contact: Mike Marshall <hubcap@omnibond.com>
  7. * Description:
  8. * echo a 0 or a 1 into perf_counter_reset to
  9. * reset all the counters in
  10. * /sys/fs/orangefs/perf_counters
  11. * except ones with PINT_PERF_PRESERVE set.
  12. *
  13. *
  14. * What: /sys/fs/orangefs/perf_counters/...
  15. * Date: Jun 2015
  16. * Contact: Mike Marshall <hubcap@omnibond.com>
  17. * Description:
  18. * Counters and settings for various caches.
  19. * Read only.
  20. *
  21. *
  22. * What: /sys/fs/orangefs/perf_time_interval_secs
  23. * Date: Jun 2015
  24. * Contact: Mike Marshall <hubcap@omnibond.com>
  25. * Description:
  26. * Length of perf counter intervals in
  27. * seconds.
  28. *
  29. *
  30. * What: /sys/fs/orangefs/perf_history_size
  31. * Date: Jun 2015
  32. * Contact: Mike Marshall <hubcap@omnibond.com>
  33. * Description:
  34. * The perf_counters cache statistics have N, or
  35. * perf_history_size, samples. The default is
  36. * one.
  37. *
  38. * Every perf_time_interval_secs the (first)
  39. * samples are reset.
  40. *
  41. * If N is greater than one, the "current" set
  42. * of samples is reset, and the samples from the
  43. * other N-1 intervals remain available.
  44. *
  45. *
  46. * What: /sys/fs/orangefs/op_timeout_secs
  47. * Date: Jun 2015
  48. * Contact: Mike Marshall <hubcap@omnibond.com>
  49. * Description:
  50. * Service operation timeout in seconds.
  51. *
  52. *
  53. * What: /sys/fs/orangefs/slot_timeout_secs
  54. * Date: Jun 2015
  55. * Contact: Mike Marshall <hubcap@omnibond.com>
  56. * Description:
  57. * "Slot" timeout in seconds. A "slot"
  58. * is an indexed buffer in the shared
  59. * memory segment used for communication
  60. * between the kernel module and userspace.
  61. * Slots are requested and waited for,
  62. * the wait times out after slot_timeout_secs.
  63. *
  64. * What: /sys/fs/orangefs/dcache_timeout_msecs
  65. * Date: Jul 2016
  66. * Contact: Martin Brandenburg <martin@omnibond.com>
  67. * Description:
  68. * Time lookup is valid in milliseconds.
  69. *
  70. * What: /sys/fs/orangefs/getattr_timeout_msecs
  71. * Date: Jul 2016
  72. * Contact: Martin Brandenburg <martin@omnibond.com>
  73. * Description:
  74. * Time getattr is valid in milliseconds.
  75. *
  76. * What: /sys/fs/orangefs/readahead_count
  77. * Date: Aug 2016
  78. * Contact: Martin Brandenburg <martin@omnibond.com>
  79. * Description:
  80. * Readahead cache buffer count.
  81. *
  82. * What: /sys/fs/orangefs/readahead_size
  83. * Date: Aug 2016
  84. * Contact: Martin Brandenburg <martin@omnibond.com>
  85. * Description:
  86. * Readahead cache buffer size.
  87. *
  88. * What: /sys/fs/orangefs/readahead_count_size
  89. * Date: Aug 2016
  90. * Contact: Martin Brandenburg <martin@omnibond.com>
  91. * Description:
  92. * Readahead cache buffer count and size.
  93. *
  94. * What: /sys/fs/orangefs/acache/...
  95. * Date: Jun 2015
  96. * Contact: Martin Brandenburg <martin@omnibond.com>
  97. * Description:
  98. * Attribute cache configurable settings.
  99. *
  100. *
  101. * What: /sys/fs/orangefs/ncache/...
  102. * Date: Jun 2015
  103. * Contact: Mike Marshall <hubcap@omnibond.com>
  104. * Description:
  105. * Name cache configurable settings.
  106. *
  107. *
  108. * What: /sys/fs/orangefs/capcache/...
  109. * Date: Jun 2015
  110. * Contact: Mike Marshall <hubcap@omnibond.com>
  111. * Description:
  112. * Capability cache configurable settings.
  113. *
  114. *
  115. * What: /sys/fs/orangefs/ccache/...
  116. * Date: Jun 2015
  117. * Contact: Mike Marshall <hubcap@omnibond.com>
  118. * Description:
  119. * Credential cache configurable settings.
  120. *
  121. */
  122. #include <linux/fs.h>
  123. #include <linux/kobject.h>
  124. #include <linux/string.h>
  125. #include <linux/sysfs.h>
  126. #include <linux/module.h>
  127. #include <linux/init.h>
  128. #include "protocol.h"
  129. #include "orangefs-kernel.h"
  130. #include "orangefs-sysfs.h"
  131. #define ORANGEFS_KOBJ_ID "orangefs"
  132. #define ACACHE_KOBJ_ID "acache"
  133. #define CAPCACHE_KOBJ_ID "capcache"
  134. #define CCACHE_KOBJ_ID "ccache"
  135. #define NCACHE_KOBJ_ID "ncache"
  136. #define PC_KOBJ_ID "pc"
  137. #define STATS_KOBJ_ID "stats"
  138. /*
  139. * Every item calls orangefs_attr_show and orangefs_attr_store through
  140. * orangefs_sysfs_ops. They look at the orangefs_attributes further below to
  141. * call one of sysfs_int_show, sysfs_int_store, sysfs_service_op_show, or
  142. * sysfs_service_op_store.
  143. */
  144. struct orangefs_attribute {
  145. struct attribute attr;
  146. ssize_t (*show)(struct kobject *kobj,
  147. struct orangefs_attribute *attr,
  148. char *buf);
  149. ssize_t (*store)(struct kobject *kobj,
  150. struct orangefs_attribute *attr,
  151. const char *buf,
  152. size_t count);
  153. };
  154. static ssize_t orangefs_attr_show(struct kobject *kobj,
  155. struct attribute *attr,
  156. char *buf)
  157. {
  158. struct orangefs_attribute *attribute;
  159. attribute = container_of(attr, struct orangefs_attribute, attr);
  160. if (!attribute->show)
  161. return -EIO;
  162. return attribute->show(kobj, attribute, buf);
  163. }
  164. static ssize_t orangefs_attr_store(struct kobject *kobj,
  165. struct attribute *attr,
  166. const char *buf,
  167. size_t len)
  168. {
  169. struct orangefs_attribute *attribute;
  170. if (!strcmp(kobj->name, PC_KOBJ_ID) ||
  171. !strcmp(kobj->name, STATS_KOBJ_ID))
  172. return -EPERM;
  173. attribute = container_of(attr, struct orangefs_attribute, attr);
  174. if (!attribute->store)
  175. return -EIO;
  176. return attribute->store(kobj, attribute, buf, len);
  177. }
  178. static const struct sysfs_ops orangefs_sysfs_ops = {
  179. .show = orangefs_attr_show,
  180. .store = orangefs_attr_store,
  181. };
  182. static ssize_t sysfs_int_show(struct kobject *kobj,
  183. struct orangefs_attribute *attr, char *buf)
  184. {
  185. int rc = -EIO;
  186. gossip_debug(GOSSIP_SYSFS_DEBUG, "sysfs_int_show: id:%s:\n",
  187. kobj->name);
  188. if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
  189. if (!strcmp(attr->attr.name, "op_timeout_secs")) {
  190. rc = scnprintf(buf,
  191. PAGE_SIZE,
  192. "%d\n",
  193. op_timeout_secs);
  194. goto out;
  195. } else if (!strcmp(attr->attr.name,
  196. "slot_timeout_secs")) {
  197. rc = scnprintf(buf,
  198. PAGE_SIZE,
  199. "%d\n",
  200. slot_timeout_secs);
  201. goto out;
  202. } else if (!strcmp(attr->attr.name,
  203. "dcache_timeout_msecs")) {
  204. rc = scnprintf(buf,
  205. PAGE_SIZE,
  206. "%d\n",
  207. orangefs_dcache_timeout_msecs);
  208. goto out;
  209. } else if (!strcmp(attr->attr.name,
  210. "getattr_timeout_msecs")) {
  211. rc = scnprintf(buf,
  212. PAGE_SIZE,
  213. "%d\n",
  214. orangefs_getattr_timeout_msecs);
  215. goto out;
  216. } else {
  217. goto out;
  218. }
  219. } else if (!strcmp(kobj->name, STATS_KOBJ_ID)) {
  220. if (!strcmp(attr->attr.name, "reads")) {
  221. rc = scnprintf(buf,
  222. PAGE_SIZE,
  223. "%lu\n",
  224. orangefs_stats.reads);
  225. goto out;
  226. } else if (!strcmp(attr->attr.name, "writes")) {
  227. rc = scnprintf(buf,
  228. PAGE_SIZE,
  229. "%lu\n",
  230. orangefs_stats.writes);
  231. goto out;
  232. } else {
  233. goto out;
  234. }
  235. }
  236. out:
  237. return rc;
  238. }
  239. static ssize_t sysfs_int_store(struct kobject *kobj,
  240. struct orangefs_attribute *attr, const char *buf, size_t count)
  241. {
  242. int rc = 0;
  243. gossip_debug(GOSSIP_SYSFS_DEBUG,
  244. "sysfs_int_store: start attr->attr.name:%s: buf:%s:\n",
  245. attr->attr.name, buf);
  246. if (!strcmp(attr->attr.name, "op_timeout_secs")) {
  247. rc = kstrtoint(buf, 0, &op_timeout_secs);
  248. goto out;
  249. } else if (!strcmp(attr->attr.name, "slot_timeout_secs")) {
  250. rc = kstrtoint(buf, 0, &slot_timeout_secs);
  251. goto out;
  252. } else if (!strcmp(attr->attr.name, "dcache_timeout_msecs")) {
  253. rc = kstrtoint(buf, 0, &orangefs_dcache_timeout_msecs);
  254. goto out;
  255. } else if (!strcmp(attr->attr.name, "getattr_timeout_msecs")) {
  256. rc = kstrtoint(buf, 0, &orangefs_getattr_timeout_msecs);
  257. goto out;
  258. } else {
  259. goto out;
  260. }
  261. out:
  262. if (rc)
  263. rc = -EINVAL;
  264. else
  265. rc = count;
  266. return rc;
  267. }
  268. /*
  269. * obtain attribute values from userspace with a service operation.
  270. */
  271. static ssize_t sysfs_service_op_show(struct kobject *kobj,
  272. struct orangefs_attribute *attr, char *buf)
  273. {
  274. struct orangefs_kernel_op_s *new_op = NULL;
  275. int rc = 0;
  276. char *ser_op_type = NULL;
  277. __u32 op_alloc_type;
  278. gossip_debug(GOSSIP_SYSFS_DEBUG,
  279. "sysfs_service_op_show: id:%s:\n",
  280. kobj->name);
  281. if (strcmp(kobj->name, PC_KOBJ_ID))
  282. op_alloc_type = ORANGEFS_VFS_OP_PARAM;
  283. else
  284. op_alloc_type = ORANGEFS_VFS_OP_PERF_COUNT;
  285. new_op = op_alloc(op_alloc_type);
  286. if (!new_op)
  287. return -ENOMEM;
  288. /* Can't do a service_operation if the client is not running... */
  289. rc = is_daemon_in_service();
  290. if (rc) {
  291. pr_info("%s: Client not running :%d:\n",
  292. __func__,
  293. is_daemon_in_service());
  294. goto out;
  295. }
  296. if (strcmp(kobj->name, PC_KOBJ_ID))
  297. new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_GET;
  298. if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
  299. /* Drop unsupported requests first. */
  300. if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
  301. (!strcmp(attr->attr.name, "readahead_count") ||
  302. !strcmp(attr->attr.name, "readahead_size") ||
  303. !strcmp(attr->attr.name, "readahead_count_size"))) {
  304. rc = -EINVAL;
  305. goto out;
  306. }
  307. if (!strcmp(attr->attr.name, "perf_history_size"))
  308. new_op->upcall.req.param.op =
  309. ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
  310. else if (!strcmp(attr->attr.name,
  311. "perf_time_interval_secs"))
  312. new_op->upcall.req.param.op =
  313. ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS;
  314. else if (!strcmp(attr->attr.name,
  315. "perf_counter_reset"))
  316. new_op->upcall.req.param.op =
  317. ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
  318. else if (!strcmp(attr->attr.name,
  319. "readahead_count"))
  320. new_op->upcall.req.param.op =
  321. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
  322. else if (!strcmp(attr->attr.name,
  323. "readahead_size"))
  324. new_op->upcall.req.param.op =
  325. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
  326. else if (!strcmp(attr->attr.name,
  327. "readahead_count_size"))
  328. new_op->upcall.req.param.op =
  329. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
  330. } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
  331. if (!strcmp(attr->attr.name, "timeout_msecs"))
  332. new_op->upcall.req.param.op =
  333. ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS;
  334. if (!strcmp(attr->attr.name, "hard_limit"))
  335. new_op->upcall.req.param.op =
  336. ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT;
  337. if (!strcmp(attr->attr.name, "soft_limit"))
  338. new_op->upcall.req.param.op =
  339. ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT;
  340. if (!strcmp(attr->attr.name, "reclaim_percentage"))
  341. new_op->upcall.req.param.op =
  342. ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE;
  343. } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) {
  344. if (!strcmp(attr->attr.name, "timeout_secs"))
  345. new_op->upcall.req.param.op =
  346. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS;
  347. if (!strcmp(attr->attr.name, "hard_limit"))
  348. new_op->upcall.req.param.op =
  349. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT;
  350. if (!strcmp(attr->attr.name, "soft_limit"))
  351. new_op->upcall.req.param.op =
  352. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT;
  353. if (!strcmp(attr->attr.name, "reclaim_percentage"))
  354. new_op->upcall.req.param.op =
  355. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE;
  356. } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) {
  357. if (!strcmp(attr->attr.name, "timeout_secs"))
  358. new_op->upcall.req.param.op =
  359. ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS;
  360. if (!strcmp(attr->attr.name, "hard_limit"))
  361. new_op->upcall.req.param.op =
  362. ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT;
  363. if (!strcmp(attr->attr.name, "soft_limit"))
  364. new_op->upcall.req.param.op =
  365. ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT;
  366. if (!strcmp(attr->attr.name, "reclaim_percentage"))
  367. new_op->upcall.req.param.op =
  368. ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE;
  369. } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) {
  370. if (!strcmp(attr->attr.name, "timeout_msecs"))
  371. new_op->upcall.req.param.op =
  372. ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS;
  373. if (!strcmp(attr->attr.name, "hard_limit"))
  374. new_op->upcall.req.param.op =
  375. ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT;
  376. if (!strcmp(attr->attr.name, "soft_limit"))
  377. new_op->upcall.req.param.op =
  378. ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT;
  379. if (!strcmp(attr->attr.name, "reclaim_percentage"))
  380. new_op->upcall.req.param.op =
  381. ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE;
  382. } else if (!strcmp(kobj->name, PC_KOBJ_ID)) {
  383. if (!strcmp(attr->attr.name, ACACHE_KOBJ_ID))
  384. new_op->upcall.req.perf_count.type =
  385. ORANGEFS_PERF_COUNT_REQUEST_ACACHE;
  386. if (!strcmp(attr->attr.name, CAPCACHE_KOBJ_ID))
  387. new_op->upcall.req.perf_count.type =
  388. ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE;
  389. if (!strcmp(attr->attr.name, NCACHE_KOBJ_ID))
  390. new_op->upcall.req.perf_count.type =
  391. ORANGEFS_PERF_COUNT_REQUEST_NCACHE;
  392. } else {
  393. gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n",
  394. kobj->name);
  395. rc = -EINVAL;
  396. goto out;
  397. }
  398. if (strcmp(kobj->name, PC_KOBJ_ID))
  399. ser_op_type = "orangefs_param";
  400. else
  401. ser_op_type = "orangefs_perf_count";
  402. /*
  403. * The service_operation will return an errno return code on
  404. * error, and zero on success.
  405. */
  406. rc = service_operation(new_op, ser_op_type, ORANGEFS_OP_INTERRUPTIBLE);
  407. out:
  408. if (!rc) {
  409. if (strcmp(kobj->name, PC_KOBJ_ID)) {
  410. if (new_op->upcall.req.param.op ==
  411. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
  412. rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
  413. (int)new_op->downcall.resp.param.u.
  414. value32[0],
  415. (int)new_op->downcall.resp.param.u.
  416. value32[1]);
  417. } else {
  418. rc = scnprintf(buf, PAGE_SIZE, "%d\n",
  419. (int)new_op->downcall.resp.param.u.value64);
  420. }
  421. } else {
  422. rc = scnprintf(
  423. buf,
  424. PAGE_SIZE,
  425. "%s",
  426. new_op->downcall.resp.perf_count.buffer);
  427. }
  428. }
  429. op_release(new_op);
  430. return rc;
  431. }
  432. /*
  433. * pass attribute values back to userspace with a service operation.
  434. *
  435. * We have to do a memory allocation, an sscanf and a service operation.
  436. * And we have to evaluate what the user entered, to make sure the
  437. * value is within the range supported by the attribute. So, there's
  438. * a lot of return code checking and mapping going on here.
  439. *
  440. * We want to return 1 if we think everything went OK, and
  441. * EINVAL if not.
  442. */
  443. static ssize_t sysfs_service_op_store(struct kobject *kobj,
  444. struct orangefs_attribute *attr, const char *buf, size_t count)
  445. {
  446. struct orangefs_kernel_op_s *new_op = NULL;
  447. int val = 0;
  448. int rc = 0;
  449. gossip_debug(GOSSIP_SYSFS_DEBUG,
  450. "sysfs_service_op_store: id:%s:\n",
  451. kobj->name);
  452. new_op = op_alloc(ORANGEFS_VFS_OP_PARAM);
  453. if (!new_op)
  454. return -EINVAL; /* sic */
  455. /* Can't do a service_operation if the client is not running... */
  456. rc = is_daemon_in_service();
  457. if (rc) {
  458. pr_info("%s: Client not running :%d:\n",
  459. __func__,
  460. is_daemon_in_service());
  461. goto out;
  462. }
  463. /*
  464. * The value we want to send back to userspace is in buf, unless this
  465. * there are two parameters, which is specially handled below.
  466. */
  467. if (strcmp(kobj->name, ORANGEFS_KOBJ_ID) ||
  468. strcmp(attr->attr.name, "readahead_count_size")) {
  469. rc = kstrtoint(buf, 0, &val);
  470. if (rc)
  471. goto out;
  472. }
  473. new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
  474. if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
  475. /* Drop unsupported requests first. */
  476. if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
  477. (!strcmp(attr->attr.name, "readahead_count") ||
  478. !strcmp(attr->attr.name, "readahead_size") ||
  479. !strcmp(attr->attr.name, "readahead_count_size"))) {
  480. rc = -EINVAL;
  481. goto out;
  482. }
  483. if (!strcmp(attr->attr.name, "perf_history_size")) {
  484. if (val > 0) {
  485. new_op->upcall.req.param.op =
  486. ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
  487. } else {
  488. rc = 0;
  489. goto out;
  490. }
  491. } else if (!strcmp(attr->attr.name,
  492. "perf_time_interval_secs")) {
  493. if (val > 0) {
  494. new_op->upcall.req.param.op =
  495. ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS;
  496. } else {
  497. rc = 0;
  498. goto out;
  499. }
  500. } else if (!strcmp(attr->attr.name,
  501. "perf_counter_reset")) {
  502. if ((val == 0) || (val == 1)) {
  503. new_op->upcall.req.param.op =
  504. ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
  505. } else {
  506. rc = 0;
  507. goto out;
  508. }
  509. } else if (!strcmp(attr->attr.name,
  510. "readahead_count")) {
  511. if ((val >= 0)) {
  512. new_op->upcall.req.param.op =
  513. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
  514. } else {
  515. rc = 0;
  516. goto out;
  517. }
  518. } else if (!strcmp(attr->attr.name,
  519. "readahead_size")) {
  520. if ((val >= 0)) {
  521. new_op->upcall.req.param.op =
  522. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
  523. } else {
  524. rc = 0;
  525. goto out;
  526. }
  527. } else if (!strcmp(attr->attr.name,
  528. "readahead_count_size")) {
  529. int val1, val2;
  530. rc = sscanf(buf, "%d %d", &val1, &val2);
  531. if (rc < 2) {
  532. rc = 0;
  533. goto out;
  534. }
  535. if ((val1 >= 0) && (val2 >= 0)) {
  536. new_op->upcall.req.param.op =
  537. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
  538. } else {
  539. rc = 0;
  540. goto out;
  541. }
  542. new_op->upcall.req.param.u.value32[0] = val1;
  543. new_op->upcall.req.param.u.value32[1] = val2;
  544. goto value_set;
  545. } else if (!strcmp(attr->attr.name,
  546. "perf_counter_reset")) {
  547. if ((val > 0)) {
  548. new_op->upcall.req.param.op =
  549. ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
  550. } else {
  551. rc = 0;
  552. goto out;
  553. }
  554. }
  555. } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
  556. if (!strcmp(attr->attr.name, "hard_limit")) {
  557. if (val > -1) {
  558. new_op->upcall.req.param.op =
  559. ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT;
  560. } else {
  561. rc = 0;
  562. goto out;
  563. }
  564. } else if (!strcmp(attr->attr.name, "soft_limit")) {
  565. if (val > -1) {
  566. new_op->upcall.req.param.op =
  567. ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT;
  568. } else {
  569. rc = 0;
  570. goto out;
  571. }
  572. } else if (!strcmp(attr->attr.name,
  573. "reclaim_percentage")) {
  574. if ((val > -1) && (val < 101)) {
  575. new_op->upcall.req.param.op =
  576. ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE;
  577. } else {
  578. rc = 0;
  579. goto out;
  580. }
  581. } else if (!strcmp(attr->attr.name, "timeout_msecs")) {
  582. if (val > -1) {
  583. new_op->upcall.req.param.op =
  584. ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS;
  585. } else {
  586. rc = 0;
  587. goto out;
  588. }
  589. }
  590. } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) {
  591. if (!strcmp(attr->attr.name, "hard_limit")) {
  592. if (val > -1) {
  593. new_op->upcall.req.param.op =
  594. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT;
  595. } else {
  596. rc = 0;
  597. goto out;
  598. }
  599. } else if (!strcmp(attr->attr.name, "soft_limit")) {
  600. if (val > -1) {
  601. new_op->upcall.req.param.op =
  602. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT;
  603. } else {
  604. rc = 0;
  605. goto out;
  606. }
  607. } else if (!strcmp(attr->attr.name,
  608. "reclaim_percentage")) {
  609. if ((val > -1) && (val < 101)) {
  610. new_op->upcall.req.param.op =
  611. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE;
  612. } else {
  613. rc = 0;
  614. goto out;
  615. }
  616. } else if (!strcmp(attr->attr.name, "timeout_secs")) {
  617. if (val > -1) {
  618. new_op->upcall.req.param.op =
  619. ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS;
  620. } else {
  621. rc = 0;
  622. goto out;
  623. }
  624. }
  625. } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) {
  626. if (!strcmp(attr->attr.name, "hard_limit")) {
  627. if (val > -1) {
  628. new_op->upcall.req.param.op =
  629. ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT;
  630. } else {
  631. rc = 0;
  632. goto out;
  633. }
  634. } else if (!strcmp(attr->attr.name, "soft_limit")) {
  635. if (val > -1) {
  636. new_op->upcall.req.param.op =
  637. ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT;
  638. } else {
  639. rc = 0;
  640. goto out;
  641. }
  642. } else if (!strcmp(attr->attr.name,
  643. "reclaim_percentage")) {
  644. if ((val > -1) && (val < 101)) {
  645. new_op->upcall.req.param.op =
  646. ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE;
  647. } else {
  648. rc = 0;
  649. goto out;
  650. }
  651. } else if (!strcmp(attr->attr.name, "timeout_secs")) {
  652. if (val > -1) {
  653. new_op->upcall.req.param.op =
  654. ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS;
  655. } else {
  656. rc = 0;
  657. goto out;
  658. }
  659. }
  660. } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) {
  661. if (!strcmp(attr->attr.name, "hard_limit")) {
  662. if (val > -1) {
  663. new_op->upcall.req.param.op =
  664. ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT;
  665. } else {
  666. rc = 0;
  667. goto out;
  668. }
  669. } else if (!strcmp(attr->attr.name, "soft_limit")) {
  670. if (val > -1) {
  671. new_op->upcall.req.param.op =
  672. ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT;
  673. } else {
  674. rc = 0;
  675. goto out;
  676. }
  677. } else if (!strcmp(attr->attr.name,
  678. "reclaim_percentage")) {
  679. if ((val > -1) && (val < 101)) {
  680. new_op->upcall.req.param.op =
  681. ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE;
  682. } else {
  683. rc = 0;
  684. goto out;
  685. }
  686. } else if (!strcmp(attr->attr.name, "timeout_msecs")) {
  687. if (val > -1) {
  688. new_op->upcall.req.param.op =
  689. ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS;
  690. } else {
  691. rc = 0;
  692. goto out;
  693. }
  694. }
  695. } else {
  696. gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n",
  697. kobj->name);
  698. rc = -EINVAL;
  699. goto out;
  700. }
  701. new_op->upcall.req.param.u.value64 = val;
  702. value_set:
  703. /*
  704. * The service_operation will return a errno return code on
  705. * error, and zero on success.
  706. */
  707. rc = service_operation(new_op, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE);
  708. if (rc < 0) {
  709. gossip_err("sysfs_service_op_store: service op returned:%d:\n",
  710. rc);
  711. rc = 0;
  712. } else {
  713. rc = count;
  714. }
  715. out:
  716. op_release(new_op);
  717. if (rc == -ENOMEM || rc == 0)
  718. rc = -EINVAL;
  719. return rc;
  720. }
  721. static struct orangefs_attribute op_timeout_secs_attribute =
  722. __ATTR(op_timeout_secs, 0664, sysfs_int_show, sysfs_int_store);
  723. static struct orangefs_attribute slot_timeout_secs_attribute =
  724. __ATTR(slot_timeout_secs, 0664, sysfs_int_show, sysfs_int_store);
  725. static struct orangefs_attribute dcache_timeout_msecs_attribute =
  726. __ATTR(dcache_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store);
  727. static struct orangefs_attribute getattr_timeout_msecs_attribute =
  728. __ATTR(getattr_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store);
  729. static struct orangefs_attribute readahead_count_attribute =
  730. __ATTR(readahead_count, 0664, sysfs_service_op_show,
  731. sysfs_service_op_store);
  732. static struct orangefs_attribute readahead_size_attribute =
  733. __ATTR(readahead_size, 0664, sysfs_service_op_show,
  734. sysfs_service_op_store);
  735. static struct orangefs_attribute readahead_count_size_attribute =
  736. __ATTR(readahead_count_size, 0664, sysfs_service_op_show,
  737. sysfs_service_op_store);
  738. static struct orangefs_attribute perf_counter_reset_attribute =
  739. __ATTR(perf_counter_reset,
  740. 0664,
  741. sysfs_service_op_show,
  742. sysfs_service_op_store);
  743. static struct orangefs_attribute perf_history_size_attribute =
  744. __ATTR(perf_history_size,
  745. 0664,
  746. sysfs_service_op_show,
  747. sysfs_service_op_store);
  748. static struct orangefs_attribute perf_time_interval_secs_attribute =
  749. __ATTR(perf_time_interval_secs,
  750. 0664,
  751. sysfs_service_op_show,
  752. sysfs_service_op_store);
  753. static struct attribute *orangefs_default_attrs[] = {
  754. &op_timeout_secs_attribute.attr,
  755. &slot_timeout_secs_attribute.attr,
  756. &dcache_timeout_msecs_attribute.attr,
  757. &getattr_timeout_msecs_attribute.attr,
  758. &readahead_count_attribute.attr,
  759. &readahead_size_attribute.attr,
  760. &readahead_count_size_attribute.attr,
  761. &perf_counter_reset_attribute.attr,
  762. &perf_history_size_attribute.attr,
  763. &perf_time_interval_secs_attribute.attr,
  764. NULL,
  765. };
  766. static struct kobj_type orangefs_ktype = {
  767. .sysfs_ops = &orangefs_sysfs_ops,
  768. .default_attrs = orangefs_default_attrs,
  769. };
  770. static struct orangefs_attribute acache_hard_limit_attribute =
  771. __ATTR(hard_limit,
  772. 0664,
  773. sysfs_service_op_show,
  774. sysfs_service_op_store);
  775. static struct orangefs_attribute acache_reclaim_percent_attribute =
  776. __ATTR(reclaim_percentage,
  777. 0664,
  778. sysfs_service_op_show,
  779. sysfs_service_op_store);
  780. static struct orangefs_attribute acache_soft_limit_attribute =
  781. __ATTR(soft_limit,
  782. 0664,
  783. sysfs_service_op_show,
  784. sysfs_service_op_store);
  785. static struct orangefs_attribute acache_timeout_msecs_attribute =
  786. __ATTR(timeout_msecs,
  787. 0664,
  788. sysfs_service_op_show,
  789. sysfs_service_op_store);
  790. static struct attribute *acache_orangefs_default_attrs[] = {
  791. &acache_hard_limit_attribute.attr,
  792. &acache_reclaim_percent_attribute.attr,
  793. &acache_soft_limit_attribute.attr,
  794. &acache_timeout_msecs_attribute.attr,
  795. NULL,
  796. };
  797. static struct kobj_type acache_orangefs_ktype = {
  798. .sysfs_ops = &orangefs_sysfs_ops,
  799. .default_attrs = acache_orangefs_default_attrs,
  800. };
  801. static struct orangefs_attribute capcache_hard_limit_attribute =
  802. __ATTR(hard_limit,
  803. 0664,
  804. sysfs_service_op_show,
  805. sysfs_service_op_store);
  806. static struct orangefs_attribute capcache_reclaim_percent_attribute =
  807. __ATTR(reclaim_percentage,
  808. 0664,
  809. sysfs_service_op_show,
  810. sysfs_service_op_store);
  811. static struct orangefs_attribute capcache_soft_limit_attribute =
  812. __ATTR(soft_limit,
  813. 0664,
  814. sysfs_service_op_show,
  815. sysfs_service_op_store);
  816. static struct orangefs_attribute capcache_timeout_secs_attribute =
  817. __ATTR(timeout_secs,
  818. 0664,
  819. sysfs_service_op_show,
  820. sysfs_service_op_store);
  821. static struct attribute *capcache_orangefs_default_attrs[] = {
  822. &capcache_hard_limit_attribute.attr,
  823. &capcache_reclaim_percent_attribute.attr,
  824. &capcache_soft_limit_attribute.attr,
  825. &capcache_timeout_secs_attribute.attr,
  826. NULL,
  827. };
  828. static struct kobj_type capcache_orangefs_ktype = {
  829. .sysfs_ops = &orangefs_sysfs_ops,
  830. .default_attrs = capcache_orangefs_default_attrs,
  831. };
  832. static struct orangefs_attribute ccache_hard_limit_attribute =
  833. __ATTR(hard_limit,
  834. 0664,
  835. sysfs_service_op_show,
  836. sysfs_service_op_store);
  837. static struct orangefs_attribute ccache_reclaim_percent_attribute =
  838. __ATTR(reclaim_percentage,
  839. 0664,
  840. sysfs_service_op_show,
  841. sysfs_service_op_store);
  842. static struct orangefs_attribute ccache_soft_limit_attribute =
  843. __ATTR(soft_limit,
  844. 0664,
  845. sysfs_service_op_show,
  846. sysfs_service_op_store);
  847. static struct orangefs_attribute ccache_timeout_secs_attribute =
  848. __ATTR(timeout_secs,
  849. 0664,
  850. sysfs_service_op_show,
  851. sysfs_service_op_store);
  852. static struct attribute *ccache_orangefs_default_attrs[] = {
  853. &ccache_hard_limit_attribute.attr,
  854. &ccache_reclaim_percent_attribute.attr,
  855. &ccache_soft_limit_attribute.attr,
  856. &ccache_timeout_secs_attribute.attr,
  857. NULL,
  858. };
  859. static struct kobj_type ccache_orangefs_ktype = {
  860. .sysfs_ops = &orangefs_sysfs_ops,
  861. .default_attrs = ccache_orangefs_default_attrs,
  862. };
  863. static struct orangefs_attribute ncache_hard_limit_attribute =
  864. __ATTR(hard_limit,
  865. 0664,
  866. sysfs_service_op_show,
  867. sysfs_service_op_store);
  868. static struct orangefs_attribute ncache_reclaim_percent_attribute =
  869. __ATTR(reclaim_percentage,
  870. 0664,
  871. sysfs_service_op_show,
  872. sysfs_service_op_store);
  873. static struct orangefs_attribute ncache_soft_limit_attribute =
  874. __ATTR(soft_limit,
  875. 0664,
  876. sysfs_service_op_show,
  877. sysfs_service_op_store);
  878. static struct orangefs_attribute ncache_timeout_msecs_attribute =
  879. __ATTR(timeout_msecs,
  880. 0664,
  881. sysfs_service_op_show,
  882. sysfs_service_op_store);
  883. static struct attribute *ncache_orangefs_default_attrs[] = {
  884. &ncache_hard_limit_attribute.attr,
  885. &ncache_reclaim_percent_attribute.attr,
  886. &ncache_soft_limit_attribute.attr,
  887. &ncache_timeout_msecs_attribute.attr,
  888. NULL,
  889. };
  890. static struct kobj_type ncache_orangefs_ktype = {
  891. .sysfs_ops = &orangefs_sysfs_ops,
  892. .default_attrs = ncache_orangefs_default_attrs,
  893. };
  894. static struct orangefs_attribute pc_acache_attribute =
  895. __ATTR(acache,
  896. 0664,
  897. sysfs_service_op_show,
  898. NULL);
  899. static struct orangefs_attribute pc_capcache_attribute =
  900. __ATTR(capcache,
  901. 0664,
  902. sysfs_service_op_show,
  903. NULL);
  904. static struct orangefs_attribute pc_ncache_attribute =
  905. __ATTR(ncache,
  906. 0664,
  907. sysfs_service_op_show,
  908. NULL);
  909. static struct attribute *pc_orangefs_default_attrs[] = {
  910. &pc_acache_attribute.attr,
  911. &pc_capcache_attribute.attr,
  912. &pc_ncache_attribute.attr,
  913. NULL,
  914. };
  915. static struct kobj_type pc_orangefs_ktype = {
  916. .sysfs_ops = &orangefs_sysfs_ops,
  917. .default_attrs = pc_orangefs_default_attrs,
  918. };
  919. static struct orangefs_attribute stats_reads_attribute =
  920. __ATTR(reads,
  921. 0664,
  922. sysfs_int_show,
  923. NULL);
  924. static struct orangefs_attribute stats_writes_attribute =
  925. __ATTR(writes,
  926. 0664,
  927. sysfs_int_show,
  928. NULL);
  929. static struct attribute *stats_orangefs_default_attrs[] = {
  930. &stats_reads_attribute.attr,
  931. &stats_writes_attribute.attr,
  932. NULL,
  933. };
  934. static struct kobj_type stats_orangefs_ktype = {
  935. .sysfs_ops = &orangefs_sysfs_ops,
  936. .default_attrs = stats_orangefs_default_attrs,
  937. };
  938. static struct kobject *orangefs_obj;
  939. static struct kobject *acache_orangefs_obj;
  940. static struct kobject *capcache_orangefs_obj;
  941. static struct kobject *ccache_orangefs_obj;
  942. static struct kobject *ncache_orangefs_obj;
  943. static struct kobject *pc_orangefs_obj;
  944. static struct kobject *stats_orangefs_obj;
  945. int orangefs_sysfs_init(void)
  946. {
  947. int rc = -EINVAL;
  948. gossip_debug(GOSSIP_SYSFS_DEBUG, "orangefs_sysfs_init: start\n");
  949. /* create /sys/fs/orangefs. */
  950. orangefs_obj = kzalloc(sizeof(*orangefs_obj), GFP_KERNEL);
  951. if (!orangefs_obj)
  952. goto out;
  953. rc = kobject_init_and_add(orangefs_obj,
  954. &orangefs_ktype,
  955. fs_kobj,
  956. ORANGEFS_KOBJ_ID);
  957. if (rc)
  958. goto ofs_obj_bail;
  959. kobject_uevent(orangefs_obj, KOBJ_ADD);
  960. /* create /sys/fs/orangefs/acache. */
  961. acache_orangefs_obj = kzalloc(sizeof(*acache_orangefs_obj), GFP_KERNEL);
  962. if (!acache_orangefs_obj) {
  963. rc = -EINVAL;
  964. goto ofs_obj_bail;
  965. }
  966. rc = kobject_init_and_add(acache_orangefs_obj,
  967. &acache_orangefs_ktype,
  968. orangefs_obj,
  969. ACACHE_KOBJ_ID);
  970. if (rc)
  971. goto acache_obj_bail;
  972. kobject_uevent(acache_orangefs_obj, KOBJ_ADD);
  973. /* create /sys/fs/orangefs/capcache. */
  974. capcache_orangefs_obj =
  975. kzalloc(sizeof(*capcache_orangefs_obj), GFP_KERNEL);
  976. if (!capcache_orangefs_obj) {
  977. rc = -EINVAL;
  978. goto acache_obj_bail;
  979. }
  980. rc = kobject_init_and_add(capcache_orangefs_obj,
  981. &capcache_orangefs_ktype,
  982. orangefs_obj,
  983. CAPCACHE_KOBJ_ID);
  984. if (rc)
  985. goto capcache_obj_bail;
  986. kobject_uevent(capcache_orangefs_obj, KOBJ_ADD);
  987. /* create /sys/fs/orangefs/ccache. */
  988. ccache_orangefs_obj =
  989. kzalloc(sizeof(*ccache_orangefs_obj), GFP_KERNEL);
  990. if (!ccache_orangefs_obj) {
  991. rc = -EINVAL;
  992. goto capcache_obj_bail;
  993. }
  994. rc = kobject_init_and_add(ccache_orangefs_obj,
  995. &ccache_orangefs_ktype,
  996. orangefs_obj,
  997. CCACHE_KOBJ_ID);
  998. if (rc)
  999. goto ccache_obj_bail;
  1000. kobject_uevent(ccache_orangefs_obj, KOBJ_ADD);
  1001. /* create /sys/fs/orangefs/ncache. */
  1002. ncache_orangefs_obj = kzalloc(sizeof(*ncache_orangefs_obj), GFP_KERNEL);
  1003. if (!ncache_orangefs_obj) {
  1004. rc = -EINVAL;
  1005. goto ccache_obj_bail;
  1006. }
  1007. rc = kobject_init_and_add(ncache_orangefs_obj,
  1008. &ncache_orangefs_ktype,
  1009. orangefs_obj,
  1010. NCACHE_KOBJ_ID);
  1011. if (rc)
  1012. goto ncache_obj_bail;
  1013. kobject_uevent(ncache_orangefs_obj, KOBJ_ADD);
  1014. /* create /sys/fs/orangefs/perf_counters. */
  1015. pc_orangefs_obj = kzalloc(sizeof(*pc_orangefs_obj), GFP_KERNEL);
  1016. if (!pc_orangefs_obj) {
  1017. rc = -EINVAL;
  1018. goto ncache_obj_bail;
  1019. }
  1020. rc = kobject_init_and_add(pc_orangefs_obj,
  1021. &pc_orangefs_ktype,
  1022. orangefs_obj,
  1023. "perf_counters");
  1024. if (rc)
  1025. goto pc_obj_bail;
  1026. kobject_uevent(pc_orangefs_obj, KOBJ_ADD);
  1027. /* create /sys/fs/orangefs/stats. */
  1028. stats_orangefs_obj = kzalloc(sizeof(*stats_orangefs_obj), GFP_KERNEL);
  1029. if (!stats_orangefs_obj) {
  1030. rc = -EINVAL;
  1031. goto pc_obj_bail;
  1032. }
  1033. rc = kobject_init_and_add(stats_orangefs_obj,
  1034. &stats_orangefs_ktype,
  1035. orangefs_obj,
  1036. STATS_KOBJ_ID);
  1037. if (rc)
  1038. goto stats_obj_bail;
  1039. kobject_uevent(stats_orangefs_obj, KOBJ_ADD);
  1040. goto out;
  1041. stats_obj_bail:
  1042. kobject_put(stats_orangefs_obj);
  1043. pc_obj_bail:
  1044. kobject_put(pc_orangefs_obj);
  1045. ncache_obj_bail:
  1046. kobject_put(ncache_orangefs_obj);
  1047. ccache_obj_bail:
  1048. kobject_put(ccache_orangefs_obj);
  1049. capcache_obj_bail:
  1050. kobject_put(capcache_orangefs_obj);
  1051. acache_obj_bail:
  1052. kobject_put(acache_orangefs_obj);
  1053. ofs_obj_bail:
  1054. kobject_put(orangefs_obj);
  1055. out:
  1056. return rc;
  1057. }
  1058. void orangefs_sysfs_exit(void)
  1059. {
  1060. gossip_debug(GOSSIP_SYSFS_DEBUG, "orangefs_sysfs_exit: start\n");
  1061. kobject_put(acache_orangefs_obj);
  1062. kobject_put(capcache_orangefs_obj);
  1063. kobject_put(ccache_orangefs_obj);
  1064. kobject_put(ncache_orangefs_obj);
  1065. kobject_put(pc_orangefs_obj);
  1066. kobject_put(stats_orangefs_obj);
  1067. kobject_put(orangefs_obj);
  1068. }