xfs_attr_remote.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*
  2. * Copyright (c) 2000-2005 Silicon Graphics, Inc.
  3. * Copyright (c) 2013 Red Hat, Inc.
  4. * All Rights Reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it would be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write the Free Software Foundation,
  17. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #include "xfs.h"
  20. #include "xfs_fs.h"
  21. #include "xfs_shared.h"
  22. #include "xfs_format.h"
  23. #include "xfs_log_format.h"
  24. #include "xfs_trans_resv.h"
  25. #include "xfs_bit.h"
  26. #include "xfs_mount.h"
  27. #include "xfs_defer.h"
  28. #include "xfs_da_format.h"
  29. #include "xfs_da_btree.h"
  30. #include "xfs_inode.h"
  31. #include "xfs_alloc.h"
  32. #include "xfs_trans.h"
  33. #include "xfs_inode_item.h"
  34. #include "xfs_bmap.h"
  35. #include "xfs_bmap_util.h"
  36. #include "xfs_attr.h"
  37. #include "xfs_attr_leaf.h"
  38. #include "xfs_attr_remote.h"
  39. #include "xfs_trans_space.h"
  40. #include "xfs_trace.h"
  41. #include "xfs_cksum.h"
  42. #include "xfs_buf_item.h"
  43. #include "xfs_error.h"
  44. #define ATTR_RMTVALUE_MAPSIZE 1 /* # of map entries at once */
  45. /*
  46. * Each contiguous block has a header, so it is not just a simple attribute
  47. * length to FSB conversion.
  48. */
  49. int
  50. xfs_attr3_rmt_blocks(
  51. struct xfs_mount *mp,
  52. int attrlen)
  53. {
  54. if (xfs_sb_version_hascrc(&mp->m_sb)) {
  55. int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
  56. return (attrlen + buflen - 1) / buflen;
  57. }
  58. return XFS_B_TO_FSB(mp, attrlen);
  59. }
  60. /*
  61. * Checking of the remote attribute header is split into two parts. The verifier
  62. * does CRC, location and bounds checking, the unpacking function checks the
  63. * attribute parameters and owner.
  64. */
  65. static bool
  66. xfs_attr3_rmt_hdr_ok(
  67. void *ptr,
  68. xfs_ino_t ino,
  69. uint32_t offset,
  70. uint32_t size,
  71. xfs_daddr_t bno)
  72. {
  73. struct xfs_attr3_rmt_hdr *rmt = ptr;
  74. if (bno != be64_to_cpu(rmt->rm_blkno))
  75. return false;
  76. if (offset != be32_to_cpu(rmt->rm_offset))
  77. return false;
  78. if (size != be32_to_cpu(rmt->rm_bytes))
  79. return false;
  80. if (ino != be64_to_cpu(rmt->rm_owner))
  81. return false;
  82. /* ok */
  83. return true;
  84. }
  85. static bool
  86. xfs_attr3_rmt_verify(
  87. struct xfs_mount *mp,
  88. void *ptr,
  89. int fsbsize,
  90. xfs_daddr_t bno)
  91. {
  92. struct xfs_attr3_rmt_hdr *rmt = ptr;
  93. if (!xfs_sb_version_hascrc(&mp->m_sb))
  94. return false;
  95. if (rmt->rm_magic != cpu_to_be32(XFS_ATTR3_RMT_MAGIC))
  96. return false;
  97. if (!uuid_equal(&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid))
  98. return false;
  99. if (be64_to_cpu(rmt->rm_blkno) != bno)
  100. return false;
  101. if (be32_to_cpu(rmt->rm_bytes) > fsbsize - sizeof(*rmt))
  102. return false;
  103. if (be32_to_cpu(rmt->rm_offset) +
  104. be32_to_cpu(rmt->rm_bytes) > XFS_XATTR_SIZE_MAX)
  105. return false;
  106. if (rmt->rm_owner == 0)
  107. return false;
  108. return true;
  109. }
  110. static void
  111. xfs_attr3_rmt_read_verify(
  112. struct xfs_buf *bp)
  113. {
  114. struct xfs_mount *mp = bp->b_target->bt_mount;
  115. char *ptr;
  116. int len;
  117. xfs_daddr_t bno;
  118. int blksize = mp->m_attr_geo->blksize;
  119. /* no verification of non-crc buffers */
  120. if (!xfs_sb_version_hascrc(&mp->m_sb))
  121. return;
  122. ptr = bp->b_addr;
  123. bno = bp->b_bn;
  124. len = BBTOB(bp->b_length);
  125. ASSERT(len >= blksize);
  126. while (len > 0) {
  127. if (!xfs_verify_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF)) {
  128. xfs_buf_ioerror(bp, -EFSBADCRC);
  129. break;
  130. }
  131. if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) {
  132. xfs_buf_ioerror(bp, -EFSCORRUPTED);
  133. break;
  134. }
  135. len -= blksize;
  136. ptr += blksize;
  137. bno += BTOBB(blksize);
  138. }
  139. if (bp->b_error)
  140. xfs_verifier_error(bp);
  141. else
  142. ASSERT(len == 0);
  143. }
  144. static void
  145. xfs_attr3_rmt_write_verify(
  146. struct xfs_buf *bp)
  147. {
  148. struct xfs_mount *mp = bp->b_target->bt_mount;
  149. int blksize = mp->m_attr_geo->blksize;
  150. char *ptr;
  151. int len;
  152. xfs_daddr_t bno;
  153. /* no verification of non-crc buffers */
  154. if (!xfs_sb_version_hascrc(&mp->m_sb))
  155. return;
  156. ptr = bp->b_addr;
  157. bno = bp->b_bn;
  158. len = BBTOB(bp->b_length);
  159. ASSERT(len >= blksize);
  160. while (len > 0) {
  161. struct xfs_attr3_rmt_hdr *rmt = (struct xfs_attr3_rmt_hdr *)ptr;
  162. if (!xfs_attr3_rmt_verify(mp, ptr, blksize, bno)) {
  163. xfs_buf_ioerror(bp, -EFSCORRUPTED);
  164. xfs_verifier_error(bp);
  165. return;
  166. }
  167. /*
  168. * Ensure we aren't writing bogus LSNs to disk. See
  169. * xfs_attr3_rmt_hdr_set() for the explanation.
  170. */
  171. if (rmt->rm_lsn != cpu_to_be64(NULLCOMMITLSN)) {
  172. xfs_buf_ioerror(bp, -EFSCORRUPTED);
  173. xfs_verifier_error(bp);
  174. return;
  175. }
  176. xfs_update_cksum(ptr, blksize, XFS_ATTR3_RMT_CRC_OFF);
  177. len -= blksize;
  178. ptr += blksize;
  179. bno += BTOBB(blksize);
  180. }
  181. ASSERT(len == 0);
  182. }
  183. const struct xfs_buf_ops xfs_attr3_rmt_buf_ops = {
  184. .name = "xfs_attr3_rmt",
  185. .verify_read = xfs_attr3_rmt_read_verify,
  186. .verify_write = xfs_attr3_rmt_write_verify,
  187. };
  188. STATIC int
  189. xfs_attr3_rmt_hdr_set(
  190. struct xfs_mount *mp,
  191. void *ptr,
  192. xfs_ino_t ino,
  193. uint32_t offset,
  194. uint32_t size,
  195. xfs_daddr_t bno)
  196. {
  197. struct xfs_attr3_rmt_hdr *rmt = ptr;
  198. if (!xfs_sb_version_hascrc(&mp->m_sb))
  199. return 0;
  200. rmt->rm_magic = cpu_to_be32(XFS_ATTR3_RMT_MAGIC);
  201. rmt->rm_offset = cpu_to_be32(offset);
  202. rmt->rm_bytes = cpu_to_be32(size);
  203. uuid_copy(&rmt->rm_uuid, &mp->m_sb.sb_meta_uuid);
  204. rmt->rm_owner = cpu_to_be64(ino);
  205. rmt->rm_blkno = cpu_to_be64(bno);
  206. /*
  207. * Remote attribute blocks are written synchronously, so we don't
  208. * have an LSN that we can stamp in them that makes any sense to log
  209. * recovery. To ensure that log recovery handles overwrites of these
  210. * blocks sanely (i.e. once they've been freed and reallocated as some
  211. * other type of metadata) we need to ensure that the LSN has a value
  212. * that tells log recovery to ignore the LSN and overwrite the buffer
  213. * with whatever is in it's log. To do this, we use the magic
  214. * NULLCOMMITLSN to indicate that the LSN is invalid.
  215. */
  216. rmt->rm_lsn = cpu_to_be64(NULLCOMMITLSN);
  217. return sizeof(struct xfs_attr3_rmt_hdr);
  218. }
  219. /*
  220. * Helper functions to copy attribute data in and out of the one disk extents
  221. */
  222. STATIC int
  223. xfs_attr_rmtval_copyout(
  224. struct xfs_mount *mp,
  225. struct xfs_buf *bp,
  226. xfs_ino_t ino,
  227. int *offset,
  228. int *valuelen,
  229. __uint8_t **dst)
  230. {
  231. char *src = bp->b_addr;
  232. xfs_daddr_t bno = bp->b_bn;
  233. int len = BBTOB(bp->b_length);
  234. int blksize = mp->m_attr_geo->blksize;
  235. ASSERT(len >= blksize);
  236. while (len > 0 && *valuelen > 0) {
  237. int hdr_size = 0;
  238. int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, blksize);
  239. byte_cnt = min(*valuelen, byte_cnt);
  240. if (xfs_sb_version_hascrc(&mp->m_sb)) {
  241. if (!xfs_attr3_rmt_hdr_ok(src, ino, *offset,
  242. byte_cnt, bno)) {
  243. xfs_alert(mp,
  244. "remote attribute header mismatch bno/off/len/owner (0x%llx/0x%x/Ox%x/0x%llx)",
  245. bno, *offset, byte_cnt, ino);
  246. return -EFSCORRUPTED;
  247. }
  248. hdr_size = sizeof(struct xfs_attr3_rmt_hdr);
  249. }
  250. memcpy(*dst, src + hdr_size, byte_cnt);
  251. /* roll buffer forwards */
  252. len -= blksize;
  253. src += blksize;
  254. bno += BTOBB(blksize);
  255. /* roll attribute data forwards */
  256. *valuelen -= byte_cnt;
  257. *dst += byte_cnt;
  258. *offset += byte_cnt;
  259. }
  260. return 0;
  261. }
  262. STATIC void
  263. xfs_attr_rmtval_copyin(
  264. struct xfs_mount *mp,
  265. struct xfs_buf *bp,
  266. xfs_ino_t ino,
  267. int *offset,
  268. int *valuelen,
  269. __uint8_t **src)
  270. {
  271. char *dst = bp->b_addr;
  272. xfs_daddr_t bno = bp->b_bn;
  273. int len = BBTOB(bp->b_length);
  274. int blksize = mp->m_attr_geo->blksize;
  275. ASSERT(len >= blksize);
  276. while (len > 0 && *valuelen > 0) {
  277. int hdr_size;
  278. int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, blksize);
  279. byte_cnt = min(*valuelen, byte_cnt);
  280. hdr_size = xfs_attr3_rmt_hdr_set(mp, dst, ino, *offset,
  281. byte_cnt, bno);
  282. memcpy(dst + hdr_size, *src, byte_cnt);
  283. /*
  284. * If this is the last block, zero the remainder of it.
  285. * Check that we are actually the last block, too.
  286. */
  287. if (byte_cnt + hdr_size < blksize) {
  288. ASSERT(*valuelen - byte_cnt == 0);
  289. ASSERT(len == blksize);
  290. memset(dst + hdr_size + byte_cnt, 0,
  291. blksize - hdr_size - byte_cnt);
  292. }
  293. /* roll buffer forwards */
  294. len -= blksize;
  295. dst += blksize;
  296. bno += BTOBB(blksize);
  297. /* roll attribute data forwards */
  298. *valuelen -= byte_cnt;
  299. *src += byte_cnt;
  300. *offset += byte_cnt;
  301. }
  302. }
  303. /*
  304. * Read the value associated with an attribute from the out-of-line buffer
  305. * that we stored it in.
  306. */
  307. int
  308. xfs_attr_rmtval_get(
  309. struct xfs_da_args *args)
  310. {
  311. struct xfs_bmbt_irec map[ATTR_RMTVALUE_MAPSIZE];
  312. struct xfs_mount *mp = args->dp->i_mount;
  313. struct xfs_buf *bp;
  314. xfs_dablk_t lblkno = args->rmtblkno;
  315. __uint8_t *dst = args->value;
  316. int valuelen;
  317. int nmap;
  318. int error;
  319. int blkcnt = args->rmtblkcnt;
  320. int i;
  321. int offset = 0;
  322. trace_xfs_attr_rmtval_get(args);
  323. ASSERT(!(args->flags & ATTR_KERNOVAL));
  324. ASSERT(args->rmtvaluelen == args->valuelen);
  325. valuelen = args->rmtvaluelen;
  326. while (valuelen > 0) {
  327. nmap = ATTR_RMTVALUE_MAPSIZE;
  328. error = xfs_bmapi_read(args->dp, (xfs_fileoff_t)lblkno,
  329. blkcnt, map, &nmap,
  330. XFS_BMAPI_ATTRFORK);
  331. if (error)
  332. return error;
  333. ASSERT(nmap >= 1);
  334. for (i = 0; (i < nmap) && (valuelen > 0); i++) {
  335. xfs_daddr_t dblkno;
  336. int dblkcnt;
  337. ASSERT((map[i].br_startblock != DELAYSTARTBLOCK) &&
  338. (map[i].br_startblock != HOLESTARTBLOCK));
  339. dblkno = XFS_FSB_TO_DADDR(mp, map[i].br_startblock);
  340. dblkcnt = XFS_FSB_TO_BB(mp, map[i].br_blockcount);
  341. error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
  342. dblkno, dblkcnt, 0, &bp,
  343. &xfs_attr3_rmt_buf_ops);
  344. if (error)
  345. return error;
  346. error = xfs_attr_rmtval_copyout(mp, bp, args->dp->i_ino,
  347. &offset, &valuelen,
  348. &dst);
  349. xfs_buf_relse(bp);
  350. if (error)
  351. return error;
  352. /* roll attribute extent map forwards */
  353. lblkno += map[i].br_blockcount;
  354. blkcnt -= map[i].br_blockcount;
  355. }
  356. }
  357. ASSERT(valuelen == 0);
  358. return 0;
  359. }
  360. /*
  361. * Write the value associated with an attribute into the out-of-line buffer
  362. * that we have defined for it.
  363. */
  364. int
  365. xfs_attr_rmtval_set(
  366. struct xfs_da_args *args)
  367. {
  368. struct xfs_inode *dp = args->dp;
  369. struct xfs_mount *mp = dp->i_mount;
  370. struct xfs_bmbt_irec map;
  371. xfs_dablk_t lblkno;
  372. xfs_fileoff_t lfileoff = 0;
  373. __uint8_t *src = args->value;
  374. int blkcnt;
  375. int valuelen;
  376. int nmap;
  377. int error;
  378. int offset = 0;
  379. trace_xfs_attr_rmtval_set(args);
  380. /*
  381. * Find a "hole" in the attribute address space large enough for
  382. * us to drop the new attribute's value into. Because CRC enable
  383. * attributes have headers, we can't just do a straight byte to FSB
  384. * conversion and have to take the header space into account.
  385. */
  386. blkcnt = xfs_attr3_rmt_blocks(mp, args->rmtvaluelen);
  387. error = xfs_bmap_first_unused(args->trans, args->dp, blkcnt, &lfileoff,
  388. XFS_ATTR_FORK);
  389. if (error)
  390. return error;
  391. args->rmtblkno = lblkno = (xfs_dablk_t)lfileoff;
  392. args->rmtblkcnt = blkcnt;
  393. /*
  394. * Roll through the "value", allocating blocks on disk as required.
  395. */
  396. while (blkcnt > 0) {
  397. /*
  398. * Allocate a single extent, up to the size of the value.
  399. *
  400. * Note that we have to consider this a data allocation as we
  401. * write the remote attribute without logging the contents.
  402. * Hence we must ensure that we aren't using blocks that are on
  403. * the busy list so that we don't overwrite blocks which have
  404. * recently been freed but their transactions are not yet
  405. * committed to disk. If we overwrite the contents of a busy
  406. * extent and then crash then the block may not contain the
  407. * correct metadata after log recovery occurs.
  408. */
  409. xfs_defer_init(args->dfops, args->firstblock);
  410. nmap = 1;
  411. error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
  412. blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
  413. args->total, &map, &nmap, args->dfops);
  414. if (!error)
  415. error = xfs_defer_finish(&args->trans, args->dfops, dp);
  416. if (error) {
  417. args->trans = NULL;
  418. xfs_defer_cancel(args->dfops);
  419. return error;
  420. }
  421. ASSERT(nmap == 1);
  422. ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
  423. (map.br_startblock != HOLESTARTBLOCK));
  424. lblkno += map.br_blockcount;
  425. blkcnt -= map.br_blockcount;
  426. /*
  427. * Start the next trans in the chain.
  428. */
  429. error = xfs_trans_roll(&args->trans, dp);
  430. if (error)
  431. return error;
  432. }
  433. /*
  434. * Roll through the "value", copying the attribute value to the
  435. * already-allocated blocks. Blocks are written synchronously
  436. * so that we can know they are all on disk before we turn off
  437. * the INCOMPLETE flag.
  438. */
  439. lblkno = args->rmtblkno;
  440. blkcnt = args->rmtblkcnt;
  441. valuelen = args->rmtvaluelen;
  442. while (valuelen > 0) {
  443. struct xfs_buf *bp;
  444. xfs_daddr_t dblkno;
  445. int dblkcnt;
  446. ASSERT(blkcnt > 0);
  447. xfs_defer_init(args->dfops, args->firstblock);
  448. nmap = 1;
  449. error = xfs_bmapi_read(dp, (xfs_fileoff_t)lblkno,
  450. blkcnt, &map, &nmap,
  451. XFS_BMAPI_ATTRFORK);
  452. if (error)
  453. return error;
  454. ASSERT(nmap == 1);
  455. ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
  456. (map.br_startblock != HOLESTARTBLOCK));
  457. dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
  458. dblkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
  459. bp = xfs_buf_get(mp->m_ddev_targp, dblkno, dblkcnt, 0);
  460. if (!bp)
  461. return -ENOMEM;
  462. bp->b_ops = &xfs_attr3_rmt_buf_ops;
  463. xfs_attr_rmtval_copyin(mp, bp, args->dp->i_ino, &offset,
  464. &valuelen, &src);
  465. error = xfs_bwrite(bp); /* GROT: NOTE: synchronous write */
  466. xfs_buf_relse(bp);
  467. if (error)
  468. return error;
  469. /* roll attribute extent map forwards */
  470. lblkno += map.br_blockcount;
  471. blkcnt -= map.br_blockcount;
  472. }
  473. ASSERT(valuelen == 0);
  474. return 0;
  475. }
  476. /*
  477. * Remove the value associated with an attribute by deleting the
  478. * out-of-line buffer that it is stored on.
  479. */
  480. int
  481. xfs_attr_rmtval_remove(
  482. struct xfs_da_args *args)
  483. {
  484. struct xfs_mount *mp = args->dp->i_mount;
  485. xfs_dablk_t lblkno;
  486. int blkcnt;
  487. int error;
  488. int done;
  489. trace_xfs_attr_rmtval_remove(args);
  490. /*
  491. * Roll through the "value", invalidating the attribute value's blocks.
  492. */
  493. lblkno = args->rmtblkno;
  494. blkcnt = args->rmtblkcnt;
  495. while (blkcnt > 0) {
  496. struct xfs_bmbt_irec map;
  497. struct xfs_buf *bp;
  498. xfs_daddr_t dblkno;
  499. int dblkcnt;
  500. int nmap;
  501. /*
  502. * Try to remember where we decided to put the value.
  503. */
  504. nmap = 1;
  505. error = xfs_bmapi_read(args->dp, (xfs_fileoff_t)lblkno,
  506. blkcnt, &map, &nmap, XFS_BMAPI_ATTRFORK);
  507. if (error)
  508. return error;
  509. ASSERT(nmap == 1);
  510. ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
  511. (map.br_startblock != HOLESTARTBLOCK));
  512. dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
  513. dblkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
  514. /*
  515. * If the "remote" value is in the cache, remove it.
  516. */
  517. bp = xfs_incore(mp->m_ddev_targp, dblkno, dblkcnt, XBF_TRYLOCK);
  518. if (bp) {
  519. xfs_buf_stale(bp);
  520. xfs_buf_relse(bp);
  521. bp = NULL;
  522. }
  523. lblkno += map.br_blockcount;
  524. blkcnt -= map.br_blockcount;
  525. }
  526. /*
  527. * Keep de-allocating extents until the remote-value region is gone.
  528. */
  529. lblkno = args->rmtblkno;
  530. blkcnt = args->rmtblkcnt;
  531. done = 0;
  532. while (!done) {
  533. xfs_defer_init(args->dfops, args->firstblock);
  534. error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
  535. XFS_BMAPI_ATTRFORK, 1, args->firstblock,
  536. args->dfops, &done);
  537. if (!error)
  538. error = xfs_defer_finish(&args->trans, args->dfops,
  539. args->dp);
  540. if (error) {
  541. args->trans = NULL;
  542. xfs_defer_cancel(args->dfops);
  543. return error;
  544. }
  545. /*
  546. * Close out trans and start the next one in the chain.
  547. */
  548. error = xfs_trans_roll(&args->trans, args->dp);
  549. if (error)
  550. return error;
  551. }
  552. return 0;
  553. }