xfs_rename.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it would be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write the Free Software Foundation,
  16. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include "xfs.h"
  19. #include "xfs_fs.h"
  20. #include "xfs_types.h"
  21. #include "xfs_log.h"
  22. #include "xfs_inum.h"
  23. #include "xfs_trans.h"
  24. #include "xfs_sb.h"
  25. #include "xfs_dir.h"
  26. #include "xfs_dir2.h"
  27. #include "xfs_dmapi.h"
  28. #include "xfs_mount.h"
  29. #include "xfs_da_btree.h"
  30. #include "xfs_bmap_btree.h"
  31. #include "xfs_dir_sf.h"
  32. #include "xfs_dir2_sf.h"
  33. #include "xfs_attr_sf.h"
  34. #include "xfs_dinode.h"
  35. #include "xfs_inode.h"
  36. #include "xfs_inode_item.h"
  37. #include "xfs_bmap.h"
  38. #include "xfs_error.h"
  39. #include "xfs_quota.h"
  40. #include "xfs_refcache.h"
  41. #include "xfs_utils.h"
  42. #include "xfs_trans_space.h"
  43. #include "xfs_dir_leaf.h"
  44. /*
  45. * Given an array of up to 4 inode pointers, unlock the pointed to inodes.
  46. * If there are fewer than 4 entries in the array, the empty entries will
  47. * be at the end and will have NULL pointers in them.
  48. */
  49. STATIC void
  50. xfs_rename_unlock4(
  51. xfs_inode_t **i_tab,
  52. uint lock_mode)
  53. {
  54. int i;
  55. xfs_iunlock(i_tab[0], lock_mode);
  56. for (i = 1; i < 4; i++) {
  57. if (i_tab[i] == NULL) {
  58. break;
  59. }
  60. /*
  61. * Watch out for duplicate entries in the table.
  62. */
  63. if (i_tab[i] != i_tab[i-1]) {
  64. xfs_iunlock(i_tab[i], lock_mode);
  65. }
  66. }
  67. }
  68. #ifdef DEBUG
  69. int xfs_rename_skip, xfs_rename_nskip;
  70. #endif
  71. /*
  72. * The following routine will acquire the locks required for a rename
  73. * operation. The code understands the semantics of renames and will
  74. * validate that name1 exists under dp1 & that name2 may or may not
  75. * exist under dp2.
  76. *
  77. * We are renaming dp1/name1 to dp2/name2.
  78. *
  79. * Return ENOENT if dp1 does not exist, other lookup errors, or 0 for success.
  80. */
  81. STATIC int
  82. xfs_lock_for_rename(
  83. xfs_inode_t *dp1, /* old (source) directory inode */
  84. xfs_inode_t *dp2, /* new (target) directory inode */
  85. vname_t *vname1,/* old entry name */
  86. vname_t *vname2,/* new entry name */
  87. xfs_inode_t **ipp1, /* inode of old entry */
  88. xfs_inode_t **ipp2, /* inode of new entry, if it
  89. already exists, NULL otherwise. */
  90. xfs_inode_t **i_tab,/* array of inode returned, sorted */
  91. int *num_inodes) /* number of inodes in array */
  92. {
  93. xfs_inode_t *ip1, *ip2, *temp;
  94. xfs_ino_t inum1, inum2;
  95. int error;
  96. int i, j;
  97. uint lock_mode;
  98. int diff_dirs = (dp1 != dp2);
  99. ip2 = NULL;
  100. /*
  101. * First, find out the current inums of the entries so that we
  102. * can determine the initial locking order. We'll have to
  103. * sanity check stuff after all the locks have been acquired
  104. * to see if we still have the right inodes, directories, etc.
  105. */
  106. lock_mode = xfs_ilock_map_shared(dp1);
  107. error = xfs_get_dir_entry(vname1, &ip1);
  108. if (error) {
  109. xfs_iunlock_map_shared(dp1, lock_mode);
  110. return error;
  111. }
  112. inum1 = ip1->i_ino;
  113. ASSERT(ip1);
  114. ITRACE(ip1);
  115. /*
  116. * Unlock dp1 and lock dp2 if they are different.
  117. */
  118. if (diff_dirs) {
  119. xfs_iunlock_map_shared(dp1, lock_mode);
  120. lock_mode = xfs_ilock_map_shared(dp2);
  121. }
  122. error = xfs_dir_lookup_int(XFS_ITOBHV(dp2), lock_mode,
  123. vname2, &inum2, &ip2);
  124. if (error == ENOENT) { /* target does not need to exist. */
  125. inum2 = 0;
  126. } else if (error) {
  127. /*
  128. * If dp2 and dp1 are the same, the next line unlocks dp1.
  129. * Got it?
  130. */
  131. xfs_iunlock_map_shared(dp2, lock_mode);
  132. IRELE (ip1);
  133. return error;
  134. } else {
  135. ITRACE(ip2);
  136. }
  137. /*
  138. * i_tab contains a list of pointers to inodes. We initialize
  139. * the table here & we'll sort it. We will then use it to
  140. * order the acquisition of the inode locks.
  141. *
  142. * Note that the table may contain duplicates. e.g., dp1 == dp2.
  143. */
  144. i_tab[0] = dp1;
  145. i_tab[1] = dp2;
  146. i_tab[2] = ip1;
  147. if (inum2 == 0) {
  148. *num_inodes = 3;
  149. i_tab[3] = NULL;
  150. } else {
  151. *num_inodes = 4;
  152. i_tab[3] = ip2;
  153. }
  154. /*
  155. * Sort the elements via bubble sort. (Remember, there are at
  156. * most 4 elements to sort, so this is adequate.)
  157. */
  158. for (i=0; i < *num_inodes; i++) {
  159. for (j=1; j < *num_inodes; j++) {
  160. if (i_tab[j]->i_ino < i_tab[j-1]->i_ino) {
  161. temp = i_tab[j];
  162. i_tab[j] = i_tab[j-1];
  163. i_tab[j-1] = temp;
  164. }
  165. }
  166. }
  167. /*
  168. * We have dp2 locked. If it isn't first, unlock it.
  169. * If it is first, tell xfs_lock_inodes so it can skip it
  170. * when locking. if dp1 == dp2, xfs_lock_inodes will skip both
  171. * since they are equal. xfs_lock_inodes needs all these inodes
  172. * so that it can unlock and retry if there might be a dead-lock
  173. * potential with the log.
  174. */
  175. if (i_tab[0] == dp2 && lock_mode == XFS_ILOCK_SHARED) {
  176. #ifdef DEBUG
  177. xfs_rename_skip++;
  178. #endif
  179. xfs_lock_inodes(i_tab, *num_inodes, 1, XFS_ILOCK_SHARED);
  180. } else {
  181. #ifdef DEBUG
  182. xfs_rename_nskip++;
  183. #endif
  184. xfs_iunlock_map_shared(dp2, lock_mode);
  185. xfs_lock_inodes(i_tab, *num_inodes, 0, XFS_ILOCK_SHARED);
  186. }
  187. /*
  188. * Set the return value. Null out any unused entries in i_tab.
  189. */
  190. *ipp1 = *ipp2 = NULL;
  191. for (i=0; i < *num_inodes; i++) {
  192. if (i_tab[i]->i_ino == inum1) {
  193. *ipp1 = i_tab[i];
  194. }
  195. if (i_tab[i]->i_ino == inum2) {
  196. *ipp2 = i_tab[i];
  197. }
  198. }
  199. for (;i < 4; i++) {
  200. i_tab[i] = NULL;
  201. }
  202. return 0;
  203. }
  204. /*
  205. * xfs_rename
  206. */
  207. int
  208. xfs_rename(
  209. bhv_desc_t *src_dir_bdp,
  210. vname_t *src_vname,
  211. vnode_t *target_dir_vp,
  212. vname_t *target_vname,
  213. cred_t *credp)
  214. {
  215. xfs_trans_t *tp;
  216. xfs_inode_t *src_dp, *target_dp, *src_ip, *target_ip;
  217. xfs_mount_t *mp;
  218. int new_parent; /* moving to a new dir */
  219. int src_is_directory; /* src_name is a directory */
  220. int error;
  221. xfs_bmap_free_t free_list;
  222. xfs_fsblock_t first_block;
  223. int cancel_flags;
  224. int committed;
  225. xfs_inode_t *inodes[4];
  226. int target_ip_dropped = 0; /* dropped target_ip link? */
  227. vnode_t *src_dir_vp;
  228. bhv_desc_t *target_dir_bdp;
  229. int spaceres;
  230. int target_link_zero = 0;
  231. int num_inodes;
  232. char *src_name = VNAME(src_vname);
  233. char *target_name = VNAME(target_vname);
  234. int src_namelen = VNAMELEN(src_vname);
  235. int target_namelen = VNAMELEN(target_vname);
  236. src_dir_vp = BHV_TO_VNODE(src_dir_bdp);
  237. vn_trace_entry(src_dir_vp, "xfs_rename", (inst_t *)__return_address);
  238. vn_trace_entry(target_dir_vp, "xfs_rename", (inst_t *)__return_address);
  239. /*
  240. * Find the XFS behavior descriptor for the target directory
  241. * vnode since it was not handed to us.
  242. */
  243. target_dir_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(target_dir_vp),
  244. &xfs_vnodeops);
  245. if (target_dir_bdp == NULL) {
  246. return XFS_ERROR(EXDEV);
  247. }
  248. src_dp = XFS_BHVTOI(src_dir_bdp);
  249. target_dp = XFS_BHVTOI(target_dir_bdp);
  250. mp = src_dp->i_mount;
  251. if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_RENAME) ||
  252. DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
  253. target_dp, DM_EVENT_RENAME)) {
  254. error = XFS_SEND_NAMESP(mp, DM_EVENT_RENAME,
  255. src_dir_vp, DM_RIGHT_NULL,
  256. target_dir_vp, DM_RIGHT_NULL,
  257. src_name, target_name,
  258. 0, 0, 0);
  259. if (error) {
  260. return error;
  261. }
  262. }
  263. /* Return through std_return after this point. */
  264. /*
  265. * Lock all the participating inodes. Depending upon whether
  266. * the target_name exists in the target directory, and
  267. * whether the target directory is the same as the source
  268. * directory, we can lock from 2 to 4 inodes.
  269. * xfs_lock_for_rename() will return ENOENT if src_name
  270. * does not exist in the source directory.
  271. */
  272. tp = NULL;
  273. error = xfs_lock_for_rename(src_dp, target_dp, src_vname,
  274. target_vname, &src_ip, &target_ip, inodes,
  275. &num_inodes);
  276. if (error) {
  277. /*
  278. * We have nothing locked, no inode references, and
  279. * no transaction, so just get out.
  280. */
  281. goto std_return;
  282. }
  283. ASSERT(src_ip != NULL);
  284. if ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
  285. /*
  286. * Check for link count overflow on target_dp
  287. */
  288. if (target_ip == NULL && (src_dp != target_dp) &&
  289. target_dp->i_d.di_nlink >= XFS_MAXLINK) {
  290. error = XFS_ERROR(EMLINK);
  291. xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
  292. goto rele_return;
  293. }
  294. }
  295. new_parent = (src_dp != target_dp);
  296. src_is_directory = ((src_ip->i_d.di_mode & S_IFMT) == S_IFDIR);
  297. /*
  298. * Drop the locks on our inodes so that we can start the transaction.
  299. */
  300. xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED);
  301. XFS_BMAP_INIT(&free_list, &first_block);
  302. tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME);
  303. cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
  304. spaceres = XFS_RENAME_SPACE_RES(mp, target_namelen);
  305. error = xfs_trans_reserve(tp, spaceres, XFS_RENAME_LOG_RES(mp), 0,
  306. XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT);
  307. if (error == ENOSPC) {
  308. spaceres = 0;
  309. error = xfs_trans_reserve(tp, 0, XFS_RENAME_LOG_RES(mp), 0,
  310. XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT);
  311. }
  312. if (error) {
  313. xfs_trans_cancel(tp, 0);
  314. goto rele_return;
  315. }
  316. /*
  317. * Attach the dquots to the inodes
  318. */
  319. if ((error = XFS_QM_DQVOPRENAME(mp, inodes))) {
  320. xfs_trans_cancel(tp, cancel_flags);
  321. goto rele_return;
  322. }
  323. /*
  324. * Reacquire the inode locks we dropped above.
  325. */
  326. xfs_lock_inodes(inodes, num_inodes, 0, XFS_ILOCK_EXCL);
  327. /*
  328. * Join all the inodes to the transaction. From this point on,
  329. * we can rely on either trans_commit or trans_cancel to unlock
  330. * them. Note that we need to add a vnode reference to the
  331. * directories since trans_commit & trans_cancel will decrement
  332. * them when they unlock the inodes. Also, we need to be careful
  333. * not to add an inode to the transaction more than once.
  334. */
  335. VN_HOLD(src_dir_vp);
  336. xfs_trans_ijoin(tp, src_dp, XFS_ILOCK_EXCL);
  337. if (new_parent) {
  338. VN_HOLD(target_dir_vp);
  339. xfs_trans_ijoin(tp, target_dp, XFS_ILOCK_EXCL);
  340. }
  341. if ((src_ip != src_dp) && (src_ip != target_dp)) {
  342. xfs_trans_ijoin(tp, src_ip, XFS_ILOCK_EXCL);
  343. }
  344. if ((target_ip != NULL) &&
  345. (target_ip != src_ip) &&
  346. (target_ip != src_dp) &&
  347. (target_ip != target_dp)) {
  348. xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL);
  349. }
  350. /*
  351. * Set up the target.
  352. */
  353. if (target_ip == NULL) {
  354. /*
  355. * If there's no space reservation, check the entry will
  356. * fit before actually inserting it.
  357. */
  358. if (spaceres == 0 &&
  359. (error = XFS_DIR_CANENTER(mp, tp, target_dp, target_name,
  360. target_namelen))) {
  361. goto error_return;
  362. }
  363. /*
  364. * If target does not exist and the rename crosses
  365. * directories, adjust the target directory link count
  366. * to account for the ".." reference from the new entry.
  367. */
  368. error = XFS_DIR_CREATENAME(mp, tp, target_dp, target_name,
  369. target_namelen, src_ip->i_ino,
  370. &first_block, &free_list, spaceres);
  371. if (error == ENOSPC) {
  372. goto error_return;
  373. }
  374. if (error) {
  375. goto abort_return;
  376. }
  377. xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
  378. if (new_parent && src_is_directory) {
  379. error = xfs_bumplink(tp, target_dp);
  380. if (error) {
  381. goto abort_return;
  382. }
  383. }
  384. } else { /* target_ip != NULL */
  385. /*
  386. * If target exists and it's a directory, check that both
  387. * target and source are directories and that target can be
  388. * destroyed, or that neither is a directory.
  389. */
  390. if ((target_ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
  391. /*
  392. * Make sure target dir is empty.
  393. */
  394. if (!(XFS_DIR_ISEMPTY(target_ip->i_mount, target_ip)) ||
  395. (target_ip->i_d.di_nlink > 2)) {
  396. error = XFS_ERROR(EEXIST);
  397. goto error_return;
  398. }
  399. }
  400. /*
  401. * Link the source inode under the target name.
  402. * If the source inode is a directory and we are moving
  403. * it across directories, its ".." entry will be
  404. * inconsistent until we replace that down below.
  405. *
  406. * In case there is already an entry with the same
  407. * name at the destination directory, remove it first.
  408. */
  409. error = XFS_DIR_REPLACE(mp, tp, target_dp, target_name,
  410. target_namelen, src_ip->i_ino, &first_block,
  411. &free_list, spaceres);
  412. if (error) {
  413. goto abort_return;
  414. }
  415. xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
  416. /*
  417. * Decrement the link count on the target since the target
  418. * dir no longer points to it.
  419. */
  420. error = xfs_droplink(tp, target_ip);
  421. if (error) {
  422. goto abort_return;
  423. }
  424. target_ip_dropped = 1;
  425. if (src_is_directory) {
  426. /*
  427. * Drop the link from the old "." entry.
  428. */
  429. error = xfs_droplink(tp, target_ip);
  430. if (error) {
  431. goto abort_return;
  432. }
  433. }
  434. /* Do this test while we still hold the locks */
  435. target_link_zero = (target_ip)->i_d.di_nlink==0;
  436. } /* target_ip != NULL */
  437. /*
  438. * Remove the source.
  439. */
  440. if (new_parent && src_is_directory) {
  441. /*
  442. * Rewrite the ".." entry to point to the new
  443. * directory.
  444. */
  445. error = XFS_DIR_REPLACE(mp, tp, src_ip, "..", 2,
  446. target_dp->i_ino, &first_block,
  447. &free_list, spaceres);
  448. ASSERT(error != EEXIST);
  449. if (error) {
  450. goto abort_return;
  451. }
  452. xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
  453. } else {
  454. /*
  455. * We always want to hit the ctime on the source inode.
  456. * We do it in the if clause above for the 'new_parent &&
  457. * src_is_directory' case, and here we get all the other
  458. * cases. This isn't strictly required by the standards
  459. * since the source inode isn't really being changed,
  460. * but old unix file systems did it and some incremental
  461. * backup programs won't work without it.
  462. */
  463. xfs_ichgtime(src_ip, XFS_ICHGTIME_CHG);
  464. }
  465. /*
  466. * Adjust the link count on src_dp. This is necessary when
  467. * renaming a directory, either within one parent when
  468. * the target existed, or across two parent directories.
  469. */
  470. if (src_is_directory && (new_parent || target_ip != NULL)) {
  471. /*
  472. * Decrement link count on src_directory since the
  473. * entry that's moved no longer points to it.
  474. */
  475. error = xfs_droplink(tp, src_dp);
  476. if (error) {
  477. goto abort_return;
  478. }
  479. }
  480. error = XFS_DIR_REMOVENAME(mp, tp, src_dp, src_name, src_namelen,
  481. src_ip->i_ino, &first_block, &free_list, spaceres);
  482. if (error) {
  483. goto abort_return;
  484. }
  485. xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
  486. /*
  487. * Update the generation counts on all the directory inodes
  488. * that we're modifying.
  489. */
  490. src_dp->i_gen++;
  491. xfs_trans_log_inode(tp, src_dp, XFS_ILOG_CORE);
  492. if (new_parent) {
  493. target_dp->i_gen++;
  494. xfs_trans_log_inode(tp, target_dp, XFS_ILOG_CORE);
  495. }
  496. /*
  497. * If there was a target inode, take an extra reference on
  498. * it here so that it doesn't go to xfs_inactive() from
  499. * within the commit.
  500. */
  501. if (target_ip != NULL) {
  502. IHOLD(target_ip);
  503. }
  504. /*
  505. * If this is a synchronous mount, make sure that the
  506. * rename transaction goes to disk before returning to
  507. * the user.
  508. */
  509. if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
  510. xfs_trans_set_sync(tp);
  511. }
  512. /*
  513. * Take refs. for vop_link_removed calls below. No need to worry
  514. * about directory refs. because the caller holds them.
  515. *
  516. * Do holds before the xfs_bmap_finish since it might rele them down
  517. * to zero.
  518. */
  519. if (target_ip_dropped)
  520. IHOLD(target_ip);
  521. IHOLD(src_ip);
  522. error = xfs_bmap_finish(&tp, &free_list, first_block, &committed);
  523. if (error) {
  524. xfs_bmap_cancel(&free_list);
  525. xfs_trans_cancel(tp, (XFS_TRANS_RELEASE_LOG_RES |
  526. XFS_TRANS_ABORT));
  527. if (target_ip != NULL) {
  528. IRELE(target_ip);
  529. }
  530. if (target_ip_dropped) {
  531. IRELE(target_ip);
  532. }
  533. IRELE(src_ip);
  534. goto std_return;
  535. }
  536. /*
  537. * trans_commit will unlock src_ip, target_ip & decrement
  538. * the vnode references.
  539. */
  540. error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL);
  541. if (target_ip != NULL) {
  542. xfs_refcache_purge_ip(target_ip);
  543. IRELE(target_ip);
  544. }
  545. /*
  546. * Let interposed file systems know about removed links.
  547. */
  548. if (target_ip_dropped) {
  549. VOP_LINK_REMOVED(XFS_ITOV(target_ip), target_dir_vp,
  550. target_link_zero);
  551. IRELE(target_ip);
  552. }
  553. IRELE(src_ip);
  554. /* Fall through to std_return with error = 0 or errno from
  555. * xfs_trans_commit */
  556. std_return:
  557. if (DM_EVENT_ENABLED(src_dir_vp->v_vfsp, src_dp, DM_EVENT_POSTRENAME) ||
  558. DM_EVENT_ENABLED(target_dir_vp->v_vfsp,
  559. target_dp, DM_EVENT_POSTRENAME)) {
  560. (void) XFS_SEND_NAMESP (mp, DM_EVENT_POSTRENAME,
  561. src_dir_vp, DM_RIGHT_NULL,
  562. target_dir_vp, DM_RIGHT_NULL,
  563. src_name, target_name,
  564. 0, error, 0);
  565. }
  566. return error;
  567. abort_return:
  568. cancel_flags |= XFS_TRANS_ABORT;
  569. /* FALLTHROUGH */
  570. error_return:
  571. xfs_bmap_cancel(&free_list);
  572. xfs_trans_cancel(tp, cancel_flags);
  573. goto std_return;
  574. rele_return:
  575. IRELE(src_ip);
  576. if (target_ip != NULL) {
  577. IRELE(target_ip);
  578. }
  579. goto std_return;
  580. }