util.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  4. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
  5. */
  6. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  7. #include <linux/spinlock.h>
  8. #include <linux/completion.h>
  9. #include <linux/buffer_head.h>
  10. #include <linux/crc32.h>
  11. #include <linux/gfs2_ondisk.h>
  12. #include <linux/delay.h>
  13. #include <linux/uaccess.h>
  14. #include "gfs2.h"
  15. #include "incore.h"
  16. #include "glock.h"
  17. #include "glops.h"
  18. #include "log.h"
  19. #include "lops.h"
  20. #include "recovery.h"
  21. #include "rgrp.h"
  22. #include "super.h"
  23. #include "util.h"
  24. struct kmem_cache *gfs2_glock_cachep __read_mostly;
  25. struct kmem_cache *gfs2_glock_aspace_cachep __read_mostly;
  26. struct kmem_cache *gfs2_inode_cachep __read_mostly;
  27. struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
  28. struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
  29. struct kmem_cache *gfs2_quotad_cachep __read_mostly;
  30. struct kmem_cache *gfs2_qadata_cachep __read_mostly;
  31. struct kmem_cache *gfs2_trans_cachep __read_mostly;
  32. mempool_t *gfs2_page_pool __read_mostly;
  33. void gfs2_assert_i(struct gfs2_sbd *sdp)
  34. {
  35. fs_emerg(sdp, "fatal assertion failed\n");
  36. }
  37. /**
  38. * check_journal_clean - Make sure a journal is clean for a spectator mount
  39. * @sdp: The GFS2 superblock
  40. * @jd: The journal descriptor
  41. * @verbose: Show more prints in the log
  42. *
  43. * Returns: 0 if the journal is clean or locked, else an error
  44. */
  45. int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
  46. bool verbose)
  47. {
  48. int error;
  49. struct gfs2_holder j_gh;
  50. struct gfs2_log_header_host head;
  51. struct gfs2_inode *ip;
  52. ip = GFS2_I(jd->jd_inode);
  53. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_NOEXP |
  54. GL_EXACT | GL_NOCACHE, &j_gh);
  55. if (error) {
  56. if (verbose)
  57. fs_err(sdp, "Error %d locking journal for spectator "
  58. "mount.\n", error);
  59. return -EPERM;
  60. }
  61. error = gfs2_jdesc_check(jd);
  62. if (error) {
  63. if (verbose)
  64. fs_err(sdp, "Error checking journal for spectator "
  65. "mount.\n");
  66. goto out_unlock;
  67. }
  68. error = gfs2_find_jhead(jd, &head, false);
  69. if (error) {
  70. if (verbose)
  71. fs_err(sdp, "Error parsing journal for spectator "
  72. "mount.\n");
  73. goto out_unlock;
  74. }
  75. if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
  76. error = -EPERM;
  77. if (verbose)
  78. fs_err(sdp, "jid=%u: Journal is dirty, so the first "
  79. "mounter must not be a spectator.\n",
  80. jd->jd_jid);
  81. }
  82. out_unlock:
  83. gfs2_glock_dq_uninit(&j_gh);
  84. return error;
  85. }
  86. /**
  87. * gfs2_freeze_lock - hold the freeze glock
  88. * @sdp: the superblock
  89. * @freeze_gh: pointer to the requested holder
  90. * @caller_flags: any additional flags needed by the caller
  91. */
  92. int gfs2_freeze_lock(struct gfs2_sbd *sdp, struct gfs2_holder *freeze_gh,
  93. int caller_flags)
  94. {
  95. int flags = LM_FLAG_NOEXP | GL_EXACT | caller_flags;
  96. int error;
  97. error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, flags,
  98. freeze_gh);
  99. if (error && error != GLR_TRYFAILED)
  100. fs_err(sdp, "can't lock the freeze lock: %d\n", error);
  101. return error;
  102. }
  103. void gfs2_freeze_unlock(struct gfs2_holder *freeze_gh)
  104. {
  105. if (gfs2_holder_initialized(freeze_gh))
  106. gfs2_glock_dq_uninit(freeze_gh);
  107. }
  108. static void signal_our_withdraw(struct gfs2_sbd *sdp)
  109. {
  110. struct gfs2_glock *live_gl = sdp->sd_live_gh.gh_gl;
  111. struct inode *inode;
  112. struct gfs2_inode *ip;
  113. struct gfs2_glock *i_gl;
  114. u64 no_formal_ino;
  115. int log_write_allowed = test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
  116. int ret = 0;
  117. int tries;
  118. if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
  119. return;
  120. gfs2_ail_drain(sdp); /* frees all transactions */
  121. inode = sdp->sd_jdesc->jd_inode;
  122. ip = GFS2_I(inode);
  123. i_gl = ip->i_gl;
  124. no_formal_ino = ip->i_no_formal_ino;
  125. /* Prevent any glock dq until withdraw recovery is complete */
  126. set_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
  127. /*
  128. * Don't tell dlm we're bailing until we have no more buffers in the
  129. * wind. If journal had an IO error, the log code should just purge
  130. * the outstanding buffers rather than submitting new IO. Making the
  131. * file system read-only will flush the journal, etc.
  132. *
  133. * During a normal unmount, gfs2_make_fs_ro calls gfs2_log_shutdown
  134. * which clears SDF_JOURNAL_LIVE. In a withdraw, we must not write
  135. * any UNMOUNT log header, so we can't call gfs2_log_shutdown, and
  136. * therefore we need to clear SDF_JOURNAL_LIVE manually.
  137. */
  138. clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
  139. if (!sb_rdonly(sdp->sd_vfs)) {
  140. struct gfs2_holder freeze_gh;
  141. gfs2_holder_mark_uninitialized(&freeze_gh);
  142. if (sdp->sd_freeze_gl &&
  143. !gfs2_glock_is_locked_by_me(sdp->sd_freeze_gl)) {
  144. ret = gfs2_freeze_lock(sdp, &freeze_gh,
  145. log_write_allowed ? 0 : LM_FLAG_TRY);
  146. if (ret == GLR_TRYFAILED)
  147. ret = 0;
  148. }
  149. if (!ret)
  150. gfs2_make_fs_ro(sdp);
  151. /*
  152. * Dequeue any pending non-system glock holders that can no
  153. * longer be granted because the file system is withdrawn.
  154. */
  155. gfs2_gl_dq_holders(sdp);
  156. gfs2_freeze_unlock(&freeze_gh);
  157. }
  158. if (sdp->sd_lockstruct.ls_ops->lm_lock == NULL) { /* lock_nolock */
  159. if (!ret)
  160. ret = -EIO;
  161. clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
  162. goto skip_recovery;
  163. }
  164. /*
  165. * Drop the glock for our journal so another node can recover it.
  166. */
  167. if (gfs2_holder_initialized(&sdp->sd_journal_gh)) {
  168. gfs2_glock_dq_wait(&sdp->sd_journal_gh);
  169. gfs2_holder_uninit(&sdp->sd_journal_gh);
  170. }
  171. sdp->sd_jinode_gh.gh_flags |= GL_NOCACHE;
  172. gfs2_glock_dq(&sdp->sd_jinode_gh);
  173. if (test_bit(SDF_FS_FROZEN, &sdp->sd_flags)) {
  174. /* Make sure gfs2_unfreeze works if partially-frozen */
  175. flush_work(&sdp->sd_freeze_work);
  176. atomic_set(&sdp->sd_freeze_state, SFS_FROZEN);
  177. thaw_super(sdp->sd_vfs);
  178. } else {
  179. wait_on_bit(&i_gl->gl_flags, GLF_DEMOTE,
  180. TASK_UNINTERRUPTIBLE);
  181. }
  182. /*
  183. * holder_uninit to force glock_put, to force dlm to let go
  184. */
  185. gfs2_holder_uninit(&sdp->sd_jinode_gh);
  186. /*
  187. * Note: We need to be careful here:
  188. * Our iput of jd_inode will evict it. The evict will dequeue its
  189. * glock, but the glock dq will wait for the withdraw unless we have
  190. * exception code in glock_dq.
  191. */
  192. iput(inode);
  193. sdp->sd_jdesc->jd_inode = NULL;
  194. /*
  195. * Wait until the journal inode's glock is freed. This allows try locks
  196. * on other nodes to be successful, otherwise we remain the owner of
  197. * the glock as far as dlm is concerned.
  198. */
  199. if (i_gl->gl_ops->go_free) {
  200. set_bit(GLF_FREEING, &i_gl->gl_flags);
  201. wait_on_bit(&i_gl->gl_flags, GLF_FREEING, TASK_UNINTERRUPTIBLE);
  202. }
  203. /*
  204. * Dequeue the "live" glock, but keep a reference so it's never freed.
  205. */
  206. gfs2_glock_hold(live_gl);
  207. gfs2_glock_dq_wait(&sdp->sd_live_gh);
  208. /*
  209. * We enqueue the "live" glock in EX so that all other nodes
  210. * get a demote request and act on it. We don't really want the
  211. * lock in EX, so we send a "try" lock with 1CB to produce a callback.
  212. */
  213. fs_warn(sdp, "Requesting recovery of jid %d.\n",
  214. sdp->sd_lockstruct.ls_jid);
  215. gfs2_holder_reinit(LM_ST_EXCLUSIVE,
  216. LM_FLAG_TRY_1CB | LM_FLAG_NOEXP | GL_NOPID,
  217. &sdp->sd_live_gh);
  218. msleep(GL_GLOCK_MAX_HOLD);
  219. /*
  220. * This will likely fail in a cluster, but succeed standalone:
  221. */
  222. ret = gfs2_glock_nq(&sdp->sd_live_gh);
  223. /*
  224. * If we actually got the "live" lock in EX mode, there are no other
  225. * nodes available to replay our journal. So we try to replay it
  226. * ourselves. We hold the "live" glock to prevent other mounters
  227. * during recovery, then just dequeue it and reacquire it in our
  228. * normal SH mode. Just in case the problem that caused us to
  229. * withdraw prevents us from recovering our journal (e.g. io errors
  230. * and such) we still check if the journal is clean before proceeding
  231. * but we may wait forever until another mounter does the recovery.
  232. */
  233. if (ret == 0) {
  234. fs_warn(sdp, "No other mounters found. Trying to recover our "
  235. "own journal jid %d.\n", sdp->sd_lockstruct.ls_jid);
  236. if (gfs2_recover_journal(sdp->sd_jdesc, 1))
  237. fs_warn(sdp, "Unable to recover our journal jid %d.\n",
  238. sdp->sd_lockstruct.ls_jid);
  239. gfs2_glock_dq_wait(&sdp->sd_live_gh);
  240. gfs2_holder_reinit(LM_ST_SHARED,
  241. LM_FLAG_NOEXP | GL_EXACT | GL_NOPID,
  242. &sdp->sd_live_gh);
  243. gfs2_glock_nq(&sdp->sd_live_gh);
  244. }
  245. gfs2_glock_queue_put(live_gl); /* drop extra reference we acquired */
  246. clear_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags);
  247. /*
  248. * At this point our journal is evicted, so we need to get a new inode
  249. * for it. Once done, we need to call gfs2_find_jhead which
  250. * calls gfs2_map_journal_extents to map it for us again.
  251. *
  252. * Note that we don't really want it to look up a FREE block. The
  253. * GFS2_BLKST_FREE simply overrides a block check in gfs2_inode_lookup
  254. * which would otherwise fail because it requires grabbing an rgrp
  255. * glock, which would fail with -EIO because we're withdrawing.
  256. */
  257. inode = gfs2_inode_lookup(sdp->sd_vfs, DT_UNKNOWN,
  258. sdp->sd_jdesc->jd_no_addr, no_formal_ino,
  259. GFS2_BLKST_FREE);
  260. if (IS_ERR(inode)) {
  261. fs_warn(sdp, "Reprocessing of jid %d failed with %ld.\n",
  262. sdp->sd_lockstruct.ls_jid, PTR_ERR(inode));
  263. goto skip_recovery;
  264. }
  265. sdp->sd_jdesc->jd_inode = inode;
  266. d_mark_dontcache(inode);
  267. /*
  268. * Now wait until recovery is complete.
  269. */
  270. for (tries = 0; tries < 10; tries++) {
  271. ret = check_journal_clean(sdp, sdp->sd_jdesc, false);
  272. if (!ret)
  273. break;
  274. msleep(HZ);
  275. fs_warn(sdp, "Waiting for journal recovery jid %d.\n",
  276. sdp->sd_lockstruct.ls_jid);
  277. }
  278. skip_recovery:
  279. if (!ret)
  280. fs_warn(sdp, "Journal recovery complete for jid %d.\n",
  281. sdp->sd_lockstruct.ls_jid);
  282. else
  283. fs_warn(sdp, "Journal recovery skipped for jid %d until next "
  284. "mount.\n", sdp->sd_lockstruct.ls_jid);
  285. fs_warn(sdp, "Glock dequeues delayed: %lu\n", sdp->sd_glock_dqs_held);
  286. sdp->sd_glock_dqs_held = 0;
  287. wake_up_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY);
  288. }
  289. void gfs2_lm(struct gfs2_sbd *sdp, const char *fmt, ...)
  290. {
  291. struct va_format vaf;
  292. va_list args;
  293. if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
  294. test_bit(SDF_WITHDRAWN, &sdp->sd_flags))
  295. return;
  296. va_start(args, fmt);
  297. vaf.fmt = fmt;
  298. vaf.va = &args;
  299. fs_err(sdp, "%pV", &vaf);
  300. va_end(args);
  301. }
  302. int gfs2_withdraw(struct gfs2_sbd *sdp)
  303. {
  304. struct lm_lockstruct *ls = &sdp->sd_lockstruct;
  305. const struct lm_lockops *lm = ls->ls_ops;
  306. if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW &&
  307. test_and_set_bit(SDF_WITHDRAWN, &sdp->sd_flags)) {
  308. if (!test_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags))
  309. return -1;
  310. wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_IN_PROG,
  311. TASK_UNINTERRUPTIBLE);
  312. return -1;
  313. }
  314. set_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags);
  315. if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW) {
  316. fs_err(sdp, "about to withdraw this file system\n");
  317. BUG_ON(sdp->sd_args.ar_debug);
  318. signal_our_withdraw(sdp);
  319. kobject_uevent(&sdp->sd_kobj, KOBJ_OFFLINE);
  320. if (!strcmp(sdp->sd_lockstruct.ls_ops->lm_proto_name, "lock_dlm"))
  321. wait_for_completion(&sdp->sd_wdack);
  322. if (lm->lm_unmount) {
  323. fs_err(sdp, "telling LM to unmount\n");
  324. lm->lm_unmount(sdp);
  325. }
  326. set_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags);
  327. fs_err(sdp, "File system withdrawn\n");
  328. dump_stack();
  329. clear_bit(SDF_WITHDRAW_IN_PROG, &sdp->sd_flags);
  330. smp_mb__after_atomic();
  331. wake_up_bit(&sdp->sd_flags, SDF_WITHDRAW_IN_PROG);
  332. }
  333. if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
  334. panic("GFS2: fsid=%s: panic requested\n", sdp->sd_fsname);
  335. return -1;
  336. }
  337. /*
  338. * gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false
  339. */
  340. void gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion,
  341. const char *function, char *file, unsigned int line,
  342. bool delayed)
  343. {
  344. if (gfs2_withdrawn(sdp))
  345. return;
  346. fs_err(sdp,
  347. "fatal: assertion \"%s\" failed\n"
  348. " function = %s, file = %s, line = %u\n",
  349. assertion, function, file, line);
  350. /*
  351. * If errors=panic was specified on mount, it won't help to delay the
  352. * withdraw.
  353. */
  354. if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
  355. delayed = false;
  356. if (delayed)
  357. gfs2_withdraw_delayed(sdp);
  358. else
  359. gfs2_withdraw(sdp);
  360. dump_stack();
  361. }
  362. /*
  363. * gfs2_assert_warn_i - Print a message to the console if @assertion is false
  364. */
  365. void gfs2_assert_warn_i(struct gfs2_sbd *sdp, char *assertion,
  366. const char *function, char *file, unsigned int line)
  367. {
  368. if (time_before(jiffies,
  369. sdp->sd_last_warning +
  370. gfs2_tune_get(sdp, gt_complain_secs) * HZ))
  371. return;
  372. if (sdp->sd_args.ar_errors == GFS2_ERRORS_WITHDRAW)
  373. fs_warn(sdp, "warning: assertion \"%s\" failed at function = %s, file = %s, line = %u\n",
  374. assertion, function, file, line);
  375. if (sdp->sd_args.ar_debug)
  376. BUG();
  377. else
  378. dump_stack();
  379. if (sdp->sd_args.ar_errors == GFS2_ERRORS_PANIC)
  380. panic("GFS2: fsid=%s: warning: assertion \"%s\" failed\n"
  381. "GFS2: fsid=%s: function = %s, file = %s, line = %u\n",
  382. sdp->sd_fsname, assertion,
  383. sdp->sd_fsname, function, file, line);
  384. sdp->sd_last_warning = jiffies;
  385. }
  386. /*
  387. * gfs2_consist_i - Flag a filesystem consistency error and withdraw
  388. */
  389. void gfs2_consist_i(struct gfs2_sbd *sdp, const char *function,
  390. char *file, unsigned int line)
  391. {
  392. gfs2_lm(sdp,
  393. "fatal: filesystem consistency error - function = %s, file = %s, line = %u\n",
  394. function, file, line);
  395. gfs2_withdraw(sdp);
  396. }
  397. /*
  398. * gfs2_consist_inode_i - Flag an inode consistency error and withdraw
  399. */
  400. void gfs2_consist_inode_i(struct gfs2_inode *ip,
  401. const char *function, char *file, unsigned int line)
  402. {
  403. struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
  404. gfs2_lm(sdp,
  405. "fatal: filesystem consistency error\n"
  406. " inode = %llu %llu\n"
  407. " function = %s, file = %s, line = %u\n",
  408. (unsigned long long)ip->i_no_formal_ino,
  409. (unsigned long long)ip->i_no_addr,
  410. function, file, line);
  411. gfs2_dump_glock(NULL, ip->i_gl, 1);
  412. gfs2_withdraw(sdp);
  413. }
  414. /*
  415. * gfs2_consist_rgrpd_i - Flag a RG consistency error and withdraw
  416. */
  417. void gfs2_consist_rgrpd_i(struct gfs2_rgrpd *rgd,
  418. const char *function, char *file, unsigned int line)
  419. {
  420. struct gfs2_sbd *sdp = rgd->rd_sbd;
  421. char fs_id_buf[sizeof(sdp->sd_fsname) + 7];
  422. sprintf(fs_id_buf, "fsid=%s: ", sdp->sd_fsname);
  423. gfs2_rgrp_dump(NULL, rgd, fs_id_buf);
  424. gfs2_lm(sdp,
  425. "fatal: filesystem consistency error\n"
  426. " RG = %llu\n"
  427. " function = %s, file = %s, line = %u\n",
  428. (unsigned long long)rgd->rd_addr,
  429. function, file, line);
  430. gfs2_dump_glock(NULL, rgd->rd_gl, 1);
  431. gfs2_withdraw(sdp);
  432. }
  433. /*
  434. * gfs2_meta_check_ii - Flag a magic number consistency error and withdraw
  435. * Returns: -1 if this call withdrew the machine,
  436. * -2 if it was already withdrawn
  437. */
  438. int gfs2_meta_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
  439. const char *type, const char *function, char *file,
  440. unsigned int line)
  441. {
  442. int me;
  443. gfs2_lm(sdp,
  444. "fatal: invalid metadata block\n"
  445. " bh = %llu (%s)\n"
  446. " function = %s, file = %s, line = %u\n",
  447. (unsigned long long)bh->b_blocknr, type,
  448. function, file, line);
  449. me = gfs2_withdraw(sdp);
  450. return (me) ? -1 : -2;
  451. }
  452. /*
  453. * gfs2_metatype_check_ii - Flag a metadata type consistency error and withdraw
  454. * Returns: -1 if this call withdrew the machine,
  455. * -2 if it was already withdrawn
  456. */
  457. int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh,
  458. u16 type, u16 t, const char *function,
  459. char *file, unsigned int line)
  460. {
  461. int me;
  462. gfs2_lm(sdp,
  463. "fatal: invalid metadata block\n"
  464. " bh = %llu (type: exp=%u, found=%u)\n"
  465. " function = %s, file = %s, line = %u\n",
  466. (unsigned long long)bh->b_blocknr, type, t,
  467. function, file, line);
  468. me = gfs2_withdraw(sdp);
  469. return (me) ? -1 : -2;
  470. }
  471. /*
  472. * gfs2_io_error_i - Flag an I/O error and withdraw
  473. * Returns: -1 if this call withdrew the machine,
  474. * 0 if it was already withdrawn
  475. */
  476. int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function, char *file,
  477. unsigned int line)
  478. {
  479. gfs2_lm(sdp,
  480. "fatal: I/O error\n"
  481. " function = %s, file = %s, line = %u\n",
  482. function, file, line);
  483. return gfs2_withdraw(sdp);
  484. }
  485. /*
  486. * gfs2_io_error_bh_i - Flag a buffer I/O error
  487. * @withdraw: withdraw the filesystem
  488. */
  489. void gfs2_io_error_bh_i(struct gfs2_sbd *sdp, struct buffer_head *bh,
  490. const char *function, char *file, unsigned int line,
  491. bool withdraw)
  492. {
  493. if (gfs2_withdrawn(sdp))
  494. return;
  495. fs_err(sdp, "fatal: I/O error\n"
  496. " block = %llu\n"
  497. " function = %s, file = %s, line = %u\n",
  498. (unsigned long long)bh->b_blocknr, function, file, line);
  499. if (withdraw)
  500. gfs2_withdraw(sdp);
  501. }