diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-24 20:57:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-24 20:57:05 -0400 |
commit | 801b03653fc04de2cc5bc83c06de504d41345b63 (patch) | |
tree | e77de2bc0198d82c5286a8f28f58cd0945212880 /fs/gfs2/sys.c | |
parent | 614a6d4341b3760ca98a1c2c09141b71db5d1e90 (diff) | |
parent | 15e1c960227dc22d976c270fc854dfe363c04bbd (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw
Pull GFS2 updates from Steven Whitehouse.
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw:
GFS2: Eliminate 64-bit divides
GFS2: Reduce file fragmentation
GFS2: kernel panic with small gfs2 filesystems - 1 RG
GFS2: Fixing double brelse'ing bh allocated in gfs2_meta_read when EIO occurs
GFS2: Combine functions get_local_rgrp and gfs2_inplace_reserve
GFS2: Add kobject release method
GFS2: Size seq_file buffer more carefully
GFS2: Use seq_vprintf for glocks debugfs file
seq_file: Add seq_vprintf function and export it
GFS2: Use lvbs for storing rgrp information with mount option
GFS2: Cache last hash bucket for glock seq_files
GFS2: Increase buffer size for glocks and glstats debugfs files
GFS2: Fix error handling when reading an invalid block from the journal
GFS2: Add "top dir" flag support
GFS2: Fold quota data into the reservations struct
GFS2: Extend the life of the reservations
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r-- | fs/gfs2/sys.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 73ecc34c4342..8056b7b7238e 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c | |||
@@ -276,7 +276,15 @@ static struct attribute *gfs2_attrs[] = { | |||
276 | NULL, | 276 | NULL, |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static void gfs2_sbd_release(struct kobject *kobj) | ||
280 | { | ||
281 | struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj); | ||
282 | |||
283 | kfree(sdp); | ||
284 | } | ||
285 | |||
279 | static struct kobj_type gfs2_ktype = { | 286 | static struct kobj_type gfs2_ktype = { |
287 | .release = gfs2_sbd_release, | ||
280 | .default_attrs = gfs2_attrs, | 288 | .default_attrs = gfs2_attrs, |
281 | .sysfs_ops = &gfs2_attr_ops, | 289 | .sysfs_ops = &gfs2_attr_ops, |
282 | }; | 290 | }; |
@@ -583,6 +591,7 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
583 | char ro[20]; | 591 | char ro[20]; |
584 | char spectator[20]; | 592 | char spectator[20]; |
585 | char *envp[] = { ro, spectator, NULL }; | 593 | char *envp[] = { ro, spectator, NULL }; |
594 | int sysfs_frees_sdp = 0; | ||
586 | 595 | ||
587 | sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); | 596 | sprintf(ro, "RDONLY=%d", (sb->s_flags & MS_RDONLY) ? 1 : 0); |
588 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); | 597 | sprintf(spectator, "SPECTATOR=%d", sdp->sd_args.ar_spectator ? 1 : 0); |
@@ -591,8 +600,10 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp) | |||
591 | error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, | 600 | error = kobject_init_and_add(&sdp->sd_kobj, &gfs2_ktype, NULL, |
592 | "%s", sdp->sd_table_name); | 601 | "%s", sdp->sd_table_name); |
593 | if (error) | 602 | if (error) |
594 | goto fail; | 603 | goto fail_reg; |
595 | 604 | ||
605 | sysfs_frees_sdp = 1; /* Freeing sdp is now done by sysfs calling | ||
606 | function gfs2_sbd_release. */ | ||
596 | error = sysfs_create_group(&sdp->sd_kobj, &tune_group); | 607 | error = sysfs_create_group(&sdp->sd_kobj, &tune_group); |
597 | if (error) | 608 | if (error) |
598 | goto fail_reg; | 609 | goto fail_reg; |
@@ -615,9 +626,13 @@ fail_lock_module: | |||
615 | fail_tune: | 626 | fail_tune: |
616 | sysfs_remove_group(&sdp->sd_kobj, &tune_group); | 627 | sysfs_remove_group(&sdp->sd_kobj, &tune_group); |
617 | fail_reg: | 628 | fail_reg: |
618 | kobject_put(&sdp->sd_kobj); | 629 | free_percpu(sdp->sd_lkstats); |
619 | fail: | ||
620 | fs_err(sdp, "error %d adding sysfs files", error); | 630 | fs_err(sdp, "error %d adding sysfs files", error); |
631 | if (sysfs_frees_sdp) | ||
632 | kobject_put(&sdp->sd_kobj); | ||
633 | else | ||
634 | kfree(sdp); | ||
635 | sb->s_fs_info = NULL; | ||
621 | return error; | 636 | return error; |
622 | } | 637 | } |
623 | 638 | ||