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