nfs4state.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  1. /*
  2. * fs/nfs/nfs4state.c
  3. *
  4. * Client-side XDR for NFSv4.
  5. *
  6. * Copyright (c) 2002 The Regents of the University of Michigan.
  7. * All rights reserved.
  8. *
  9. * Kendrick Smith <kmsmith@umich.edu>
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * 1. Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright
  18. * notice, this list of conditions and the following disclaimer in the
  19. * documentation and/or other materials provided with the distribution.
  20. * 3. Neither the name of the University nor the names of its
  21. * contributors may be used to endorse or promote products derived
  22. * from this software without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  25. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  26. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  31. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  32. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  33. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  34. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. * Implementation of the NFSv4 state model. For the time being,
  37. * this is minimal, but will be made much more complex in a
  38. * subsequent patch.
  39. */
  40. #include <linux/kernel.h>
  41. #include <linux/slab.h>
  42. #include <linux/smp_lock.h>
  43. #include <linux/nfs_fs.h>
  44. #include <linux/nfs_idmap.h>
  45. #include <linux/kthread.h>
  46. #include <linux/module.h>
  47. #include <linux/random.h>
  48. #include <linux/workqueue.h>
  49. #include <linux/bitops.h>
  50. #include "nfs4_fs.h"
  51. #include "callback.h"
  52. #include "delegation.h"
  53. #include "internal.h"
  54. #define OPENOWNER_POOL_SIZE 8
  55. const nfs4_stateid zero_stateid;
  56. static LIST_HEAD(nfs4_clientid_list);
  57. static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred)
  58. {
  59. int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK,
  60. nfs_callback_tcpport, cred);
  61. if (status == 0)
  62. status = nfs4_proc_setclientid_confirm(clp, cred);
  63. if (status == 0)
  64. nfs4_schedule_state_renewal(clp);
  65. return status;
  66. }
  67. static struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp)
  68. {
  69. struct rpc_cred *cred = NULL;
  70. if (clp->cl_machine_cred != NULL)
  71. cred = get_rpccred(clp->cl_machine_cred);
  72. return cred;
  73. }
  74. static void nfs4_clear_machine_cred(struct nfs_client *clp)
  75. {
  76. struct rpc_cred *cred;
  77. spin_lock(&clp->cl_lock);
  78. cred = clp->cl_machine_cred;
  79. clp->cl_machine_cred = NULL;
  80. spin_unlock(&clp->cl_lock);
  81. if (cred != NULL)
  82. put_rpccred(cred);
  83. }
  84. struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp)
  85. {
  86. struct nfs4_state_owner *sp;
  87. struct rb_node *pos;
  88. struct rpc_cred *cred = NULL;
  89. for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
  90. sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
  91. if (list_empty(&sp->so_states))
  92. continue;
  93. cred = get_rpccred(sp->so_cred);
  94. break;
  95. }
  96. return cred;
  97. }
  98. static struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp)
  99. {
  100. struct rpc_cred *cred;
  101. spin_lock(&clp->cl_lock);
  102. cred = nfs4_get_renew_cred_locked(clp);
  103. spin_unlock(&clp->cl_lock);
  104. return cred;
  105. }
  106. static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp)
  107. {
  108. struct nfs4_state_owner *sp;
  109. struct rb_node *pos;
  110. struct rpc_cred *cred;
  111. spin_lock(&clp->cl_lock);
  112. cred = nfs4_get_machine_cred_locked(clp);
  113. if (cred != NULL)
  114. goto out;
  115. pos = rb_first(&clp->cl_state_owners);
  116. if (pos != NULL) {
  117. sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
  118. cred = get_rpccred(sp->so_cred);
  119. }
  120. out:
  121. spin_unlock(&clp->cl_lock);
  122. return cred;
  123. }
  124. static void nfs_alloc_unique_id(struct rb_root *root, struct nfs_unique_id *new,
  125. __u64 minval, int maxbits)
  126. {
  127. struct rb_node **p, *parent;
  128. struct nfs_unique_id *pos;
  129. __u64 mask = ~0ULL;
  130. if (maxbits < 64)
  131. mask = (1ULL << maxbits) - 1ULL;
  132. /* Ensure distribution is more or less flat */
  133. get_random_bytes(&new->id, sizeof(new->id));
  134. new->id &= mask;
  135. if (new->id < minval)
  136. new->id += minval;
  137. retry:
  138. p = &root->rb_node;
  139. parent = NULL;
  140. while (*p != NULL) {
  141. parent = *p;
  142. pos = rb_entry(parent, struct nfs_unique_id, rb_node);
  143. if (new->id < pos->id)
  144. p = &(*p)->rb_left;
  145. else if (new->id > pos->id)
  146. p = &(*p)->rb_right;
  147. else
  148. goto id_exists;
  149. }
  150. rb_link_node(&new->rb_node, parent, p);
  151. rb_insert_color(&new->rb_node, root);
  152. return;
  153. id_exists:
  154. for (;;) {
  155. new->id++;
  156. if (new->id < minval || (new->id & mask) != new->id) {
  157. new->id = minval;
  158. break;
  159. }
  160. parent = rb_next(parent);
  161. if (parent == NULL)
  162. break;
  163. pos = rb_entry(parent, struct nfs_unique_id, rb_node);
  164. if (new->id < pos->id)
  165. break;
  166. }
  167. goto retry;
  168. }
  169. static void nfs_free_unique_id(struct rb_root *root, struct nfs_unique_id *id)
  170. {
  171. rb_erase(&id->rb_node, root);
  172. }
  173. static struct nfs4_state_owner *
  174. nfs4_find_state_owner(struct nfs_server *server, struct rpc_cred *cred)
  175. {
  176. struct nfs_client *clp = server->nfs_client;
  177. struct rb_node **p = &clp->cl_state_owners.rb_node,
  178. *parent = NULL;
  179. struct nfs4_state_owner *sp, *res = NULL;
  180. while (*p != NULL) {
  181. parent = *p;
  182. sp = rb_entry(parent, struct nfs4_state_owner, so_client_node);
  183. if (server < sp->so_server) {
  184. p = &parent->rb_left;
  185. continue;
  186. }
  187. if (server > sp->so_server) {
  188. p = &parent->rb_right;
  189. continue;
  190. }
  191. if (cred < sp->so_cred)
  192. p = &parent->rb_left;
  193. else if (cred > sp->so_cred)
  194. p = &parent->rb_right;
  195. else {
  196. atomic_inc(&sp->so_count);
  197. res = sp;
  198. break;
  199. }
  200. }
  201. return res;
  202. }
  203. static struct nfs4_state_owner *
  204. nfs4_insert_state_owner(struct nfs_client *clp, struct nfs4_state_owner *new)
  205. {
  206. struct rb_node **p = &clp->cl_state_owners.rb_node,
  207. *parent = NULL;
  208. struct nfs4_state_owner *sp;
  209. while (*p != NULL) {
  210. parent = *p;
  211. sp = rb_entry(parent, struct nfs4_state_owner, so_client_node);
  212. if (new->so_server < sp->so_server) {
  213. p = &parent->rb_left;
  214. continue;
  215. }
  216. if (new->so_server > sp->so_server) {
  217. p = &parent->rb_right;
  218. continue;
  219. }
  220. if (new->so_cred < sp->so_cred)
  221. p = &parent->rb_left;
  222. else if (new->so_cred > sp->so_cred)
  223. p = &parent->rb_right;
  224. else {
  225. atomic_inc(&sp->so_count);
  226. return sp;
  227. }
  228. }
  229. nfs_alloc_unique_id(&clp->cl_openowner_id, &new->so_owner_id, 1, 64);
  230. rb_link_node(&new->so_client_node, parent, p);
  231. rb_insert_color(&new->so_client_node, &clp->cl_state_owners);
  232. return new;
  233. }
  234. static void
  235. nfs4_remove_state_owner(struct nfs_client *clp, struct nfs4_state_owner *sp)
  236. {
  237. if (!RB_EMPTY_NODE(&sp->so_client_node))
  238. rb_erase(&sp->so_client_node, &clp->cl_state_owners);
  239. nfs_free_unique_id(&clp->cl_openowner_id, &sp->so_owner_id);
  240. }
  241. /*
  242. * nfs4_alloc_state_owner(): this is called on the OPEN or CREATE path to
  243. * create a new state_owner.
  244. *
  245. */
  246. static struct nfs4_state_owner *
  247. nfs4_alloc_state_owner(void)
  248. {
  249. struct nfs4_state_owner *sp;
  250. sp = kzalloc(sizeof(*sp),GFP_KERNEL);
  251. if (!sp)
  252. return NULL;
  253. spin_lock_init(&sp->so_lock);
  254. INIT_LIST_HEAD(&sp->so_states);
  255. INIT_LIST_HEAD(&sp->so_delegations);
  256. rpc_init_wait_queue(&sp->so_sequence.wait, "Seqid_waitqueue");
  257. sp->so_seqid.sequence = &sp->so_sequence;
  258. spin_lock_init(&sp->so_sequence.lock);
  259. INIT_LIST_HEAD(&sp->so_sequence.list);
  260. atomic_set(&sp->so_count, 1);
  261. return sp;
  262. }
  263. static void
  264. nfs4_drop_state_owner(struct nfs4_state_owner *sp)
  265. {
  266. if (!RB_EMPTY_NODE(&sp->so_client_node)) {
  267. struct nfs_client *clp = sp->so_client;
  268. spin_lock(&clp->cl_lock);
  269. rb_erase(&sp->so_client_node, &clp->cl_state_owners);
  270. RB_CLEAR_NODE(&sp->so_client_node);
  271. spin_unlock(&clp->cl_lock);
  272. }
  273. }
  274. /*
  275. * Note: must be called with clp->cl_sem held in order to prevent races
  276. * with reboot recovery!
  277. */
  278. struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server, struct rpc_cred *cred)
  279. {
  280. struct nfs_client *clp = server->nfs_client;
  281. struct nfs4_state_owner *sp, *new;
  282. spin_lock(&clp->cl_lock);
  283. sp = nfs4_find_state_owner(server, cred);
  284. spin_unlock(&clp->cl_lock);
  285. if (sp != NULL)
  286. return sp;
  287. new = nfs4_alloc_state_owner();
  288. if (new == NULL)
  289. return NULL;
  290. new->so_client = clp;
  291. new->so_server = server;
  292. new->so_cred = cred;
  293. spin_lock(&clp->cl_lock);
  294. sp = nfs4_insert_state_owner(clp, new);
  295. spin_unlock(&clp->cl_lock);
  296. if (sp == new)
  297. get_rpccred(cred);
  298. else {
  299. rpc_destroy_wait_queue(&new->so_sequence.wait);
  300. kfree(new);
  301. }
  302. return sp;
  303. }
  304. /*
  305. * Must be called with clp->cl_sem held in order to avoid races
  306. * with state recovery...
  307. */
  308. void nfs4_put_state_owner(struct nfs4_state_owner *sp)
  309. {
  310. struct nfs_client *clp = sp->so_client;
  311. struct rpc_cred *cred = sp->so_cred;
  312. if (!atomic_dec_and_lock(&sp->so_count, &clp->cl_lock))
  313. return;
  314. nfs4_remove_state_owner(clp, sp);
  315. spin_unlock(&clp->cl_lock);
  316. rpc_destroy_wait_queue(&sp->so_sequence.wait);
  317. put_rpccred(cred);
  318. kfree(sp);
  319. }
  320. static struct nfs4_state *
  321. nfs4_alloc_open_state(void)
  322. {
  323. struct nfs4_state *state;
  324. state = kzalloc(sizeof(*state), GFP_KERNEL);
  325. if (!state)
  326. return NULL;
  327. atomic_set(&state->count, 1);
  328. INIT_LIST_HEAD(&state->lock_states);
  329. spin_lock_init(&state->state_lock);
  330. seqlock_init(&state->seqlock);
  331. return state;
  332. }
  333. void
  334. nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)
  335. {
  336. if (state->state == mode)
  337. return;
  338. /* NB! List reordering - see the reclaim code for why. */
  339. if ((mode & FMODE_WRITE) != (state->state & FMODE_WRITE)) {
  340. if (mode & FMODE_WRITE)
  341. list_move(&state->open_states, &state->owner->so_states);
  342. else
  343. list_move_tail(&state->open_states, &state->owner->so_states);
  344. }
  345. state->state = mode;
  346. }
  347. static struct nfs4_state *
  348. __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
  349. {
  350. struct nfs_inode *nfsi = NFS_I(inode);
  351. struct nfs4_state *state;
  352. list_for_each_entry(state, &nfsi->open_states, inode_states) {
  353. if (state->owner != owner)
  354. continue;
  355. if (atomic_inc_not_zero(&state->count))
  356. return state;
  357. }
  358. return NULL;
  359. }
  360. static void
  361. nfs4_free_open_state(struct nfs4_state *state)
  362. {
  363. kfree(state);
  364. }
  365. struct nfs4_state *
  366. nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner)
  367. {
  368. struct nfs4_state *state, *new;
  369. struct nfs_inode *nfsi = NFS_I(inode);
  370. spin_lock(&inode->i_lock);
  371. state = __nfs4_find_state_byowner(inode, owner);
  372. spin_unlock(&inode->i_lock);
  373. if (state)
  374. goto out;
  375. new = nfs4_alloc_open_state();
  376. spin_lock(&owner->so_lock);
  377. spin_lock(&inode->i_lock);
  378. state = __nfs4_find_state_byowner(inode, owner);
  379. if (state == NULL && new != NULL) {
  380. state = new;
  381. state->owner = owner;
  382. atomic_inc(&owner->so_count);
  383. list_add(&state->inode_states, &nfsi->open_states);
  384. state->inode = igrab(inode);
  385. spin_unlock(&inode->i_lock);
  386. /* Note: The reclaim code dictates that we add stateless
  387. * and read-only stateids to the end of the list */
  388. list_add_tail(&state->open_states, &owner->so_states);
  389. spin_unlock(&owner->so_lock);
  390. } else {
  391. spin_unlock(&inode->i_lock);
  392. spin_unlock(&owner->so_lock);
  393. if (new)
  394. nfs4_free_open_state(new);
  395. }
  396. out:
  397. return state;
  398. }
  399. /*
  400. * Beware! Caller must be holding exactly one
  401. * reference to clp->cl_sem!
  402. */
  403. void nfs4_put_open_state(struct nfs4_state *state)
  404. {
  405. struct inode *inode = state->inode;
  406. struct nfs4_state_owner *owner = state->owner;
  407. if (!atomic_dec_and_lock(&state->count, &owner->so_lock))
  408. return;
  409. spin_lock(&inode->i_lock);
  410. list_del(&state->inode_states);
  411. list_del(&state->open_states);
  412. spin_unlock(&inode->i_lock);
  413. spin_unlock(&owner->so_lock);
  414. iput(inode);
  415. nfs4_free_open_state(state);
  416. nfs4_put_state_owner(owner);
  417. }
  418. /*
  419. * Close the current file.
  420. */
  421. static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mode, int wait)
  422. {
  423. struct nfs4_state_owner *owner = state->owner;
  424. int call_close = 0;
  425. int newstate;
  426. atomic_inc(&owner->so_count);
  427. /* Protect against nfs4_find_state() */
  428. spin_lock(&owner->so_lock);
  429. switch (mode & (FMODE_READ | FMODE_WRITE)) {
  430. case FMODE_READ:
  431. state->n_rdonly--;
  432. break;
  433. case FMODE_WRITE:
  434. state->n_wronly--;
  435. break;
  436. case FMODE_READ|FMODE_WRITE:
  437. state->n_rdwr--;
  438. }
  439. newstate = FMODE_READ|FMODE_WRITE;
  440. if (state->n_rdwr == 0) {
  441. if (state->n_rdonly == 0) {
  442. newstate &= ~FMODE_READ;
  443. call_close |= test_bit(NFS_O_RDONLY_STATE, &state->flags);
  444. call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
  445. }
  446. if (state->n_wronly == 0) {
  447. newstate &= ~FMODE_WRITE;
  448. call_close |= test_bit(NFS_O_WRONLY_STATE, &state->flags);
  449. call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags);
  450. }
  451. if (newstate == 0)
  452. clear_bit(NFS_DELEGATED_STATE, &state->flags);
  453. }
  454. nfs4_state_set_mode_locked(state, newstate);
  455. spin_unlock(&owner->so_lock);
  456. if (!call_close) {
  457. nfs4_put_open_state(state);
  458. nfs4_put_state_owner(owner);
  459. } else
  460. nfs4_do_close(path, state, wait);
  461. }
  462. void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)
  463. {
  464. __nfs4_close(path, state, mode, 0);
  465. }
  466. void nfs4_close_sync(struct path *path, struct nfs4_state *state, mode_t mode)
  467. {
  468. __nfs4_close(path, state, mode, 1);
  469. }
  470. /*
  471. * Search the state->lock_states for an existing lock_owner
  472. * that is compatible with current->files
  473. */
  474. static struct nfs4_lock_state *
  475. __nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
  476. {
  477. struct nfs4_lock_state *pos;
  478. list_for_each_entry(pos, &state->lock_states, ls_locks) {
  479. if (pos->ls_owner != fl_owner)
  480. continue;
  481. atomic_inc(&pos->ls_count);
  482. return pos;
  483. }
  484. return NULL;
  485. }
  486. /*
  487. * Return a compatible lock_state. If no initialized lock_state structure
  488. * exists, return an uninitialized one.
  489. *
  490. */
  491. static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, fl_owner_t fl_owner)
  492. {
  493. struct nfs4_lock_state *lsp;
  494. struct nfs_client *clp = state->owner->so_client;
  495. lsp = kzalloc(sizeof(*lsp), GFP_KERNEL);
  496. if (lsp == NULL)
  497. return NULL;
  498. rpc_init_wait_queue(&lsp->ls_sequence.wait, "lock_seqid_waitqueue");
  499. spin_lock_init(&lsp->ls_sequence.lock);
  500. INIT_LIST_HEAD(&lsp->ls_sequence.list);
  501. lsp->ls_seqid.sequence = &lsp->ls_sequence;
  502. atomic_set(&lsp->ls_count, 1);
  503. lsp->ls_owner = fl_owner;
  504. spin_lock(&clp->cl_lock);
  505. nfs_alloc_unique_id(&clp->cl_lockowner_id, &lsp->ls_id, 1, 64);
  506. spin_unlock(&clp->cl_lock);
  507. INIT_LIST_HEAD(&lsp->ls_locks);
  508. return lsp;
  509. }
  510. static void nfs4_free_lock_state(struct nfs4_lock_state *lsp)
  511. {
  512. struct nfs_client *clp = lsp->ls_state->owner->so_client;
  513. spin_lock(&clp->cl_lock);
  514. nfs_free_unique_id(&clp->cl_lockowner_id, &lsp->ls_id);
  515. spin_unlock(&clp->cl_lock);
  516. rpc_destroy_wait_queue(&lsp->ls_sequence.wait);
  517. kfree(lsp);
  518. }
  519. /*
  520. * Return a compatible lock_state. If no initialized lock_state structure
  521. * exists, return an uninitialized one.
  522. *
  523. * The caller must be holding clp->cl_sem
  524. */
  525. static struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner)
  526. {
  527. struct nfs4_lock_state *lsp, *new = NULL;
  528. for(;;) {
  529. spin_lock(&state->state_lock);
  530. lsp = __nfs4_find_lock_state(state, owner);
  531. if (lsp != NULL)
  532. break;
  533. if (new != NULL) {
  534. new->ls_state = state;
  535. list_add(&new->ls_locks, &state->lock_states);
  536. set_bit(LK_STATE_IN_USE, &state->flags);
  537. lsp = new;
  538. new = NULL;
  539. break;
  540. }
  541. spin_unlock(&state->state_lock);
  542. new = nfs4_alloc_lock_state(state, owner);
  543. if (new == NULL)
  544. return NULL;
  545. }
  546. spin_unlock(&state->state_lock);
  547. if (new != NULL)
  548. nfs4_free_lock_state(new);
  549. return lsp;
  550. }
  551. /*
  552. * Release reference to lock_state, and free it if we see that
  553. * it is no longer in use
  554. */
  555. void nfs4_put_lock_state(struct nfs4_lock_state *lsp)
  556. {
  557. struct nfs4_state *state;
  558. if (lsp == NULL)
  559. return;
  560. state = lsp->ls_state;
  561. if (!atomic_dec_and_lock(&lsp->ls_count, &state->state_lock))
  562. return;
  563. list_del(&lsp->ls_locks);
  564. if (list_empty(&state->lock_states))
  565. clear_bit(LK_STATE_IN_USE, &state->flags);
  566. spin_unlock(&state->state_lock);
  567. nfs4_free_lock_state(lsp);
  568. }
  569. static void nfs4_fl_copy_lock(struct file_lock *dst, struct file_lock *src)
  570. {
  571. struct nfs4_lock_state *lsp = src->fl_u.nfs4_fl.owner;
  572. dst->fl_u.nfs4_fl.owner = lsp;
  573. atomic_inc(&lsp->ls_count);
  574. }
  575. static void nfs4_fl_release_lock(struct file_lock *fl)
  576. {
  577. nfs4_put_lock_state(fl->fl_u.nfs4_fl.owner);
  578. }
  579. static struct file_lock_operations nfs4_fl_lock_ops = {
  580. .fl_copy_lock = nfs4_fl_copy_lock,
  581. .fl_release_private = nfs4_fl_release_lock,
  582. };
  583. int nfs4_set_lock_state(struct nfs4_state *state, struct file_lock *fl)
  584. {
  585. struct nfs4_lock_state *lsp;
  586. if (fl->fl_ops != NULL)
  587. return 0;
  588. lsp = nfs4_get_lock_state(state, fl->fl_owner);
  589. if (lsp == NULL)
  590. return -ENOMEM;
  591. fl->fl_u.nfs4_fl.owner = lsp;
  592. fl->fl_ops = &nfs4_fl_lock_ops;
  593. return 0;
  594. }
  595. /*
  596. * Byte-range lock aware utility to initialize the stateid of read/write
  597. * requests.
  598. */
  599. void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t fl_owner)
  600. {
  601. struct nfs4_lock_state *lsp;
  602. int seq;
  603. do {
  604. seq = read_seqbegin(&state->seqlock);
  605. memcpy(dst, &state->stateid, sizeof(*dst));
  606. } while (read_seqretry(&state->seqlock, seq));
  607. if (test_bit(LK_STATE_IN_USE, &state->flags) == 0)
  608. return;
  609. spin_lock(&state->state_lock);
  610. lsp = __nfs4_find_lock_state(state, fl_owner);
  611. if (lsp != NULL && (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0)
  612. memcpy(dst, &lsp->ls_stateid, sizeof(*dst));
  613. spin_unlock(&state->state_lock);
  614. nfs4_put_lock_state(lsp);
  615. }
  616. struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
  617. {
  618. struct nfs_seqid *new;
  619. new = kmalloc(sizeof(*new), GFP_KERNEL);
  620. if (new != NULL) {
  621. new->sequence = counter;
  622. INIT_LIST_HEAD(&new->list);
  623. }
  624. return new;
  625. }
  626. void nfs_free_seqid(struct nfs_seqid *seqid)
  627. {
  628. if (!list_empty(&seqid->list)) {
  629. struct rpc_sequence *sequence = seqid->sequence->sequence;
  630. spin_lock(&sequence->lock);
  631. list_del(&seqid->list);
  632. spin_unlock(&sequence->lock);
  633. rpc_wake_up(&sequence->wait);
  634. }
  635. kfree(seqid);
  636. }
  637. /*
  638. * Increment the seqid if the OPEN/OPEN_DOWNGRADE/CLOSE succeeded, or
  639. * failed with a seqid incrementing error -
  640. * see comments nfs_fs.h:seqid_mutating_error()
  641. */
  642. static void nfs_increment_seqid(int status, struct nfs_seqid *seqid)
  643. {
  644. BUG_ON(list_first_entry(&seqid->sequence->sequence->list, struct nfs_seqid, list) != seqid);
  645. switch (status) {
  646. case 0:
  647. break;
  648. case -NFS4ERR_BAD_SEQID:
  649. if (seqid->sequence->flags & NFS_SEQID_CONFIRMED)
  650. return;
  651. printk(KERN_WARNING "NFS: v4 server returned a bad"
  652. " sequence-id error on an"
  653. " unconfirmed sequence %p!\n",
  654. seqid->sequence);
  655. case -NFS4ERR_STALE_CLIENTID:
  656. case -NFS4ERR_STALE_STATEID:
  657. case -NFS4ERR_BAD_STATEID:
  658. case -NFS4ERR_BADXDR:
  659. case -NFS4ERR_RESOURCE:
  660. case -NFS4ERR_NOFILEHANDLE:
  661. /* Non-seqid mutating errors */
  662. return;
  663. };
  664. /*
  665. * Note: no locking needed as we are guaranteed to be first
  666. * on the sequence list
  667. */
  668. seqid->sequence->counter++;
  669. }
  670. void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid)
  671. {
  672. if (status == -NFS4ERR_BAD_SEQID) {
  673. struct nfs4_state_owner *sp = container_of(seqid->sequence,
  674. struct nfs4_state_owner, so_seqid);
  675. nfs4_drop_state_owner(sp);
  676. }
  677. nfs_increment_seqid(status, seqid);
  678. }
  679. /*
  680. * Increment the seqid if the LOCK/LOCKU succeeded, or
  681. * failed with a seqid incrementing error -
  682. * see comments nfs_fs.h:seqid_mutating_error()
  683. */
  684. void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid)
  685. {
  686. nfs_increment_seqid(status, seqid);
  687. }
  688. int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task)
  689. {
  690. struct rpc_sequence *sequence = seqid->sequence->sequence;
  691. int status = 0;
  692. spin_lock(&sequence->lock);
  693. if (list_empty(&seqid->list))
  694. list_add_tail(&seqid->list, &sequence->list);
  695. if (list_first_entry(&sequence->list, struct nfs_seqid, list) == seqid)
  696. goto unlock;
  697. rpc_sleep_on(&sequence->wait, task, NULL);
  698. status = -EAGAIN;
  699. unlock:
  700. spin_unlock(&sequence->lock);
  701. return status;
  702. }
  703. static int reclaimer(void *);
  704. static inline void nfs4_clear_recover_bit(struct nfs_client *clp)
  705. {
  706. smp_mb__before_clear_bit();
  707. clear_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state);
  708. smp_mb__after_clear_bit();
  709. wake_up_bit(&clp->cl_state, NFS4CLNT_STATE_RECOVER);
  710. rpc_wake_up(&clp->cl_rpcwaitq);
  711. }
  712. /*
  713. * State recovery routine
  714. */
  715. static void nfs4_recover_state(struct nfs_client *clp)
  716. {
  717. struct task_struct *task;
  718. __module_get(THIS_MODULE);
  719. atomic_inc(&clp->cl_count);
  720. task = kthread_run(reclaimer, clp, "%s-reclaim",
  721. rpc_peeraddr2str(clp->cl_rpcclient,
  722. RPC_DISPLAY_ADDR));
  723. if (!IS_ERR(task))
  724. return;
  725. nfs4_clear_recover_bit(clp);
  726. nfs_put_client(clp);
  727. module_put(THIS_MODULE);
  728. }
  729. /*
  730. * Schedule a state recovery attempt
  731. */
  732. void nfs4_schedule_state_recovery(struct nfs_client *clp)
  733. {
  734. if (!clp)
  735. return;
  736. if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
  737. set_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
  738. if (test_and_set_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) == 0)
  739. nfs4_recover_state(clp);
  740. }
  741. static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state)
  742. {
  743. set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
  744. /* Don't recover state that expired before the reboot */
  745. if (test_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags)) {
  746. clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
  747. return 0;
  748. }
  749. set_bit(NFS_OWNER_RECLAIM_REBOOT, &state->owner->so_flags);
  750. set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
  751. return 1;
  752. }
  753. static int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state)
  754. {
  755. set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags);
  756. clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags);
  757. set_bit(NFS_OWNER_RECLAIM_NOGRACE, &state->owner->so_flags);
  758. set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
  759. return 1;
  760. }
  761. static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_recovery_ops *ops)
  762. {
  763. struct inode *inode = state->inode;
  764. struct file_lock *fl;
  765. int status = 0;
  766. for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
  767. if (!(fl->fl_flags & (FL_POSIX|FL_FLOCK)))
  768. continue;
  769. if (nfs_file_open_context(fl->fl_file)->state != state)
  770. continue;
  771. status = ops->recover_lock(state, fl);
  772. if (status >= 0)
  773. continue;
  774. switch (status) {
  775. default:
  776. printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n",
  777. __func__, status);
  778. case -NFS4ERR_EXPIRED:
  779. case -NFS4ERR_NO_GRACE:
  780. case -NFS4ERR_RECLAIM_BAD:
  781. case -NFS4ERR_RECLAIM_CONFLICT:
  782. /* kill_proc(fl->fl_pid, SIGLOST, 1); */
  783. break;
  784. case -NFS4ERR_STALE_CLIENTID:
  785. goto out_err;
  786. }
  787. }
  788. return 0;
  789. out_err:
  790. return status;
  791. }
  792. static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs4_state_recovery_ops *ops)
  793. {
  794. struct nfs4_state *state;
  795. struct nfs4_lock_state *lock;
  796. int status = 0;
  797. /* Note: we rely on the sp->so_states list being ordered
  798. * so that we always reclaim open(O_RDWR) and/or open(O_WRITE)
  799. * states first.
  800. * This is needed to ensure that the server won't give us any
  801. * read delegations that we have to return if, say, we are
  802. * recovering after a network partition or a reboot from a
  803. * server that doesn't support a grace period.
  804. */
  805. restart:
  806. spin_lock(&sp->so_lock);
  807. list_for_each_entry(state, &sp->so_states, open_states) {
  808. if (!test_and_clear_bit(ops->state_flag_bit, &state->flags))
  809. continue;
  810. if (state->state == 0)
  811. continue;
  812. atomic_inc(&state->count);
  813. spin_unlock(&sp->so_lock);
  814. status = ops->recover_open(sp, state);
  815. if (status >= 0) {
  816. status = nfs4_reclaim_locks(state, ops);
  817. if (status >= 0) {
  818. list_for_each_entry(lock, &state->lock_states, ls_locks) {
  819. if (!(lock->ls_flags & NFS_LOCK_INITIALIZED))
  820. printk("%s: Lock reclaim failed!\n",
  821. __func__);
  822. }
  823. nfs4_put_open_state(state);
  824. goto restart;
  825. }
  826. }
  827. switch (status) {
  828. default:
  829. printk(KERN_ERR "%s: unhandled error %d. Zeroing state\n",
  830. __func__, status);
  831. case -ENOENT:
  832. case -ESTALE:
  833. /*
  834. * Open state on this file cannot be recovered
  835. * All we can do is revert to using the zero stateid.
  836. */
  837. memset(state->stateid.data, 0,
  838. sizeof(state->stateid.data));
  839. /* Mark the file as being 'closed' */
  840. state->state = 0;
  841. break;
  842. case -NFS4ERR_RECLAIM_BAD:
  843. case -NFS4ERR_RECLAIM_CONFLICT:
  844. nfs4_state_mark_reclaim_nograce(sp->so_client, state);
  845. break;
  846. case -NFS4ERR_EXPIRED:
  847. case -NFS4ERR_NO_GRACE:
  848. nfs4_state_mark_reclaim_nograce(sp->so_client, state);
  849. case -NFS4ERR_STALE_CLIENTID:
  850. goto out_err;
  851. }
  852. nfs4_put_open_state(state);
  853. goto restart;
  854. }
  855. spin_unlock(&sp->so_lock);
  856. return 0;
  857. out_err:
  858. nfs4_put_open_state(state);
  859. return status;
  860. }
  861. static void nfs4_clear_open_state(struct nfs4_state *state)
  862. {
  863. struct nfs4_lock_state *lock;
  864. clear_bit(NFS_DELEGATED_STATE, &state->flags);
  865. clear_bit(NFS_O_RDONLY_STATE, &state->flags);
  866. clear_bit(NFS_O_WRONLY_STATE, &state->flags);
  867. clear_bit(NFS_O_RDWR_STATE, &state->flags);
  868. list_for_each_entry(lock, &state->lock_states, ls_locks) {
  869. lock->ls_seqid.counter = 0;
  870. lock->ls_seqid.flags = 0;
  871. lock->ls_flags &= ~NFS_LOCK_INITIALIZED;
  872. }
  873. }
  874. static void nfs4_state_mark_reclaim_helper(struct nfs_client *clp, int (*mark_reclaim)(struct nfs_client *clp, struct nfs4_state *state))
  875. {
  876. struct nfs4_state_owner *sp;
  877. struct rb_node *pos;
  878. struct nfs4_state *state;
  879. /* Reset all sequence ids to zero */
  880. for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
  881. sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
  882. sp->so_seqid.counter = 0;
  883. sp->so_seqid.flags = 0;
  884. spin_lock(&sp->so_lock);
  885. list_for_each_entry(state, &sp->so_states, open_states) {
  886. if (mark_reclaim(clp, state))
  887. nfs4_clear_open_state(state);
  888. }
  889. spin_unlock(&sp->so_lock);
  890. }
  891. }
  892. static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
  893. {
  894. /* Mark all delegations for reclaim */
  895. nfs_delegation_mark_reclaim(clp);
  896. nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot);
  897. }
  898. static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp)
  899. {
  900. struct nfs4_state_owner *sp;
  901. struct rb_node *pos;
  902. struct nfs4_state *state;
  903. if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
  904. return;
  905. for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
  906. sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
  907. spin_lock(&sp->so_lock);
  908. list_for_each_entry(state, &sp->so_states, open_states) {
  909. if (!test_and_clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags))
  910. continue;
  911. nfs4_state_mark_reclaim_nograce(clp, state);
  912. }
  913. spin_unlock(&sp->so_lock);
  914. }
  915. nfs_delegation_reap_unclaimed(clp);
  916. }
  917. static void nfs_delegation_clear_all(struct nfs_client *clp)
  918. {
  919. nfs_delegation_mark_reclaim(clp);
  920. nfs_delegation_reap_unclaimed(clp);
  921. }
  922. static void nfs4_state_start_reclaim_nograce(struct nfs_client *clp)
  923. {
  924. nfs_delegation_clear_all(clp);
  925. nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_nograce);
  926. }
  927. static void nfs4_state_end_reclaim_nograce(struct nfs_client *clp)
  928. {
  929. clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
  930. }
  931. static void nfs4_recovery_handle_error(struct nfs_client *clp, int error)
  932. {
  933. switch (error) {
  934. case -NFS4ERR_CB_PATH_DOWN:
  935. set_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state);
  936. break;
  937. case -NFS4ERR_STALE_CLIENTID:
  938. case -NFS4ERR_LEASE_MOVED:
  939. set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
  940. nfs4_state_start_reclaim_reboot(clp);
  941. break;
  942. case -NFS4ERR_EXPIRED:
  943. set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
  944. nfs4_state_start_reclaim_nograce(clp);
  945. }
  946. }
  947. static int nfs4_do_reclaim(struct nfs_client *clp, const struct nfs4_state_recovery_ops *ops)
  948. {
  949. struct rb_node *pos;
  950. int status = 0;
  951. restart:
  952. spin_lock(&clp->cl_lock);
  953. for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) {
  954. struct nfs4_state_owner *sp = rb_entry(pos, struct nfs4_state_owner, so_client_node);
  955. if (!test_and_clear_bit(ops->owner_flag_bit, &sp->so_flags))
  956. continue;
  957. atomic_inc(&sp->so_count);
  958. spin_unlock(&clp->cl_lock);
  959. status = nfs4_reclaim_open_state(sp, ops);
  960. if (status < 0) {
  961. set_bit(ops->owner_flag_bit, &sp->so_flags);
  962. nfs4_put_state_owner(sp);
  963. nfs4_recovery_handle_error(clp, status);
  964. return status;
  965. }
  966. nfs4_put_state_owner(sp);
  967. goto restart;
  968. }
  969. spin_unlock(&clp->cl_lock);
  970. return status;
  971. }
  972. static int nfs4_check_lease(struct nfs_client *clp)
  973. {
  974. struct rpc_cred *cred;
  975. int status = -NFS4ERR_EXPIRED;
  976. /* Is the client already known to have an expired lease? */
  977. if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state))
  978. return 0;
  979. cred = nfs4_get_renew_cred(clp);
  980. if (cred == NULL) {
  981. cred = nfs4_get_setclientid_cred(clp);
  982. if (cred == NULL)
  983. goto out;
  984. }
  985. status = nfs4_proc_renew(clp, cred);
  986. put_rpccred(cred);
  987. out:
  988. nfs4_recovery_handle_error(clp, status);
  989. return status;
  990. }
  991. static int nfs4_reclaim_lease(struct nfs_client *clp)
  992. {
  993. struct rpc_cred *cred;
  994. int status = -ENOENT;
  995. cred = nfs4_get_setclientid_cred(clp);
  996. if (cred != NULL) {
  997. status = nfs4_init_client(clp, cred);
  998. put_rpccred(cred);
  999. /* Handle case where the user hasn't set up machine creds */
  1000. if (status == -EACCES && cred == clp->cl_machine_cred) {
  1001. nfs4_clear_machine_cred(clp);
  1002. status = -EAGAIN;
  1003. }
  1004. }
  1005. return status;
  1006. }
  1007. static int reclaimer(void *ptr)
  1008. {
  1009. struct nfs_client *clp = ptr;
  1010. int status = 0;
  1011. allow_signal(SIGKILL);
  1012. /* Ensure exclusive access to NFSv4 state */
  1013. down_write(&clp->cl_sem);
  1014. while (!list_empty(&clp->cl_superblocks)) {
  1015. if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
  1016. /* We're going to have to re-establish a clientid */
  1017. status = nfs4_reclaim_lease(clp);
  1018. if (status) {
  1019. set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
  1020. if (status == -EAGAIN)
  1021. continue;
  1022. goto out_error;
  1023. }
  1024. clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
  1025. }
  1026. if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
  1027. status = nfs4_check_lease(clp);
  1028. if (status != 0)
  1029. continue;
  1030. }
  1031. /* First recover reboot state... */
  1032. if (test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) {
  1033. /* Note: list is protected by exclusive lock on cl->cl_sem */
  1034. status = nfs4_do_reclaim(clp, &nfs4_reboot_recovery_ops);
  1035. if (status == -NFS4ERR_STALE_CLIENTID)
  1036. continue;
  1037. nfs4_state_end_reclaim_reboot(clp);
  1038. continue;
  1039. }
  1040. /* Now recover expired state... */
  1041. if (test_and_clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state)) {
  1042. /* Note: list is protected by exclusive lock on cl->cl_sem */
  1043. status = nfs4_do_reclaim(clp, &nfs4_nograce_recovery_ops);
  1044. if (status < 0) {
  1045. set_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state);
  1046. if (status == -NFS4ERR_STALE_CLIENTID)
  1047. continue;
  1048. if (status == -NFS4ERR_EXPIRED)
  1049. continue;
  1050. goto out_error;
  1051. } else
  1052. nfs4_state_end_reclaim_nograce(clp);
  1053. continue;
  1054. }
  1055. break;
  1056. }
  1057. out:
  1058. up_write(&clp->cl_sem);
  1059. if (test_and_clear_bit(NFS4CLNT_CB_PATH_DOWN, &clp->cl_state))
  1060. nfs_handle_cb_pathdown(clp);
  1061. nfs4_clear_recover_bit(clp);
  1062. nfs_put_client(clp);
  1063. module_put_and_exit(0);
  1064. return 0;
  1065. out_error:
  1066. printk(KERN_WARNING "Error: state recovery failed on NFSv4 server %s"
  1067. " with error %d\n", clp->cl_hostname, -status);
  1068. if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
  1069. nfs4_state_end_reclaim_reboot(clp);
  1070. goto out;
  1071. }
  1072. /*
  1073. * Local variables:
  1074. * c-basic-offset: 8
  1075. * End:
  1076. */