super.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. /*
  2. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  3. * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
  4. *
  5. * This copyrighted material is made available to anyone wishing to use,
  6. * modify, copy, or redistribute it subject to the terms and conditions
  7. * of the GNU General Public License version 2.
  8. */
  9. #include <linux/sched.h>
  10. #include <linux/slab.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/completion.h>
  13. #include <linux/buffer_head.h>
  14. #include <linux/crc32.h>
  15. #include <linux/gfs2_ondisk.h>
  16. #include <linux/bio.h>
  17. #include <linux/lm_interface.h>
  18. #include "gfs2.h"
  19. #include "incore.h"
  20. #include "bmap.h"
  21. #include "dir.h"
  22. #include "glock.h"
  23. #include "glops.h"
  24. #include "inode.h"
  25. #include "log.h"
  26. #include "meta_io.h"
  27. #include "quota.h"
  28. #include "recovery.h"
  29. #include "rgrp.h"
  30. #include "super.h"
  31. #include "trans.h"
  32. #include "util.h"
  33. /**
  34. * gfs2_jindex_hold - Grab a lock on the jindex
  35. * @sdp: The GFS2 superblock
  36. * @ji_gh: the holder for the jindex glock
  37. *
  38. * This is very similar to the gfs2_rindex_hold() function, except that
  39. * in general we hold the jindex lock for longer periods of time and
  40. * we grab it far less frequently (in general) then the rgrp lock.
  41. *
  42. * Returns: errno
  43. */
  44. int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
  45. {
  46. struct gfs2_inode *dip = GFS2_I(sdp->sd_jindex);
  47. struct qstr name;
  48. char buf[20];
  49. struct gfs2_jdesc *jd;
  50. int error;
  51. name.name = buf;
  52. mutex_lock(&sdp->sd_jindex_mutex);
  53. for (;;) {
  54. error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
  55. if (error)
  56. break;
  57. name.len = sprintf(buf, "journal%u", sdp->sd_journals);
  58. name.hash = gfs2_disk_hash(name.name, name.len);
  59. error = gfs2_dir_check(sdp->sd_jindex, &name, NULL);
  60. if (error == -ENOENT) {
  61. error = 0;
  62. break;
  63. }
  64. gfs2_glock_dq_uninit(ji_gh);
  65. if (error)
  66. break;
  67. error = -ENOMEM;
  68. jd = kzalloc(sizeof(struct gfs2_jdesc), GFP_KERNEL);
  69. if (!jd)
  70. break;
  71. INIT_LIST_HEAD(&jd->extent_list);
  72. jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
  73. if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
  74. if (!jd->jd_inode)
  75. error = -ENOENT;
  76. else
  77. error = PTR_ERR(jd->jd_inode);
  78. kfree(jd);
  79. break;
  80. }
  81. spin_lock(&sdp->sd_jindex_spin);
  82. jd->jd_jid = sdp->sd_journals++;
  83. list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
  84. spin_unlock(&sdp->sd_jindex_spin);
  85. }
  86. mutex_unlock(&sdp->sd_jindex_mutex);
  87. return error;
  88. }
  89. /**
  90. * gfs2_jindex_free - Clear all the journal index information
  91. * @sdp: The GFS2 superblock
  92. *
  93. */
  94. void gfs2_jindex_free(struct gfs2_sbd *sdp)
  95. {
  96. struct list_head list, *head;
  97. struct gfs2_jdesc *jd;
  98. struct gfs2_journal_extent *jext;
  99. spin_lock(&sdp->sd_jindex_spin);
  100. list_add(&list, &sdp->sd_jindex_list);
  101. list_del_init(&sdp->sd_jindex_list);
  102. sdp->sd_journals = 0;
  103. spin_unlock(&sdp->sd_jindex_spin);
  104. while (!list_empty(&list)) {
  105. jd = list_entry(list.next, struct gfs2_jdesc, jd_list);
  106. head = &jd->extent_list;
  107. while (!list_empty(head)) {
  108. jext = list_entry(head->next,
  109. struct gfs2_journal_extent,
  110. extent_list);
  111. list_del(&jext->extent_list);
  112. kfree(jext);
  113. }
  114. list_del(&jd->jd_list);
  115. iput(jd->jd_inode);
  116. kfree(jd);
  117. }
  118. }
  119. static struct gfs2_jdesc *jdesc_find_i(struct list_head *head, unsigned int jid)
  120. {
  121. struct gfs2_jdesc *jd;
  122. int found = 0;
  123. list_for_each_entry(jd, head, jd_list) {
  124. if (jd->jd_jid == jid) {
  125. found = 1;
  126. break;
  127. }
  128. }
  129. if (!found)
  130. jd = NULL;
  131. return jd;
  132. }
  133. struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid)
  134. {
  135. struct gfs2_jdesc *jd;
  136. spin_lock(&sdp->sd_jindex_spin);
  137. jd = jdesc_find_i(&sdp->sd_jindex_list, jid);
  138. spin_unlock(&sdp->sd_jindex_spin);
  139. return jd;
  140. }
  141. void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid)
  142. {
  143. struct gfs2_jdesc *jd;
  144. spin_lock(&sdp->sd_jindex_spin);
  145. jd = jdesc_find_i(&sdp->sd_jindex_list, jid);
  146. if (jd)
  147. jd->jd_dirty = 1;
  148. spin_unlock(&sdp->sd_jindex_spin);
  149. }
  150. struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
  151. {
  152. struct gfs2_jdesc *jd;
  153. int found = 0;
  154. spin_lock(&sdp->sd_jindex_spin);
  155. list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
  156. if (jd->jd_dirty) {
  157. jd->jd_dirty = 0;
  158. found = 1;
  159. break;
  160. }
  161. }
  162. spin_unlock(&sdp->sd_jindex_spin);
  163. if (!found)
  164. jd = NULL;
  165. return jd;
  166. }
  167. int gfs2_jdesc_check(struct gfs2_jdesc *jd)
  168. {
  169. struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
  170. struct gfs2_sbd *sdp = GFS2_SB(jd->jd_inode);
  171. int ar;
  172. int error;
  173. if (ip->i_di.di_size < (8 << 20) || ip->i_di.di_size > (1 << 30) ||
  174. (ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1))) {
  175. gfs2_consist_inode(ip);
  176. return -EIO;
  177. }
  178. jd->jd_blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
  179. error = gfs2_write_alloc_required(ip, 0, ip->i_di.di_size, &ar);
  180. if (!error && ar) {
  181. gfs2_consist_inode(ip);
  182. error = -EIO;
  183. }
  184. return error;
  185. }
  186. /**
  187. * gfs2_make_fs_rw - Turn a Read-Only FS into a Read-Write one
  188. * @sdp: the filesystem
  189. *
  190. * Returns: errno
  191. */
  192. int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
  193. {
  194. struct gfs2_inode *ip = GFS2_I(sdp->sd_jdesc->jd_inode);
  195. struct gfs2_glock *j_gl = ip->i_gl;
  196. struct gfs2_holder t_gh;
  197. struct gfs2_log_header_host head;
  198. int error;
  199. error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, 0, &t_gh);
  200. if (error)
  201. return error;
  202. j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
  203. error = gfs2_find_jhead(sdp->sd_jdesc, &head);
  204. if (error)
  205. goto fail;
  206. if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
  207. gfs2_consist(sdp);
  208. error = -EIO;
  209. goto fail;
  210. }
  211. /* Initialize some head of the log stuff */
  212. sdp->sd_log_sequence = head.lh_sequence + 1;
  213. gfs2_log_pointers_init(sdp, head.lh_blkno);
  214. error = gfs2_quota_init(sdp);
  215. if (error)
  216. goto fail;
  217. set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
  218. gfs2_glock_dq_uninit(&t_gh);
  219. return 0;
  220. fail:
  221. t_gh.gh_flags |= GL_NOCACHE;
  222. gfs2_glock_dq_uninit(&t_gh);
  223. return error;
  224. }
  225. static void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf)
  226. {
  227. const struct gfs2_statfs_change *str = buf;
  228. sc->sc_total = be64_to_cpu(str->sc_total);
  229. sc->sc_free = be64_to_cpu(str->sc_free);
  230. sc->sc_dinodes = be64_to_cpu(str->sc_dinodes);
  231. }
  232. static void gfs2_statfs_change_out(const struct gfs2_statfs_change_host *sc, void *buf)
  233. {
  234. struct gfs2_statfs_change *str = buf;
  235. str->sc_total = cpu_to_be64(sc->sc_total);
  236. str->sc_free = cpu_to_be64(sc->sc_free);
  237. str->sc_dinodes = cpu_to_be64(sc->sc_dinodes);
  238. }
  239. int gfs2_statfs_init(struct gfs2_sbd *sdp)
  240. {
  241. struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
  242. struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
  243. struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode);
  244. struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
  245. struct buffer_head *m_bh, *l_bh;
  246. struct gfs2_holder gh;
  247. int error;
  248. error = gfs2_glock_nq_init(m_ip->i_gl, LM_ST_EXCLUSIVE, GL_NOCACHE,
  249. &gh);
  250. if (error)
  251. return error;
  252. error = gfs2_meta_inode_buffer(m_ip, &m_bh);
  253. if (error)
  254. goto out;
  255. if (sdp->sd_args.ar_spectator) {
  256. spin_lock(&sdp->sd_statfs_spin);
  257. gfs2_statfs_change_in(m_sc, m_bh->b_data +
  258. sizeof(struct gfs2_dinode));
  259. spin_unlock(&sdp->sd_statfs_spin);
  260. } else {
  261. error = gfs2_meta_inode_buffer(l_ip, &l_bh);
  262. if (error)
  263. goto out_m_bh;
  264. spin_lock(&sdp->sd_statfs_spin);
  265. gfs2_statfs_change_in(m_sc, m_bh->b_data +
  266. sizeof(struct gfs2_dinode));
  267. gfs2_statfs_change_in(l_sc, l_bh->b_data +
  268. sizeof(struct gfs2_dinode));
  269. spin_unlock(&sdp->sd_statfs_spin);
  270. brelse(l_bh);
  271. }
  272. out_m_bh:
  273. brelse(m_bh);
  274. out:
  275. gfs2_glock_dq_uninit(&gh);
  276. return 0;
  277. }
  278. void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
  279. s64 dinodes)
  280. {
  281. struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode);
  282. struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
  283. struct buffer_head *l_bh;
  284. int error;
  285. error = gfs2_meta_inode_buffer(l_ip, &l_bh);
  286. if (error)
  287. return;
  288. gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
  289. spin_lock(&sdp->sd_statfs_spin);
  290. l_sc->sc_total += total;
  291. l_sc->sc_free += free;
  292. l_sc->sc_dinodes += dinodes;
  293. gfs2_statfs_change_out(l_sc, l_bh->b_data + sizeof(struct gfs2_dinode));
  294. spin_unlock(&sdp->sd_statfs_spin);
  295. brelse(l_bh);
  296. }
  297. int gfs2_statfs_sync(struct gfs2_sbd *sdp)
  298. {
  299. struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
  300. struct gfs2_inode *l_ip = GFS2_I(sdp->sd_sc_inode);
  301. struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
  302. struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
  303. struct gfs2_holder gh;
  304. struct buffer_head *m_bh, *l_bh;
  305. int error;
  306. error = gfs2_glock_nq_init(m_ip->i_gl, LM_ST_EXCLUSIVE, GL_NOCACHE,
  307. &gh);
  308. if (error)
  309. return error;
  310. error = gfs2_meta_inode_buffer(m_ip, &m_bh);
  311. if (error)
  312. goto out;
  313. spin_lock(&sdp->sd_statfs_spin);
  314. gfs2_statfs_change_in(m_sc, m_bh->b_data +
  315. sizeof(struct gfs2_dinode));
  316. if (!l_sc->sc_total && !l_sc->sc_free && !l_sc->sc_dinodes) {
  317. spin_unlock(&sdp->sd_statfs_spin);
  318. goto out_bh;
  319. }
  320. spin_unlock(&sdp->sd_statfs_spin);
  321. error = gfs2_meta_inode_buffer(l_ip, &l_bh);
  322. if (error)
  323. goto out_bh;
  324. error = gfs2_trans_begin(sdp, 2 * RES_DINODE, 0);
  325. if (error)
  326. goto out_bh2;
  327. gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
  328. spin_lock(&sdp->sd_statfs_spin);
  329. m_sc->sc_total += l_sc->sc_total;
  330. m_sc->sc_free += l_sc->sc_free;
  331. m_sc->sc_dinodes += l_sc->sc_dinodes;
  332. memset(l_sc, 0, sizeof(struct gfs2_statfs_change));
  333. memset(l_bh->b_data + sizeof(struct gfs2_dinode),
  334. 0, sizeof(struct gfs2_statfs_change));
  335. spin_unlock(&sdp->sd_statfs_spin);
  336. gfs2_trans_add_bh(m_ip->i_gl, m_bh, 1);
  337. gfs2_statfs_change_out(m_sc, m_bh->b_data + sizeof(struct gfs2_dinode));
  338. gfs2_trans_end(sdp);
  339. out_bh2:
  340. brelse(l_bh);
  341. out_bh:
  342. brelse(m_bh);
  343. out:
  344. gfs2_glock_dq_uninit(&gh);
  345. return error;
  346. }
  347. /**
  348. * gfs2_statfs_i - Do a statfs
  349. * @sdp: the filesystem
  350. * @sg: the sg structure
  351. *
  352. * Returns: errno
  353. */
  354. int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
  355. {
  356. struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
  357. struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
  358. spin_lock(&sdp->sd_statfs_spin);
  359. *sc = *m_sc;
  360. sc->sc_total += l_sc->sc_total;
  361. sc->sc_free += l_sc->sc_free;
  362. sc->sc_dinodes += l_sc->sc_dinodes;
  363. spin_unlock(&sdp->sd_statfs_spin);
  364. if (sc->sc_free < 0)
  365. sc->sc_free = 0;
  366. if (sc->sc_free > sc->sc_total)
  367. sc->sc_free = sc->sc_total;
  368. if (sc->sc_dinodes < 0)
  369. sc->sc_dinodes = 0;
  370. return 0;
  371. }
  372. /**
  373. * statfs_fill - fill in the sg for a given RG
  374. * @rgd: the RG
  375. * @sc: the sc structure
  376. *
  377. * Returns: 0 on success, -ESTALE if the LVB is invalid
  378. */
  379. static int statfs_slow_fill(struct gfs2_rgrpd *rgd,
  380. struct gfs2_statfs_change_host *sc)
  381. {
  382. gfs2_rgrp_verify(rgd);
  383. sc->sc_total += rgd->rd_data;
  384. sc->sc_free += rgd->rd_rg.rg_free;
  385. sc->sc_dinodes += rgd->rd_rg.rg_dinodes;
  386. return 0;
  387. }
  388. /**
  389. * gfs2_statfs_slow - Stat a filesystem using asynchronous locking
  390. * @sdp: the filesystem
  391. * @sc: the sc info that will be returned
  392. *
  393. * Any error (other than a signal) will cause this routine to fall back
  394. * to the synchronous version.
  395. *
  396. * FIXME: This really shouldn't busy wait like this.
  397. *
  398. * Returns: errno
  399. */
  400. int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
  401. {
  402. struct gfs2_holder ri_gh;
  403. struct gfs2_rgrpd *rgd_next;
  404. struct gfs2_holder *gha, *gh;
  405. unsigned int slots = 64;
  406. unsigned int x;
  407. int done;
  408. int error = 0, err;
  409. memset(sc, 0, sizeof(struct gfs2_statfs_change_host));
  410. gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL);
  411. if (!gha)
  412. return -ENOMEM;
  413. error = gfs2_rindex_hold(sdp, &ri_gh);
  414. if (error)
  415. goto out;
  416. rgd_next = gfs2_rgrpd_get_first(sdp);
  417. for (;;) {
  418. done = 1;
  419. for (x = 0; x < slots; x++) {
  420. gh = gha + x;
  421. if (gh->gh_gl && gfs2_glock_poll(gh)) {
  422. err = gfs2_glock_wait(gh);
  423. if (err) {
  424. gfs2_holder_uninit(gh);
  425. error = err;
  426. } else {
  427. if (!error)
  428. error = statfs_slow_fill(
  429. gh->gh_gl->gl_object, sc);
  430. gfs2_glock_dq_uninit(gh);
  431. }
  432. }
  433. if (gh->gh_gl)
  434. done = 0;
  435. else if (rgd_next && !error) {
  436. error = gfs2_glock_nq_init(rgd_next->rd_gl,
  437. LM_ST_SHARED,
  438. GL_ASYNC,
  439. gh);
  440. rgd_next = gfs2_rgrpd_get_next(rgd_next);
  441. done = 0;
  442. }
  443. if (signal_pending(current))
  444. error = -ERESTARTSYS;
  445. }
  446. if (done)
  447. break;
  448. yield();
  449. }
  450. gfs2_glock_dq_uninit(&ri_gh);
  451. out:
  452. kfree(gha);
  453. return error;
  454. }
  455. struct lfcc {
  456. struct list_head list;
  457. struct gfs2_holder gh;
  458. };
  459. /**
  460. * gfs2_lock_fs_check_clean - Stop all writes to the FS and check that all
  461. * journals are clean
  462. * @sdp: the file system
  463. * @state: the state to put the transaction lock into
  464. * @t_gh: the hold on the transaction lock
  465. *
  466. * Returns: errno
  467. */
  468. static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp,
  469. struct gfs2_holder *t_gh)
  470. {
  471. struct gfs2_inode *ip;
  472. struct gfs2_holder ji_gh;
  473. struct gfs2_jdesc *jd;
  474. struct lfcc *lfcc;
  475. LIST_HEAD(list);
  476. struct gfs2_log_header_host lh;
  477. int error;
  478. error = gfs2_jindex_hold(sdp, &ji_gh);
  479. if (error)
  480. return error;
  481. list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
  482. lfcc = kmalloc(sizeof(struct lfcc), GFP_KERNEL);
  483. if (!lfcc) {
  484. error = -ENOMEM;
  485. goto out;
  486. }
  487. ip = GFS2_I(jd->jd_inode);
  488. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &lfcc->gh);
  489. if (error) {
  490. kfree(lfcc);
  491. goto out;
  492. }
  493. list_add(&lfcc->list, &list);
  494. }
  495. error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_DEFERRED,
  496. GL_NOCACHE, t_gh);
  497. list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
  498. error = gfs2_jdesc_check(jd);
  499. if (error)
  500. break;
  501. error = gfs2_find_jhead(jd, &lh);
  502. if (error)
  503. break;
  504. if (!(lh.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
  505. error = -EBUSY;
  506. break;
  507. }
  508. }
  509. if (error)
  510. gfs2_glock_dq_uninit(t_gh);
  511. out:
  512. while (!list_empty(&list)) {
  513. lfcc = list_entry(list.next, struct lfcc, list);
  514. list_del(&lfcc->list);
  515. gfs2_glock_dq_uninit(&lfcc->gh);
  516. kfree(lfcc);
  517. }
  518. gfs2_glock_dq_uninit(&ji_gh);
  519. return error;
  520. }
  521. /**
  522. * gfs2_freeze_fs - freezes the file system
  523. * @sdp: the file system
  524. *
  525. * This function flushes data and meta data for all machines by
  526. * aquiring the transaction log exclusively. All journals are
  527. * ensured to be in a clean state as well.
  528. *
  529. * Returns: errno
  530. */
  531. int gfs2_freeze_fs(struct gfs2_sbd *sdp)
  532. {
  533. int error = 0;
  534. mutex_lock(&sdp->sd_freeze_lock);
  535. if (!sdp->sd_freeze_count++) {
  536. error = gfs2_lock_fs_check_clean(sdp, &sdp->sd_freeze_gh);
  537. if (error)
  538. sdp->sd_freeze_count--;
  539. }
  540. mutex_unlock(&sdp->sd_freeze_lock);
  541. return error;
  542. }
  543. /**
  544. * gfs2_unfreeze_fs - unfreezes the file system
  545. * @sdp: the file system
  546. *
  547. * This function allows the file system to proceed by unlocking
  548. * the exclusively held transaction lock. Other GFS2 nodes are
  549. * now free to acquire the lock shared and go on with their lives.
  550. *
  551. */
  552. void gfs2_unfreeze_fs(struct gfs2_sbd *sdp)
  553. {
  554. mutex_lock(&sdp->sd_freeze_lock);
  555. if (sdp->sd_freeze_count && !--sdp->sd_freeze_count)
  556. gfs2_glock_dq_uninit(&sdp->sd_freeze_gh);
  557. mutex_unlock(&sdp->sd_freeze_lock);
  558. }