ops_fstype.c 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  4. * Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
  5. */
  6. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  7. #include <linux/sched.h>
  8. #include <linux/slab.h>
  9. #include <linux/spinlock.h>
  10. #include <linux/completion.h>
  11. #include <linux/buffer_head.h>
  12. #include <linux/blkdev.h>
  13. #include <linux/kthread.h>
  14. #include <linux/export.h>
  15. #include <linux/namei.h>
  16. #include <linux/mount.h>
  17. #include <linux/gfs2_ondisk.h>
  18. #include <linux/quotaops.h>
  19. #include <linux/lockdep.h>
  20. #include <linux/module.h>
  21. #include <linux/backing-dev.h>
  22. #include <linux/fs_parser.h>
  23. #include "gfs2.h"
  24. #include "incore.h"
  25. #include "bmap.h"
  26. #include "glock.h"
  27. #include "glops.h"
  28. #include "inode.h"
  29. #include "recovery.h"
  30. #include "rgrp.h"
  31. #include "super.h"
  32. #include "sys.h"
  33. #include "util.h"
  34. #include "log.h"
  35. #include "quota.h"
  36. #include "dir.h"
  37. #include "meta_io.h"
  38. #include "trace_gfs2.h"
  39. #include "lops.h"
  40. #define DO 0
  41. #define UNDO 1
  42. /**
  43. * gfs2_tune_init - Fill a gfs2_tune structure with default values
  44. * @gt: tune
  45. *
  46. */
  47. static void gfs2_tune_init(struct gfs2_tune *gt)
  48. {
  49. spin_lock_init(&gt->gt_spin);
  50. gt->gt_quota_warn_period = 10;
  51. gt->gt_quota_scale_num = 1;
  52. gt->gt_quota_scale_den = 1;
  53. gt->gt_new_files_jdata = 0;
  54. gt->gt_max_readahead = BIT(18);
  55. gt->gt_complain_secs = 10;
  56. }
  57. void free_sbd(struct gfs2_sbd *sdp)
  58. {
  59. if (sdp->sd_lkstats)
  60. free_percpu(sdp->sd_lkstats);
  61. kfree(sdp);
  62. }
  63. static struct gfs2_sbd *init_sbd(struct super_block *sb)
  64. {
  65. struct gfs2_sbd *sdp;
  66. struct address_space *mapping;
  67. sdp = kzalloc(sizeof(struct gfs2_sbd), GFP_KERNEL);
  68. if (!sdp)
  69. return NULL;
  70. sdp->sd_vfs = sb;
  71. sdp->sd_lkstats = alloc_percpu(struct gfs2_pcpu_lkstats);
  72. if (!sdp->sd_lkstats)
  73. goto fail;
  74. sb->s_fs_info = sdp;
  75. set_bit(SDF_NOJOURNALID, &sdp->sd_flags);
  76. gfs2_tune_init(&sdp->sd_tune);
  77. init_waitqueue_head(&sdp->sd_glock_wait);
  78. init_waitqueue_head(&sdp->sd_async_glock_wait);
  79. atomic_set(&sdp->sd_glock_disposal, 0);
  80. init_completion(&sdp->sd_locking_init);
  81. init_completion(&sdp->sd_wdack);
  82. spin_lock_init(&sdp->sd_statfs_spin);
  83. spin_lock_init(&sdp->sd_rindex_spin);
  84. sdp->sd_rindex_tree.rb_node = NULL;
  85. INIT_LIST_HEAD(&sdp->sd_jindex_list);
  86. spin_lock_init(&sdp->sd_jindex_spin);
  87. mutex_init(&sdp->sd_jindex_mutex);
  88. init_completion(&sdp->sd_journal_ready);
  89. INIT_LIST_HEAD(&sdp->sd_quota_list);
  90. mutex_init(&sdp->sd_quota_mutex);
  91. mutex_init(&sdp->sd_quota_sync_mutex);
  92. init_waitqueue_head(&sdp->sd_quota_wait);
  93. INIT_LIST_HEAD(&sdp->sd_trunc_list);
  94. spin_lock_init(&sdp->sd_trunc_lock);
  95. spin_lock_init(&sdp->sd_bitmap_lock);
  96. INIT_LIST_HEAD(&sdp->sd_sc_inodes_list);
  97. mapping = &sdp->sd_aspace;
  98. address_space_init_once(mapping);
  99. mapping->a_ops = &gfs2_rgrp_aops;
  100. mapping->host = sb->s_bdev->bd_inode;
  101. mapping->flags = 0;
  102. mapping_set_gfp_mask(mapping, GFP_NOFS);
  103. mapping->private_data = NULL;
  104. mapping->writeback_index = 0;
  105. spin_lock_init(&sdp->sd_log_lock);
  106. atomic_set(&sdp->sd_log_pinned, 0);
  107. INIT_LIST_HEAD(&sdp->sd_log_revokes);
  108. INIT_LIST_HEAD(&sdp->sd_log_ordered);
  109. spin_lock_init(&sdp->sd_ordered_lock);
  110. init_waitqueue_head(&sdp->sd_log_waitq);
  111. init_waitqueue_head(&sdp->sd_logd_waitq);
  112. spin_lock_init(&sdp->sd_ail_lock);
  113. INIT_LIST_HEAD(&sdp->sd_ail1_list);
  114. INIT_LIST_HEAD(&sdp->sd_ail2_list);
  115. init_rwsem(&sdp->sd_log_flush_lock);
  116. atomic_set(&sdp->sd_log_in_flight, 0);
  117. atomic_set(&sdp->sd_reserving_log, 0);
  118. init_waitqueue_head(&sdp->sd_reserving_log_wait);
  119. init_waitqueue_head(&sdp->sd_log_flush_wait);
  120. atomic_set(&sdp->sd_freeze_state, SFS_UNFROZEN);
  121. mutex_init(&sdp->sd_freeze_mutex);
  122. return sdp;
  123. fail:
  124. free_sbd(sdp);
  125. return NULL;
  126. }
  127. /**
  128. * gfs2_check_sb - Check superblock
  129. * @sdp: the filesystem
  130. * @sb: The superblock
  131. * @silent: Don't print a message if the check fails
  132. *
  133. * Checks the version code of the FS is one that we understand how to
  134. * read and that the sizes of the various on-disk structures have not
  135. * changed.
  136. */
  137. static int gfs2_check_sb(struct gfs2_sbd *sdp, int silent)
  138. {
  139. struct gfs2_sb_host *sb = &sdp->sd_sb;
  140. if (sb->sb_magic != GFS2_MAGIC ||
  141. sb->sb_type != GFS2_METATYPE_SB) {
  142. if (!silent)
  143. pr_warn("not a GFS2 filesystem\n");
  144. return -EINVAL;
  145. }
  146. if (sb->sb_fs_format != GFS2_FORMAT_FS ||
  147. sb->sb_multihost_format != GFS2_FORMAT_MULTI) {
  148. fs_warn(sdp, "Unknown on-disk format, unable to mount\n");
  149. return -EINVAL;
  150. }
  151. if (sb->sb_bsize < 512 || sb->sb_bsize > PAGE_SIZE ||
  152. (sb->sb_bsize & (sb->sb_bsize - 1))) {
  153. pr_warn("Invalid superblock size\n");
  154. return -EINVAL;
  155. }
  156. return 0;
  157. }
  158. static void end_bio_io_page(struct bio *bio)
  159. {
  160. struct page *page = bio->bi_private;
  161. if (!bio->bi_status)
  162. SetPageUptodate(page);
  163. else
  164. pr_warn("error %d reading superblock\n", bio->bi_status);
  165. unlock_page(page);
  166. }
  167. static void gfs2_sb_in(struct gfs2_sbd *sdp, const void *buf)
  168. {
  169. struct gfs2_sb_host *sb = &sdp->sd_sb;
  170. struct super_block *s = sdp->sd_vfs;
  171. const struct gfs2_sb *str = buf;
  172. sb->sb_magic = be32_to_cpu(str->sb_header.mh_magic);
  173. sb->sb_type = be32_to_cpu(str->sb_header.mh_type);
  174. sb->sb_format = be32_to_cpu(str->sb_header.mh_format);
  175. sb->sb_fs_format = be32_to_cpu(str->sb_fs_format);
  176. sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format);
  177. sb->sb_bsize = be32_to_cpu(str->sb_bsize);
  178. sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift);
  179. sb->sb_master_dir.no_addr = be64_to_cpu(str->sb_master_dir.no_addr);
  180. sb->sb_master_dir.no_formal_ino = be64_to_cpu(str->sb_master_dir.no_formal_ino);
  181. sb->sb_root_dir.no_addr = be64_to_cpu(str->sb_root_dir.no_addr);
  182. sb->sb_root_dir.no_formal_ino = be64_to_cpu(str->sb_root_dir.no_formal_ino);
  183. memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
  184. memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
  185. memcpy(&s->s_uuid, str->sb_uuid, 16);
  186. }
  187. /**
  188. * gfs2_read_super - Read the gfs2 super block from disk
  189. * @sdp: The GFS2 super block
  190. * @sector: The location of the super block
  191. * @error: The error code to return
  192. *
  193. * This uses the bio functions to read the super block from disk
  194. * because we want to be 100% sure that we never read cached data.
  195. * A super block is read twice only during each GFS2 mount and is
  196. * never written to by the filesystem. The first time its read no
  197. * locks are held, and the only details which are looked at are those
  198. * relating to the locking protocol. Once locking is up and working,
  199. * the sb is read again under the lock to establish the location of
  200. * the master directory (contains pointers to journals etc) and the
  201. * root directory.
  202. *
  203. * Returns: 0 on success or error
  204. */
  205. static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent)
  206. {
  207. struct super_block *sb = sdp->sd_vfs;
  208. struct gfs2_sb *p;
  209. struct page *page;
  210. struct bio *bio;
  211. page = alloc_page(GFP_NOFS);
  212. if (unlikely(!page))
  213. return -ENOMEM;
  214. ClearPageUptodate(page);
  215. ClearPageDirty(page);
  216. lock_page(page);
  217. bio = bio_alloc(GFP_NOFS, 1);
  218. bio->bi_iter.bi_sector = sector * (sb->s_blocksize >> 9);
  219. bio_set_dev(bio, sb->s_bdev);
  220. bio_add_page(bio, page, PAGE_SIZE, 0);
  221. bio->bi_end_io = end_bio_io_page;
  222. bio->bi_private = page;
  223. bio_set_op_attrs(bio, REQ_OP_READ, REQ_META);
  224. submit_bio(bio);
  225. wait_on_page_locked(page);
  226. bio_put(bio);
  227. if (!PageUptodate(page)) {
  228. __free_page(page);
  229. return -EIO;
  230. }
  231. p = kmap(page);
  232. gfs2_sb_in(sdp, p);
  233. kunmap(page);
  234. __free_page(page);
  235. return gfs2_check_sb(sdp, silent);
  236. }
  237. /**
  238. * gfs2_read_sb - Read super block
  239. * @sdp: The GFS2 superblock
  240. * @silent: Don't print message if mount fails
  241. *
  242. */
  243. static int gfs2_read_sb(struct gfs2_sbd *sdp, int silent)
  244. {
  245. u32 hash_blocks, ind_blocks, leaf_blocks;
  246. u32 tmp_blocks;
  247. unsigned int x;
  248. int error;
  249. error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift, silent);
  250. if (error) {
  251. if (!silent)
  252. fs_err(sdp, "can't read superblock\n");
  253. return error;
  254. }
  255. sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
  256. GFS2_BASIC_BLOCK_SHIFT;
  257. sdp->sd_fsb2bb = BIT(sdp->sd_fsb2bb_shift);
  258. sdp->sd_diptrs = (sdp->sd_sb.sb_bsize -
  259. sizeof(struct gfs2_dinode)) / sizeof(u64);
  260. sdp->sd_inptrs = (sdp->sd_sb.sb_bsize -
  261. sizeof(struct gfs2_meta_header)) / sizeof(u64);
  262. sdp->sd_ldptrs = (sdp->sd_sb.sb_bsize -
  263. sizeof(struct gfs2_log_descriptor)) / sizeof(u64);
  264. sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
  265. sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2;
  266. sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1;
  267. sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(u64);
  268. sdp->sd_qc_per_block = (sdp->sd_sb.sb_bsize -
  269. sizeof(struct gfs2_meta_header)) /
  270. sizeof(struct gfs2_quota_change);
  271. sdp->sd_blocks_per_bitmap = (sdp->sd_sb.sb_bsize -
  272. sizeof(struct gfs2_meta_header))
  273. * GFS2_NBBY; /* not the rgrp bitmap, subsequent bitmaps only */
  274. /* Compute maximum reservation required to add a entry to a directory */
  275. hash_blocks = DIV_ROUND_UP(sizeof(u64) * BIT(GFS2_DIR_MAX_DEPTH),
  276. sdp->sd_jbsize);
  277. ind_blocks = 0;
  278. for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) {
  279. tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs);
  280. ind_blocks += tmp_blocks;
  281. }
  282. leaf_blocks = 2 + GFS2_DIR_MAX_DEPTH;
  283. sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks;
  284. sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize -
  285. sizeof(struct gfs2_dinode);
  286. sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs;
  287. for (x = 2;; x++) {
  288. u64 space, d;
  289. u32 m;
  290. space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs;
  291. d = space;
  292. m = do_div(d, sdp->sd_inptrs);
  293. if (d != sdp->sd_heightsize[x - 1] || m)
  294. break;
  295. sdp->sd_heightsize[x] = space;
  296. }
  297. sdp->sd_max_height = x;
  298. sdp->sd_heightsize[x] = ~0;
  299. gfs2_assert(sdp, sdp->sd_max_height <= GFS2_MAX_META_HEIGHT);
  300. sdp->sd_max_dents_per_leaf = (sdp->sd_sb.sb_bsize -
  301. sizeof(struct gfs2_leaf)) /
  302. GFS2_MIN_DIRENT_SIZE;
  303. return 0;
  304. }
  305. static int init_names(struct gfs2_sbd *sdp, int silent)
  306. {
  307. char *proto, *table;
  308. int error = 0;
  309. proto = sdp->sd_args.ar_lockproto;
  310. table = sdp->sd_args.ar_locktable;
  311. /* Try to autodetect */
  312. if (!proto[0] || !table[0]) {
  313. error = gfs2_read_super(sdp, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift, silent);
  314. if (error)
  315. return error;
  316. if (!proto[0])
  317. proto = sdp->sd_sb.sb_lockproto;
  318. if (!table[0])
  319. table = sdp->sd_sb.sb_locktable;
  320. }
  321. if (!table[0])
  322. table = sdp->sd_vfs->s_id;
  323. strlcpy(sdp->sd_proto_name, proto, GFS2_FSNAME_LEN);
  324. strlcpy(sdp->sd_table_name, table, GFS2_FSNAME_LEN);
  325. table = sdp->sd_table_name;
  326. while ((table = strchr(table, '/')))
  327. *table = '_';
  328. return error;
  329. }
  330. static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
  331. int undo)
  332. {
  333. int error = 0;
  334. if (undo)
  335. goto fail_trans;
  336. error = gfs2_glock_nq_num(sdp,
  337. GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
  338. LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE,
  339. mount_gh);
  340. if (error) {
  341. fs_err(sdp, "can't acquire mount glock: %d\n", error);
  342. goto fail;
  343. }
  344. error = gfs2_glock_nq_num(sdp,
  345. GFS2_LIVE_LOCK, &gfs2_nondisk_glops,
  346. LM_ST_SHARED,
  347. LM_FLAG_NOEXP | GL_EXACT,
  348. &sdp->sd_live_gh);
  349. if (error) {
  350. fs_err(sdp, "can't acquire live glock: %d\n", error);
  351. goto fail_mount;
  352. }
  353. error = gfs2_glock_get(sdp, GFS2_RENAME_LOCK, &gfs2_nondisk_glops,
  354. CREATE, &sdp->sd_rename_gl);
  355. if (error) {
  356. fs_err(sdp, "can't create rename glock: %d\n", error);
  357. goto fail_live;
  358. }
  359. error = gfs2_glock_get(sdp, GFS2_FREEZE_LOCK, &gfs2_freeze_glops,
  360. CREATE, &sdp->sd_freeze_gl);
  361. if (error) {
  362. fs_err(sdp, "can't create transaction glock: %d\n", error);
  363. goto fail_rename;
  364. }
  365. return 0;
  366. fail_trans:
  367. gfs2_glock_put(sdp->sd_freeze_gl);
  368. fail_rename:
  369. gfs2_glock_put(sdp->sd_rename_gl);
  370. fail_live:
  371. gfs2_glock_dq_uninit(&sdp->sd_live_gh);
  372. fail_mount:
  373. gfs2_glock_dq_uninit(mount_gh);
  374. fail:
  375. return error;
  376. }
  377. static int gfs2_lookup_root(struct super_block *sb, struct dentry **dptr,
  378. u64 no_addr, const char *name)
  379. {
  380. struct gfs2_sbd *sdp = sb->s_fs_info;
  381. struct dentry *dentry;
  382. struct inode *inode;
  383. inode = gfs2_inode_lookup(sb, DT_DIR, no_addr, 0,
  384. GFS2_BLKST_FREE /* ignore */);
  385. if (IS_ERR(inode)) {
  386. fs_err(sdp, "can't read in %s inode: %ld\n", name, PTR_ERR(inode));
  387. return PTR_ERR(inode);
  388. }
  389. dentry = d_make_root(inode);
  390. if (!dentry) {
  391. fs_err(sdp, "can't alloc %s dentry\n", name);
  392. return -ENOMEM;
  393. }
  394. *dptr = dentry;
  395. return 0;
  396. }
  397. static int init_sb(struct gfs2_sbd *sdp, int silent)
  398. {
  399. struct super_block *sb = sdp->sd_vfs;
  400. struct gfs2_holder sb_gh;
  401. u64 no_addr;
  402. int ret;
  403. ret = gfs2_glock_nq_num(sdp, GFS2_SB_LOCK, &gfs2_meta_glops,
  404. LM_ST_SHARED, 0, &sb_gh);
  405. if (ret) {
  406. fs_err(sdp, "can't acquire superblock glock: %d\n", ret);
  407. return ret;
  408. }
  409. ret = gfs2_read_sb(sdp, silent);
  410. if (ret) {
  411. fs_err(sdp, "can't read superblock: %d\n", ret);
  412. goto out;
  413. }
  414. /* Set up the buffer cache and SB for real */
  415. if (sdp->sd_sb.sb_bsize < bdev_logical_block_size(sb->s_bdev)) {
  416. ret = -EINVAL;
  417. fs_err(sdp, "FS block size (%u) is too small for device "
  418. "block size (%u)\n",
  419. sdp->sd_sb.sb_bsize, bdev_logical_block_size(sb->s_bdev));
  420. goto out;
  421. }
  422. if (sdp->sd_sb.sb_bsize > PAGE_SIZE) {
  423. ret = -EINVAL;
  424. fs_err(sdp, "FS block size (%u) is too big for machine "
  425. "page size (%u)\n",
  426. sdp->sd_sb.sb_bsize, (unsigned int)PAGE_SIZE);
  427. goto out;
  428. }
  429. sb_set_blocksize(sb, sdp->sd_sb.sb_bsize);
  430. /* Get the root inode */
  431. no_addr = sdp->sd_sb.sb_root_dir.no_addr;
  432. ret = gfs2_lookup_root(sb, &sdp->sd_root_dir, no_addr, "root");
  433. if (ret)
  434. goto out;
  435. /* Get the master inode */
  436. no_addr = sdp->sd_sb.sb_master_dir.no_addr;
  437. ret = gfs2_lookup_root(sb, &sdp->sd_master_dir, no_addr, "master");
  438. if (ret) {
  439. dput(sdp->sd_root_dir);
  440. goto out;
  441. }
  442. sb->s_root = dget(sdp->sd_args.ar_meta ? sdp->sd_master_dir : sdp->sd_root_dir);
  443. out:
  444. gfs2_glock_dq_uninit(&sb_gh);
  445. return ret;
  446. }
  447. static void gfs2_others_may_mount(struct gfs2_sbd *sdp)
  448. {
  449. char *message = "FIRSTMOUNT=Done";
  450. char *envp[] = { message, NULL };
  451. fs_info(sdp, "first mount done, others may mount\n");
  452. if (sdp->sd_lockstruct.ls_ops->lm_first_done)
  453. sdp->sd_lockstruct.ls_ops->lm_first_done(sdp);
  454. kobject_uevent_env(&sdp->sd_kobj, KOBJ_CHANGE, envp);
  455. }
  456. /**
  457. * gfs2_jindex_hold - Grab a lock on the jindex
  458. * @sdp: The GFS2 superblock
  459. * @ji_gh: the holder for the jindex glock
  460. *
  461. * Returns: errno
  462. */
  463. static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
  464. {
  465. struct gfs2_inode *dip = GFS2_I(sdp->sd_jindex);
  466. struct qstr name;
  467. char buf[20];
  468. struct gfs2_jdesc *jd;
  469. int error;
  470. name.name = buf;
  471. mutex_lock(&sdp->sd_jindex_mutex);
  472. for (;;) {
  473. struct gfs2_inode *jip;
  474. error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
  475. if (error)
  476. break;
  477. name.len = sprintf(buf, "journal%u", sdp->sd_journals);
  478. name.hash = gfs2_disk_hash(name.name, name.len);
  479. error = gfs2_dir_check(sdp->sd_jindex, &name, NULL);
  480. if (error == -ENOENT) {
  481. error = 0;
  482. break;
  483. }
  484. gfs2_glock_dq_uninit(ji_gh);
  485. if (error)
  486. break;
  487. error = -ENOMEM;
  488. jd = kzalloc(sizeof(struct gfs2_jdesc), GFP_KERNEL);
  489. if (!jd)
  490. break;
  491. INIT_LIST_HEAD(&jd->extent_list);
  492. INIT_LIST_HEAD(&jd->jd_revoke_list);
  493. INIT_WORK(&jd->jd_work, gfs2_recover_func);
  494. jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
  495. if (IS_ERR_OR_NULL(jd->jd_inode)) {
  496. if (!jd->jd_inode)
  497. error = -ENOENT;
  498. else
  499. error = PTR_ERR(jd->jd_inode);
  500. kfree(jd);
  501. break;
  502. }
  503. spin_lock(&sdp->sd_jindex_spin);
  504. jd->jd_jid = sdp->sd_journals++;
  505. jip = GFS2_I(jd->jd_inode);
  506. jd->jd_no_addr = jip->i_no_addr;
  507. list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
  508. spin_unlock(&sdp->sd_jindex_spin);
  509. }
  510. mutex_unlock(&sdp->sd_jindex_mutex);
  511. return error;
  512. }
  513. /**
  514. * init_statfs - look up and initialize master and local (per node) statfs inodes
  515. * @sdp: The GFS2 superblock
  516. *
  517. * This should be called after the jindex is initialized in init_journal() and
  518. * before gfs2_journal_recovery() is called because we need to be able to write
  519. * to these inodes during recovery.
  520. *
  521. * Returns: errno
  522. */
  523. static int init_statfs(struct gfs2_sbd *sdp)
  524. {
  525. int error = 0;
  526. struct inode *master = d_inode(sdp->sd_master_dir);
  527. struct inode *pn = NULL;
  528. char buf[30];
  529. struct gfs2_jdesc *jd;
  530. struct gfs2_inode *ip;
  531. sdp->sd_statfs_inode = gfs2_lookup_simple(master, "statfs");
  532. if (IS_ERR(sdp->sd_statfs_inode)) {
  533. error = PTR_ERR(sdp->sd_statfs_inode);
  534. fs_err(sdp, "can't read in statfs inode: %d\n", error);
  535. goto out;
  536. }
  537. if (sdp->sd_args.ar_spectator)
  538. goto out;
  539. pn = gfs2_lookup_simple(master, "per_node");
  540. if (IS_ERR(pn)) {
  541. error = PTR_ERR(pn);
  542. fs_err(sdp, "can't find per_node directory: %d\n", error);
  543. goto put_statfs;
  544. }
  545. /* For each jid, lookup the corresponding local statfs inode in the
  546. * per_node metafs directory and save it in the sdp->sd_sc_inodes_list. */
  547. list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
  548. struct local_statfs_inode *lsi =
  549. kmalloc(sizeof(struct local_statfs_inode), GFP_NOFS);
  550. if (!lsi) {
  551. error = -ENOMEM;
  552. goto free_local;
  553. }
  554. sprintf(buf, "statfs_change%u", jd->jd_jid);
  555. lsi->si_sc_inode = gfs2_lookup_simple(pn, buf);
  556. if (IS_ERR(lsi->si_sc_inode)) {
  557. error = PTR_ERR(lsi->si_sc_inode);
  558. fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
  559. jd->jd_jid, error);
  560. kfree(lsi);
  561. goto free_local;
  562. }
  563. lsi->si_jid = jd->jd_jid;
  564. if (jd->jd_jid == sdp->sd_jdesc->jd_jid)
  565. sdp->sd_sc_inode = lsi->si_sc_inode;
  566. list_add_tail(&lsi->si_list, &sdp->sd_sc_inodes_list);
  567. }
  568. iput(pn);
  569. pn = NULL;
  570. ip = GFS2_I(sdp->sd_sc_inode);
  571. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0,
  572. &sdp->sd_sc_gh);
  573. if (error) {
  574. fs_err(sdp, "can't lock local \"sc\" file: %d\n", error);
  575. goto free_local;
  576. }
  577. return 0;
  578. free_local:
  579. free_local_statfs_inodes(sdp);
  580. iput(pn);
  581. put_statfs:
  582. iput(sdp->sd_statfs_inode);
  583. out:
  584. return error;
  585. }
  586. /* Uninitialize and free up memory used by the list of statfs inodes */
  587. static void uninit_statfs(struct gfs2_sbd *sdp)
  588. {
  589. if (!sdp->sd_args.ar_spectator) {
  590. gfs2_glock_dq_uninit(&sdp->sd_sc_gh);
  591. free_local_statfs_inodes(sdp);
  592. }
  593. iput(sdp->sd_statfs_inode);
  594. }
  595. static int init_journal(struct gfs2_sbd *sdp, int undo)
  596. {
  597. struct inode *master = d_inode(sdp->sd_master_dir);
  598. struct gfs2_holder ji_gh;
  599. struct gfs2_inode *ip;
  600. int jindex = 1;
  601. int error = 0;
  602. if (undo) {
  603. jindex = 0;
  604. goto fail_statfs;
  605. }
  606. sdp->sd_jindex = gfs2_lookup_simple(master, "jindex");
  607. if (IS_ERR(sdp->sd_jindex)) {
  608. fs_err(sdp, "can't lookup journal index: %d\n", error);
  609. return PTR_ERR(sdp->sd_jindex);
  610. }
  611. /* Load in the journal index special file */
  612. error = gfs2_jindex_hold(sdp, &ji_gh);
  613. if (error) {
  614. fs_err(sdp, "can't read journal index: %d\n", error);
  615. goto fail;
  616. }
  617. error = -EUSERS;
  618. if (!gfs2_jindex_size(sdp)) {
  619. fs_err(sdp, "no journals!\n");
  620. goto fail_jindex;
  621. }
  622. atomic_set(&sdp->sd_log_blks_needed, 0);
  623. if (sdp->sd_args.ar_spectator) {
  624. sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0);
  625. atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks);
  626. atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5);
  627. atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5);
  628. } else {
  629. if (sdp->sd_lockstruct.ls_jid >= gfs2_jindex_size(sdp)) {
  630. fs_err(sdp, "can't mount journal #%u\n",
  631. sdp->sd_lockstruct.ls_jid);
  632. fs_err(sdp, "there are only %u journals (0 - %u)\n",
  633. gfs2_jindex_size(sdp),
  634. gfs2_jindex_size(sdp) - 1);
  635. goto fail_jindex;
  636. }
  637. sdp->sd_jdesc = gfs2_jdesc_find(sdp, sdp->sd_lockstruct.ls_jid);
  638. error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
  639. &gfs2_journal_glops,
  640. LM_ST_EXCLUSIVE,
  641. LM_FLAG_NOEXP | GL_NOCACHE,
  642. &sdp->sd_journal_gh);
  643. if (error) {
  644. fs_err(sdp, "can't acquire journal glock: %d\n", error);
  645. goto fail_jindex;
  646. }
  647. ip = GFS2_I(sdp->sd_jdesc->jd_inode);
  648. sdp->sd_jinode_gl = ip->i_gl;
  649. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED,
  650. LM_FLAG_NOEXP | GL_EXACT | GL_NOCACHE,
  651. &sdp->sd_jinode_gh);
  652. if (error) {
  653. fs_err(sdp, "can't acquire journal inode glock: %d\n",
  654. error);
  655. goto fail_journal_gh;
  656. }
  657. error = gfs2_jdesc_check(sdp->sd_jdesc);
  658. if (error) {
  659. fs_err(sdp, "my journal (%u) is bad: %d\n",
  660. sdp->sd_jdesc->jd_jid, error);
  661. goto fail_jinode_gh;
  662. }
  663. atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks);
  664. atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5);
  665. atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5);
  666. /* Map the extents for this journal's blocks */
  667. gfs2_map_journal_extents(sdp, sdp->sd_jdesc);
  668. }
  669. trace_gfs2_log_blocks(sdp, atomic_read(&sdp->sd_log_blks_free));
  670. /* Lookup statfs inodes here so journal recovery can use them. */
  671. error = init_statfs(sdp);
  672. if (error)
  673. goto fail_jinode_gh;
  674. if (sdp->sd_lockstruct.ls_first) {
  675. unsigned int x;
  676. for (x = 0; x < sdp->sd_journals; x++) {
  677. struct gfs2_jdesc *jd = gfs2_jdesc_find(sdp, x);
  678. if (sdp->sd_args.ar_spectator) {
  679. error = check_journal_clean(sdp, jd, true);
  680. if (error)
  681. goto fail_statfs;
  682. continue;
  683. }
  684. error = gfs2_recover_journal(jd, true);
  685. if (error) {
  686. fs_err(sdp, "error recovering journal %u: %d\n",
  687. x, error);
  688. goto fail_statfs;
  689. }
  690. }
  691. gfs2_others_may_mount(sdp);
  692. } else if (!sdp->sd_args.ar_spectator) {
  693. error = gfs2_recover_journal(sdp->sd_jdesc, true);
  694. if (error) {
  695. fs_err(sdp, "error recovering my journal: %d\n", error);
  696. goto fail_statfs;
  697. }
  698. }
  699. sdp->sd_log_idle = 1;
  700. set_bit(SDF_JOURNAL_CHECKED, &sdp->sd_flags);
  701. gfs2_glock_dq_uninit(&ji_gh);
  702. jindex = 0;
  703. INIT_WORK(&sdp->sd_freeze_work, gfs2_freeze_func);
  704. return 0;
  705. fail_statfs:
  706. uninit_statfs(sdp);
  707. fail_jinode_gh:
  708. /* A withdraw may have done dq/uninit so now we need to check it */
  709. if (!sdp->sd_args.ar_spectator &&
  710. gfs2_holder_initialized(&sdp->sd_jinode_gh))
  711. gfs2_glock_dq_uninit(&sdp->sd_jinode_gh);
  712. fail_journal_gh:
  713. if (!sdp->sd_args.ar_spectator &&
  714. gfs2_holder_initialized(&sdp->sd_journal_gh))
  715. gfs2_glock_dq_uninit(&sdp->sd_journal_gh);
  716. fail_jindex:
  717. gfs2_jindex_free(sdp);
  718. if (jindex)
  719. gfs2_glock_dq_uninit(&ji_gh);
  720. fail:
  721. iput(sdp->sd_jindex);
  722. return error;
  723. }
  724. static struct lock_class_key gfs2_quota_imutex_key;
  725. static int init_inodes(struct gfs2_sbd *sdp, int undo)
  726. {
  727. int error = 0;
  728. struct inode *master = d_inode(sdp->sd_master_dir);
  729. if (undo)
  730. goto fail_qinode;
  731. error = init_journal(sdp, undo);
  732. complete_all(&sdp->sd_journal_ready);
  733. if (error)
  734. goto fail;
  735. /* Read in the resource index inode */
  736. sdp->sd_rindex = gfs2_lookup_simple(master, "rindex");
  737. if (IS_ERR(sdp->sd_rindex)) {
  738. error = PTR_ERR(sdp->sd_rindex);
  739. fs_err(sdp, "can't get resource index inode: %d\n", error);
  740. goto fail_journal;
  741. }
  742. sdp->sd_rindex_uptodate = 0;
  743. /* Read in the quota inode */
  744. sdp->sd_quota_inode = gfs2_lookup_simple(master, "quota");
  745. if (IS_ERR(sdp->sd_quota_inode)) {
  746. error = PTR_ERR(sdp->sd_quota_inode);
  747. fs_err(sdp, "can't get quota file inode: %d\n", error);
  748. goto fail_rindex;
  749. }
  750. /*
  751. * i_rwsem on quota files is special. Since this inode is hidden system
  752. * file, we are safe to define locking ourselves.
  753. */
  754. lockdep_set_class(&sdp->sd_quota_inode->i_rwsem,
  755. &gfs2_quota_imutex_key);
  756. error = gfs2_rindex_update(sdp);
  757. if (error)
  758. goto fail_qinode;
  759. return 0;
  760. fail_qinode:
  761. iput(sdp->sd_quota_inode);
  762. fail_rindex:
  763. gfs2_clear_rgrpd(sdp);
  764. iput(sdp->sd_rindex);
  765. fail_journal:
  766. init_journal(sdp, UNDO);
  767. fail:
  768. return error;
  769. }
  770. static int init_per_node(struct gfs2_sbd *sdp, int undo)
  771. {
  772. struct inode *pn = NULL;
  773. char buf[30];
  774. int error = 0;
  775. struct gfs2_inode *ip;
  776. struct inode *master = d_inode(sdp->sd_master_dir);
  777. if (sdp->sd_args.ar_spectator)
  778. return 0;
  779. if (undo)
  780. goto fail_qc_gh;
  781. pn = gfs2_lookup_simple(master, "per_node");
  782. if (IS_ERR(pn)) {
  783. error = PTR_ERR(pn);
  784. fs_err(sdp, "can't find per_node directory: %d\n", error);
  785. return error;
  786. }
  787. sprintf(buf, "quota_change%u", sdp->sd_jdesc->jd_jid);
  788. sdp->sd_qc_inode = gfs2_lookup_simple(pn, buf);
  789. if (IS_ERR(sdp->sd_qc_inode)) {
  790. error = PTR_ERR(sdp->sd_qc_inode);
  791. fs_err(sdp, "can't find local \"qc\" file: %d\n", error);
  792. goto fail_ut_i;
  793. }
  794. iput(pn);
  795. pn = NULL;
  796. ip = GFS2_I(sdp->sd_qc_inode);
  797. error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0,
  798. &sdp->sd_qc_gh);
  799. if (error) {
  800. fs_err(sdp, "can't lock local \"qc\" file: %d\n", error);
  801. goto fail_qc_i;
  802. }
  803. return 0;
  804. fail_qc_gh:
  805. gfs2_glock_dq_uninit(&sdp->sd_qc_gh);
  806. fail_qc_i:
  807. iput(sdp->sd_qc_inode);
  808. fail_ut_i:
  809. iput(pn);
  810. return error;
  811. }
  812. static const match_table_t nolock_tokens = {
  813. { Opt_jid, "jid=%d", },
  814. { Opt_err, NULL },
  815. };
  816. static const struct lm_lockops nolock_ops = {
  817. .lm_proto_name = "lock_nolock",
  818. .lm_put_lock = gfs2_glock_free,
  819. .lm_tokens = &nolock_tokens,
  820. };
  821. /**
  822. * gfs2_lm_mount - mount a locking protocol
  823. * @sdp: the filesystem
  824. * @args: mount arguments
  825. * @silent: if 1, don't complain if the FS isn't a GFS2 fs
  826. *
  827. * Returns: errno
  828. */
  829. static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
  830. {
  831. const struct lm_lockops *lm;
  832. struct lm_lockstruct *ls = &sdp->sd_lockstruct;
  833. struct gfs2_args *args = &sdp->sd_args;
  834. const char *proto = sdp->sd_proto_name;
  835. const char *table = sdp->sd_table_name;
  836. char *o, *options;
  837. int ret;
  838. if (!strcmp("lock_nolock", proto)) {
  839. lm = &nolock_ops;
  840. sdp->sd_args.ar_localflocks = 1;
  841. #ifdef CONFIG_GFS2_FS_LOCKING_DLM
  842. } else if (!strcmp("lock_dlm", proto)) {
  843. lm = &gfs2_dlm_ops;
  844. #endif
  845. } else {
  846. pr_info("can't find protocol %s\n", proto);
  847. return -ENOENT;
  848. }
  849. fs_info(sdp, "Trying to join cluster \"%s\", \"%s\"\n", proto, table);
  850. ls->ls_ops = lm;
  851. ls->ls_first = 1;
  852. for (options = args->ar_hostdata; (o = strsep(&options, ":")); ) {
  853. substring_t tmp[MAX_OPT_ARGS];
  854. int token, option;
  855. if (!o || !*o)
  856. continue;
  857. token = match_token(o, *lm->lm_tokens, tmp);
  858. switch (token) {
  859. case Opt_jid:
  860. ret = match_int(&tmp[0], &option);
  861. if (ret || option < 0)
  862. goto hostdata_error;
  863. if (test_and_clear_bit(SDF_NOJOURNALID, &sdp->sd_flags))
  864. ls->ls_jid = option;
  865. break;
  866. case Opt_id:
  867. case Opt_nodir:
  868. /* Obsolete, but left for backward compat purposes */
  869. break;
  870. case Opt_first:
  871. ret = match_int(&tmp[0], &option);
  872. if (ret || (option != 0 && option != 1))
  873. goto hostdata_error;
  874. ls->ls_first = option;
  875. break;
  876. case Opt_err:
  877. default:
  878. hostdata_error:
  879. fs_info(sdp, "unknown hostdata (%s)\n", o);
  880. return -EINVAL;
  881. }
  882. }
  883. if (lm->lm_mount == NULL) {
  884. fs_info(sdp, "Now mounting FS...\n");
  885. complete_all(&sdp->sd_locking_init);
  886. return 0;
  887. }
  888. ret = lm->lm_mount(sdp, table);
  889. if (ret == 0)
  890. fs_info(sdp, "Joined cluster. Now mounting FS...\n");
  891. complete_all(&sdp->sd_locking_init);
  892. return ret;
  893. }
  894. void gfs2_lm_unmount(struct gfs2_sbd *sdp)
  895. {
  896. const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops;
  897. if (likely(!gfs2_withdrawn(sdp)) && lm->lm_unmount)
  898. lm->lm_unmount(sdp);
  899. }
  900. static int wait_on_journal(struct gfs2_sbd *sdp)
  901. {
  902. if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL)
  903. return 0;
  904. return wait_on_bit(&sdp->sd_flags, SDF_NOJOURNALID, TASK_INTERRUPTIBLE)
  905. ? -EINTR : 0;
  906. }
  907. void gfs2_online_uevent(struct gfs2_sbd *sdp)
  908. {
  909. struct super_block *sb = sdp->sd_vfs;
  910. char ro[20];
  911. char spectator[20];
  912. char *envp[] = { ro, spectator, NULL };
  913. sprintf(ro, "RDONLY=%d", sb_rdonly(sb));
  914. sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0);
  915. kobject_uevent_env(&sdp->sd_kobj, KOBJ_ONLINE, envp);
  916. }
  917. static int init_threads(struct gfs2_sbd *sdp)
  918. {
  919. struct task_struct *p;
  920. int error = 0;
  921. p = kthread_run(gfs2_logd, sdp, "gfs2_logd");
  922. if (IS_ERR(p)) {
  923. error = PTR_ERR(p);
  924. fs_err(sdp, "can't start logd thread: %d\n", error);
  925. return error;
  926. }
  927. sdp->sd_logd_process = p;
  928. p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad");
  929. if (IS_ERR(p)) {
  930. error = PTR_ERR(p);
  931. fs_err(sdp, "can't start quotad thread: %d\n", error);
  932. goto fail;
  933. }
  934. sdp->sd_quotad_process = p;
  935. return 0;
  936. fail:
  937. kthread_stop(sdp->sd_logd_process);
  938. sdp->sd_logd_process = NULL;
  939. return error;
  940. }
  941. /**
  942. * gfs2_fill_super - Read in superblock
  943. * @sb: The VFS superblock
  944. * @args: Mount options
  945. * @silent: Don't complain if it's not a GFS2 filesystem
  946. *
  947. * Returns: -errno
  948. */
  949. static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
  950. {
  951. struct gfs2_args *args = fc->fs_private;
  952. int silent = fc->sb_flags & SB_SILENT;
  953. struct gfs2_sbd *sdp;
  954. struct gfs2_holder mount_gh;
  955. struct gfs2_holder freeze_gh;
  956. int error;
  957. sdp = init_sbd(sb);
  958. if (!sdp) {
  959. pr_warn("can't alloc struct gfs2_sbd\n");
  960. return -ENOMEM;
  961. }
  962. sdp->sd_args = *args;
  963. if (sdp->sd_args.ar_spectator) {
  964. sb->s_flags |= SB_RDONLY;
  965. set_bit(SDF_RORECOVERY, &sdp->sd_flags);
  966. }
  967. if (sdp->sd_args.ar_posix_acl)
  968. sb->s_flags |= SB_POSIXACL;
  969. if (sdp->sd_args.ar_nobarrier)
  970. set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
  971. sb->s_flags |= SB_NOSEC;
  972. sb->s_magic = GFS2_MAGIC;
  973. sb->s_op = &gfs2_super_ops;
  974. sb->s_d_op = &gfs2_dops;
  975. sb->s_export_op = &gfs2_export_ops;
  976. sb->s_xattr = gfs2_xattr_handlers;
  977. sb->s_qcop = &gfs2_quotactl_ops;
  978. sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
  979. sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
  980. sb->s_time_gran = 1;
  981. sb->s_maxbytes = MAX_LFS_FILESIZE;
  982. /* Set up the buffer cache and fill in some fake block size values
  983. to allow us to read-in the on-disk superblock. */
  984. sdp->sd_sb.sb_bsize = sb_min_blocksize(sb, GFS2_BASIC_BLOCK);
  985. sdp->sd_sb.sb_bsize_shift = sb->s_blocksize_bits;
  986. sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
  987. GFS2_BASIC_BLOCK_SHIFT;
  988. sdp->sd_fsb2bb = BIT(sdp->sd_fsb2bb_shift);
  989. sdp->sd_tune.gt_logd_secs = sdp->sd_args.ar_commit;
  990. sdp->sd_tune.gt_quota_quantum = sdp->sd_args.ar_quota_quantum;
  991. if (sdp->sd_args.ar_statfs_quantum) {
  992. sdp->sd_tune.gt_statfs_slow = 0;
  993. sdp->sd_tune.gt_statfs_quantum = sdp->sd_args.ar_statfs_quantum;
  994. } else {
  995. sdp->sd_tune.gt_statfs_slow = 1;
  996. sdp->sd_tune.gt_statfs_quantum = 30;
  997. }
  998. error = init_names(sdp, silent);
  999. if (error)
  1000. goto fail_free;
  1001. snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s", sdp->sd_table_name);
  1002. error = gfs2_sys_fs_add(sdp);
  1003. if (error)
  1004. goto fail_free;
  1005. gfs2_create_debugfs_file(sdp);
  1006. error = gfs2_lm_mount(sdp, silent);
  1007. if (error)
  1008. goto fail_debug;
  1009. error = init_locking(sdp, &mount_gh, DO);
  1010. if (error)
  1011. goto fail_lm;
  1012. error = init_sb(sdp, silent);
  1013. if (error)
  1014. goto fail_locking;
  1015. error = wait_on_journal(sdp);
  1016. if (error)
  1017. goto fail_sb;
  1018. /*
  1019. * If user space has failed to join the cluster or some similar
  1020. * failure has occurred, then the journal id will contain a
  1021. * negative (error) number. This will then be returned to the
  1022. * caller (of the mount syscall). We do this even for spectator
  1023. * mounts (which just write a jid of 0 to indicate "ok" even though
  1024. * the jid is unused in the spectator case)
  1025. */
  1026. if (sdp->sd_lockstruct.ls_jid < 0) {
  1027. error = sdp->sd_lockstruct.ls_jid;
  1028. sdp->sd_lockstruct.ls_jid = 0;
  1029. goto fail_sb;
  1030. }
  1031. if (sdp->sd_args.ar_spectator)
  1032. snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s.s",
  1033. sdp->sd_table_name);
  1034. else
  1035. snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s.%u",
  1036. sdp->sd_table_name, sdp->sd_lockstruct.ls_jid);
  1037. error = init_inodes(sdp, DO);
  1038. if (error)
  1039. goto fail_sb;
  1040. error = init_per_node(sdp, DO);
  1041. if (error)
  1042. goto fail_inodes;
  1043. error = gfs2_statfs_init(sdp);
  1044. if (error) {
  1045. fs_err(sdp, "can't initialize statfs subsystem: %d\n", error);
  1046. goto fail_per_node;
  1047. }
  1048. if (!sb_rdonly(sb)) {
  1049. error = init_threads(sdp);
  1050. if (error) {
  1051. gfs2_withdraw_delayed(sdp);
  1052. goto fail_per_node;
  1053. }
  1054. }
  1055. error = gfs2_freeze_lock(sdp, &freeze_gh, 0);
  1056. if (error)
  1057. goto fail_per_node;
  1058. if (!sb_rdonly(sb))
  1059. error = gfs2_make_fs_rw(sdp);
  1060. gfs2_freeze_unlock(&freeze_gh);
  1061. if (error) {
  1062. if (sdp->sd_quotad_process)
  1063. kthread_stop(sdp->sd_quotad_process);
  1064. sdp->sd_quotad_process = NULL;
  1065. if (sdp->sd_logd_process)
  1066. kthread_stop(sdp->sd_logd_process);
  1067. sdp->sd_logd_process = NULL;
  1068. fs_err(sdp, "can't make FS RW: %d\n", error);
  1069. goto fail_per_node;
  1070. }
  1071. gfs2_glock_dq_uninit(&mount_gh);
  1072. gfs2_online_uevent(sdp);
  1073. return 0;
  1074. fail_per_node:
  1075. init_per_node(sdp, UNDO);
  1076. fail_inodes:
  1077. init_inodes(sdp, UNDO);
  1078. fail_sb:
  1079. if (sdp->sd_root_dir)
  1080. dput(sdp->sd_root_dir);
  1081. if (sdp->sd_master_dir)
  1082. dput(sdp->sd_master_dir);
  1083. if (sb->s_root)
  1084. dput(sb->s_root);
  1085. sb->s_root = NULL;
  1086. fail_locking:
  1087. init_locking(sdp, &mount_gh, UNDO);
  1088. fail_lm:
  1089. complete_all(&sdp->sd_journal_ready);
  1090. gfs2_gl_hash_clear(sdp);
  1091. gfs2_lm_unmount(sdp);
  1092. fail_debug:
  1093. gfs2_delete_debugfs_file(sdp);
  1094. gfs2_sys_fs_del(sdp);
  1095. fail_free:
  1096. free_sbd(sdp);
  1097. sb->s_fs_info = NULL;
  1098. return error;
  1099. }
  1100. /**
  1101. * gfs2_get_tree - Get the GFS2 superblock and root directory
  1102. * @fc: The filesystem context
  1103. *
  1104. * Returns: 0 or -errno on error
  1105. */
  1106. static int gfs2_get_tree(struct fs_context *fc)
  1107. {
  1108. struct gfs2_args *args = fc->fs_private;
  1109. struct gfs2_sbd *sdp;
  1110. int error;
  1111. error = get_tree_bdev(fc, gfs2_fill_super);
  1112. if (error)
  1113. return error;
  1114. sdp = fc->root->d_sb->s_fs_info;
  1115. dput(fc->root);
  1116. if (args->ar_meta)
  1117. fc->root = dget(sdp->sd_master_dir);
  1118. else
  1119. fc->root = dget(sdp->sd_root_dir);
  1120. return 0;
  1121. }
  1122. static void gfs2_fc_free(struct fs_context *fc)
  1123. {
  1124. struct gfs2_args *args = fc->fs_private;
  1125. kfree(args);
  1126. }
  1127. enum gfs2_param {
  1128. Opt_lockproto,
  1129. Opt_locktable,
  1130. Opt_hostdata,
  1131. Opt_spectator,
  1132. Opt_ignore_local_fs,
  1133. Opt_localflocks,
  1134. Opt_localcaching,
  1135. Opt_debug,
  1136. Opt_upgrade,
  1137. Opt_acl,
  1138. Opt_quota,
  1139. Opt_quota_flag,
  1140. Opt_suiddir,
  1141. Opt_data,
  1142. Opt_meta,
  1143. Opt_discard,
  1144. Opt_commit,
  1145. Opt_errors,
  1146. Opt_statfs_quantum,
  1147. Opt_statfs_percent,
  1148. Opt_quota_quantum,
  1149. Opt_barrier,
  1150. Opt_rgrplvb,
  1151. Opt_loccookie,
  1152. };
  1153. static const struct constant_table gfs2_param_quota[] = {
  1154. {"off", GFS2_QUOTA_OFF},
  1155. {"account", GFS2_QUOTA_ACCOUNT},
  1156. {"on", GFS2_QUOTA_ON},
  1157. {}
  1158. };
  1159. enum opt_data {
  1160. Opt_data_writeback = GFS2_DATA_WRITEBACK,
  1161. Opt_data_ordered = GFS2_DATA_ORDERED,
  1162. };
  1163. static const struct constant_table gfs2_param_data[] = {
  1164. {"writeback", Opt_data_writeback },
  1165. {"ordered", Opt_data_ordered },
  1166. {}
  1167. };
  1168. enum opt_errors {
  1169. Opt_errors_withdraw = GFS2_ERRORS_WITHDRAW,
  1170. Opt_errors_panic = GFS2_ERRORS_PANIC,
  1171. };
  1172. static const struct constant_table gfs2_param_errors[] = {
  1173. {"withdraw", Opt_errors_withdraw },
  1174. {"panic", Opt_errors_panic },
  1175. {}
  1176. };
  1177. static const struct fs_parameter_spec gfs2_fs_parameters[] = {
  1178. fsparam_string ("lockproto", Opt_lockproto),
  1179. fsparam_string ("locktable", Opt_locktable),
  1180. fsparam_string ("hostdata", Opt_hostdata),
  1181. fsparam_flag ("spectator", Opt_spectator),
  1182. fsparam_flag ("norecovery", Opt_spectator),
  1183. fsparam_flag ("ignore_local_fs", Opt_ignore_local_fs),
  1184. fsparam_flag ("localflocks", Opt_localflocks),
  1185. fsparam_flag ("localcaching", Opt_localcaching),
  1186. fsparam_flag_no("debug", Opt_debug),
  1187. fsparam_flag ("upgrade", Opt_upgrade),
  1188. fsparam_flag_no("acl", Opt_acl),
  1189. fsparam_flag_no("suiddir", Opt_suiddir),
  1190. fsparam_enum ("data", Opt_data, gfs2_param_data),
  1191. fsparam_flag ("meta", Opt_meta),
  1192. fsparam_flag_no("discard", Opt_discard),
  1193. fsparam_s32 ("commit", Opt_commit),
  1194. fsparam_enum ("errors", Opt_errors, gfs2_param_errors),
  1195. fsparam_s32 ("statfs_quantum", Opt_statfs_quantum),
  1196. fsparam_s32 ("statfs_percent", Opt_statfs_percent),
  1197. fsparam_s32 ("quota_quantum", Opt_quota_quantum),
  1198. fsparam_flag_no("barrier", Opt_barrier),
  1199. fsparam_flag_no("rgrplvb", Opt_rgrplvb),
  1200. fsparam_flag_no("loccookie", Opt_loccookie),
  1201. /* quota can be a flag or an enum so it gets special treatment */
  1202. fsparam_flag_no("quota", Opt_quota_flag),
  1203. fsparam_enum("quota", Opt_quota, gfs2_param_quota),
  1204. {}
  1205. };
  1206. /* Parse a single mount parameter */
  1207. static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param)
  1208. {
  1209. struct gfs2_args *args = fc->fs_private;
  1210. struct fs_parse_result result;
  1211. int o;
  1212. o = fs_parse(fc, gfs2_fs_parameters, param, &result);
  1213. if (o < 0)
  1214. return o;
  1215. switch (o) {
  1216. case Opt_lockproto:
  1217. strlcpy(args->ar_lockproto, param->string, GFS2_LOCKNAME_LEN);
  1218. break;
  1219. case Opt_locktable:
  1220. strlcpy(args->ar_locktable, param->string, GFS2_LOCKNAME_LEN);
  1221. break;
  1222. case Opt_hostdata:
  1223. strlcpy(args->ar_hostdata, param->string, GFS2_LOCKNAME_LEN);
  1224. break;
  1225. case Opt_spectator:
  1226. args->ar_spectator = 1;
  1227. break;
  1228. case Opt_ignore_local_fs:
  1229. /* Retained for backwards compat only */
  1230. break;
  1231. case Opt_localflocks:
  1232. args->ar_localflocks = 1;
  1233. break;
  1234. case Opt_localcaching:
  1235. /* Retained for backwards compat only */
  1236. break;
  1237. case Opt_debug:
  1238. if (result.boolean && args->ar_errors == GFS2_ERRORS_PANIC)
  1239. return invalfc(fc, "-o debug and -o errors=panic are mutually exclusive");
  1240. args->ar_debug = result.boolean;
  1241. break;
  1242. case Opt_upgrade:
  1243. /* Retained for backwards compat only */
  1244. break;
  1245. case Opt_acl:
  1246. args->ar_posix_acl = result.boolean;
  1247. break;
  1248. case Opt_quota_flag:
  1249. args->ar_quota = result.negated ? GFS2_QUOTA_OFF : GFS2_QUOTA_ON;
  1250. break;
  1251. case Opt_quota:
  1252. args->ar_quota = result.int_32;
  1253. break;
  1254. case Opt_suiddir:
  1255. args->ar_suiddir = result.boolean;
  1256. break;
  1257. case Opt_data:
  1258. /* The uint_32 result maps directly to GFS2_DATA_* */
  1259. args->ar_data = result.uint_32;
  1260. break;
  1261. case Opt_meta:
  1262. args->ar_meta = 1;
  1263. break;
  1264. case Opt_discard:
  1265. args->ar_discard = result.boolean;
  1266. break;
  1267. case Opt_commit:
  1268. if (result.int_32 <= 0)
  1269. return invalfc(fc, "commit mount option requires a positive numeric argument");
  1270. args->ar_commit = result.int_32;
  1271. break;
  1272. case Opt_statfs_quantum:
  1273. if (result.int_32 < 0)
  1274. return invalfc(fc, "statfs_quantum mount option requires a non-negative numeric argument");
  1275. args->ar_statfs_quantum = result.int_32;
  1276. break;
  1277. case Opt_quota_quantum:
  1278. if (result.int_32 <= 0)
  1279. return invalfc(fc, "quota_quantum mount option requires a positive numeric argument");
  1280. args->ar_quota_quantum = result.int_32;
  1281. break;
  1282. case Opt_statfs_percent:
  1283. if (result.int_32 < 0 || result.int_32 > 100)
  1284. return invalfc(fc, "statfs_percent mount option requires a numeric argument between 0 and 100");
  1285. args->ar_statfs_percent = result.int_32;
  1286. break;
  1287. case Opt_errors:
  1288. if (args->ar_debug && result.uint_32 == GFS2_ERRORS_PANIC)
  1289. return invalfc(fc, "-o debug and -o errors=panic are mutually exclusive");
  1290. args->ar_errors = result.uint_32;
  1291. break;
  1292. case Opt_barrier:
  1293. args->ar_nobarrier = result.boolean;
  1294. break;
  1295. case Opt_rgrplvb:
  1296. args->ar_rgrplvb = result.boolean;
  1297. break;
  1298. case Opt_loccookie:
  1299. args->ar_loccookie = result.boolean;
  1300. break;
  1301. default:
  1302. return invalfc(fc, "invalid mount option: %s", param->key);
  1303. }
  1304. return 0;
  1305. }
  1306. static int gfs2_reconfigure(struct fs_context *fc)
  1307. {
  1308. struct super_block *sb = fc->root->d_sb;
  1309. struct gfs2_sbd *sdp = sb->s_fs_info;
  1310. struct gfs2_args *oldargs = &sdp->sd_args;
  1311. struct gfs2_args *newargs = fc->fs_private;
  1312. struct gfs2_tune *gt = &sdp->sd_tune;
  1313. int error = 0;
  1314. sync_filesystem(sb);
  1315. spin_lock(&gt->gt_spin);
  1316. oldargs->ar_commit = gt->gt_logd_secs;
  1317. oldargs->ar_quota_quantum = gt->gt_quota_quantum;
  1318. if (gt->gt_statfs_slow)
  1319. oldargs->ar_statfs_quantum = 0;
  1320. else
  1321. oldargs->ar_statfs_quantum = gt->gt_statfs_quantum;
  1322. spin_unlock(&gt->gt_spin);
  1323. if (strcmp(newargs->ar_lockproto, oldargs->ar_lockproto)) {
  1324. errorfc(fc, "reconfiguration of locking protocol not allowed");
  1325. return -EINVAL;
  1326. }
  1327. if (strcmp(newargs->ar_locktable, oldargs->ar_locktable)) {
  1328. errorfc(fc, "reconfiguration of lock table not allowed");
  1329. return -EINVAL;
  1330. }
  1331. if (strcmp(newargs->ar_hostdata, oldargs->ar_hostdata)) {
  1332. errorfc(fc, "reconfiguration of host data not allowed");
  1333. return -EINVAL;
  1334. }
  1335. if (newargs->ar_spectator != oldargs->ar_spectator) {
  1336. errorfc(fc, "reconfiguration of spectator mode not allowed");
  1337. return -EINVAL;
  1338. }
  1339. if (newargs->ar_localflocks != oldargs->ar_localflocks) {
  1340. errorfc(fc, "reconfiguration of localflocks not allowed");
  1341. return -EINVAL;
  1342. }
  1343. if (newargs->ar_meta != oldargs->ar_meta) {
  1344. errorfc(fc, "switching between gfs2 and gfs2meta not allowed");
  1345. return -EINVAL;
  1346. }
  1347. if (oldargs->ar_spectator)
  1348. fc->sb_flags |= SB_RDONLY;
  1349. if ((sb->s_flags ^ fc->sb_flags) & SB_RDONLY) {
  1350. struct gfs2_holder freeze_gh;
  1351. error = gfs2_freeze_lock(sdp, &freeze_gh, 0);
  1352. if (error)
  1353. return -EINVAL;
  1354. if (fc->sb_flags & SB_RDONLY) {
  1355. error = gfs2_make_fs_ro(sdp);
  1356. if (error)
  1357. errorfc(fc, "unable to remount read-only");
  1358. } else {
  1359. error = gfs2_make_fs_rw(sdp);
  1360. if (error)
  1361. errorfc(fc, "unable to remount read-write");
  1362. }
  1363. gfs2_freeze_unlock(&freeze_gh);
  1364. }
  1365. sdp->sd_args = *newargs;
  1366. if (sdp->sd_args.ar_posix_acl)
  1367. sb->s_flags |= SB_POSIXACL;
  1368. else
  1369. sb->s_flags &= ~SB_POSIXACL;
  1370. if (sdp->sd_args.ar_nobarrier)
  1371. set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
  1372. else
  1373. clear_bit(SDF_NOBARRIERS, &sdp->sd_flags);
  1374. spin_lock(&gt->gt_spin);
  1375. gt->gt_logd_secs = newargs->ar_commit;
  1376. gt->gt_quota_quantum = newargs->ar_quota_quantum;
  1377. if (newargs->ar_statfs_quantum) {
  1378. gt->gt_statfs_slow = 0;
  1379. gt->gt_statfs_quantum = newargs->ar_statfs_quantum;
  1380. }
  1381. else {
  1382. gt->gt_statfs_slow = 1;
  1383. gt->gt_statfs_quantum = 30;
  1384. }
  1385. spin_unlock(&gt->gt_spin);
  1386. gfs2_online_uevent(sdp);
  1387. return error;
  1388. }
  1389. static const struct fs_context_operations gfs2_context_ops = {
  1390. .free = gfs2_fc_free,
  1391. .parse_param = gfs2_parse_param,
  1392. .get_tree = gfs2_get_tree,
  1393. .reconfigure = gfs2_reconfigure,
  1394. };
  1395. /* Set up the filesystem mount context */
  1396. static int gfs2_init_fs_context(struct fs_context *fc)
  1397. {
  1398. struct gfs2_args *args;
  1399. args = kmalloc(sizeof(*args), GFP_KERNEL);
  1400. if (args == NULL)
  1401. return -ENOMEM;
  1402. if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
  1403. struct gfs2_sbd *sdp = fc->root->d_sb->s_fs_info;
  1404. *args = sdp->sd_args;
  1405. } else {
  1406. memset(args, 0, sizeof(*args));
  1407. args->ar_quota = GFS2_QUOTA_DEFAULT;
  1408. args->ar_data = GFS2_DATA_DEFAULT;
  1409. args->ar_commit = 30;
  1410. args->ar_statfs_quantum = 30;
  1411. args->ar_quota_quantum = 60;
  1412. args->ar_errors = GFS2_ERRORS_DEFAULT;
  1413. }
  1414. fc->fs_private = args;
  1415. fc->ops = &gfs2_context_ops;
  1416. return 0;
  1417. }
  1418. static int set_meta_super(struct super_block *s, struct fs_context *fc)
  1419. {
  1420. return -EINVAL;
  1421. }
  1422. static int test_meta_super(struct super_block *s, struct fs_context *fc)
  1423. {
  1424. return (fc->sget_key == s->s_bdev);
  1425. }
  1426. static int gfs2_meta_get_tree(struct fs_context *fc)
  1427. {
  1428. struct super_block *s;
  1429. struct gfs2_sbd *sdp;
  1430. struct path path;
  1431. int error;
  1432. if (!fc->source || !*fc->source)
  1433. return -EINVAL;
  1434. error = kern_path(fc->source, LOOKUP_FOLLOW, &path);
  1435. if (error) {
  1436. pr_warn("path_lookup on %s returned error %d\n",
  1437. fc->source, error);
  1438. return error;
  1439. }
  1440. fc->fs_type = &gfs2_fs_type;
  1441. fc->sget_key = path.dentry->d_sb->s_bdev;
  1442. s = sget_fc(fc, test_meta_super, set_meta_super);
  1443. path_put(&path);
  1444. if (IS_ERR(s)) {
  1445. pr_warn("gfs2 mount does not exist\n");
  1446. return PTR_ERR(s);
  1447. }
  1448. if ((fc->sb_flags ^ s->s_flags) & SB_RDONLY) {
  1449. deactivate_locked_super(s);
  1450. return -EBUSY;
  1451. }
  1452. sdp = s->s_fs_info;
  1453. fc->root = dget(sdp->sd_master_dir);
  1454. return 0;
  1455. }
  1456. static const struct fs_context_operations gfs2_meta_context_ops = {
  1457. .free = gfs2_fc_free,
  1458. .get_tree = gfs2_meta_get_tree,
  1459. };
  1460. static int gfs2_meta_init_fs_context(struct fs_context *fc)
  1461. {
  1462. int ret = gfs2_init_fs_context(fc);
  1463. if (ret)
  1464. return ret;
  1465. fc->ops = &gfs2_meta_context_ops;
  1466. return 0;
  1467. }
  1468. static void gfs2_kill_sb(struct super_block *sb)
  1469. {
  1470. struct gfs2_sbd *sdp = sb->s_fs_info;
  1471. if (sdp == NULL) {
  1472. kill_block_super(sb);
  1473. return;
  1474. }
  1475. gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_SYNC | GFS2_LFC_KILL_SB);
  1476. dput(sdp->sd_root_dir);
  1477. dput(sdp->sd_master_dir);
  1478. sdp->sd_root_dir = NULL;
  1479. sdp->sd_master_dir = NULL;
  1480. shrink_dcache_sb(sb);
  1481. kill_block_super(sb);
  1482. }
  1483. struct file_system_type gfs2_fs_type = {
  1484. .name = "gfs2",
  1485. .fs_flags = FS_REQUIRES_DEV,
  1486. .init_fs_context = gfs2_init_fs_context,
  1487. .parameters = gfs2_fs_parameters,
  1488. .kill_sb = gfs2_kill_sb,
  1489. .owner = THIS_MODULE,
  1490. };
  1491. MODULE_ALIAS_FS("gfs2");
  1492. struct file_system_type gfs2meta_fs_type = {
  1493. .name = "gfs2meta",
  1494. .fs_flags = FS_REQUIRES_DEV,
  1495. .init_fs_context = gfs2_meta_init_fs_context,
  1496. .owner = THIS_MODULE,
  1497. };
  1498. MODULE_ALIAS_FS("gfs2meta");