aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/super.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 17:51:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 17:51:52 -0500
commitbbbd27e694ce2c5fde9c8fcedbea618dd9153fe7 (patch)
tree8811b690085ac784ef73c7b4cdff30c6bedd0e34 /fs/ext3/super.c
parenta6590b9f01dca2d45a38b8387f59812c44f68a2f (diff)
parent712ddc52ffa1f5324cd8f682d9e5b047b91f34d3 (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull ext2, ext3, udf updates from Jan Kara: "Several UDF fixes, a support for UDF extent cache, and couple of ext2 and ext3 cleanups and minor fixes" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: Ext2: remove the static function release_blocks to optimize the kernel Ext2: mark inode dirty after the function dquot_free_block_nodirty is called Ext2: remove the overhead check about sb in the function ext2_new_blocks udf: Remove unused s_extLength from udf_bitmap udf: Make s_block_bitmap standard array udf: Fix bitmap overflow on large filesystems with small block size udf: add extent cache support in case of file reading udf: Write LVID to disk after opening / closing Ext3: return ENOMEM rather than EIO if sb_getblk fails Ext2: return ENOMEM rather than EIO if sb_getblk fails Ext3: use unlikely to improve the efficiency of the kernel Ext2: use unlikely to improve the efficiency of the kernel Ext3: add necessary check in case IO error happens Ext2: free memory allocated and forget buffer head when io error happens ext3: Fix memory leak when quota options are specified multiple times ext3, ext4, ocfs2: remove unused macro NAMEI_RA_INDEX
Diffstat (limited to 'fs/ext3/super.c')
-rw-r--r--fs/ext3/super.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 4ba2683c1d44..5546ca225ffe 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -916,21 +916,24 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
916 "Not enough memory for storing quotafile name"); 916 "Not enough memory for storing quotafile name");
917 return 0; 917 return 0;
918 } 918 }
919 if (sbi->s_qf_names[qtype] && 919 if (sbi->s_qf_names[qtype]) {
920 strcmp(sbi->s_qf_names[qtype], qname)) { 920 int same = !strcmp(sbi->s_qf_names[qtype], qname);
921 ext3_msg(sb, KERN_ERR, 921
922 "%s quota file already specified", QTYPE2NAME(qtype));
923 kfree(qname); 922 kfree(qname);
924 return 0; 923 if (!same) {
924 ext3_msg(sb, KERN_ERR,
925 "%s quota file already specified",
926 QTYPE2NAME(qtype));
927 }
928 return same;
925 } 929 }
926 sbi->s_qf_names[qtype] = qname; 930 if (strchr(qname, '/')) {
927 if (strchr(sbi->s_qf_names[qtype], '/')) {
928 ext3_msg(sb, KERN_ERR, 931 ext3_msg(sb, KERN_ERR,
929 "quotafile must be on filesystem root"); 932 "quotafile must be on filesystem root");
930 kfree(sbi->s_qf_names[qtype]); 933 kfree(qname);
931 sbi->s_qf_names[qtype] = NULL;
932 return 0; 934 return 0;
933 } 935 }
936 sbi->s_qf_names[qtype] = qname;
934 set_opt(sbi->s_mount_opt, QUOTA); 937 set_opt(sbi->s_mount_opt, QUOTA);
935 return 1; 938 return 1;
936} 939}
@@ -945,11 +948,10 @@ static int clear_qf_name(struct super_block *sb, int qtype) {
945 " when quota turned on"); 948 " when quota turned on");
946 return 0; 949 return 0;
947 } 950 }
948 /* 951 if (sbi->s_qf_names[qtype]) {
949 * The space will be released later when all options are confirmed 952 kfree(sbi->s_qf_names[qtype]);
950 * to be correct 953 sbi->s_qf_names[qtype] = NULL;
951 */ 954 }
952 sbi->s_qf_names[qtype] = NULL;
953 return 1; 955 return 1;
954} 956}
955#endif 957#endif
@@ -2606,7 +2608,18 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2606#ifdef CONFIG_QUOTA 2608#ifdef CONFIG_QUOTA
2607 old_opts.s_jquota_fmt = sbi->s_jquota_fmt; 2609 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
2608 for (i = 0; i < MAXQUOTAS; i++) 2610 for (i = 0; i < MAXQUOTAS; i++)
2609 old_opts.s_qf_names[i] = sbi->s_qf_names[i]; 2611 if (sbi->s_qf_names[i]) {
2612 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
2613 GFP_KERNEL);
2614 if (!old_opts.s_qf_names[i]) {
2615 int j;
2616
2617 for (j = 0; j < i; j++)
2618 kfree(old_opts.s_qf_names[j]);
2619 return -ENOMEM;
2620 }
2621 } else
2622 old_opts.s_qf_names[i] = NULL;
2610#endif 2623#endif
2611 2624
2612 /* 2625 /*
@@ -2699,9 +2712,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2699#ifdef CONFIG_QUOTA 2712#ifdef CONFIG_QUOTA
2700 /* Release old quota file names */ 2713 /* Release old quota file names */
2701 for (i = 0; i < MAXQUOTAS; i++) 2714 for (i = 0; i < MAXQUOTAS; i++)
2702 if (old_opts.s_qf_names[i] && 2715 kfree(old_opts.s_qf_names[i]);
2703 old_opts.s_qf_names[i] != sbi->s_qf_names[i])
2704 kfree(old_opts.s_qf_names[i]);
2705#endif 2716#endif
2706 if (enable_quota) 2717 if (enable_quota)
2707 dquot_resume(sb, -1); 2718 dquot_resume(sb, -1);
@@ -2715,9 +2726,7 @@ restore_opts:
2715#ifdef CONFIG_QUOTA 2726#ifdef CONFIG_QUOTA
2716 sbi->s_jquota_fmt = old_opts.s_jquota_fmt; 2727 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
2717 for (i = 0; i < MAXQUOTAS; i++) { 2728 for (i = 0; i < MAXQUOTAS; i++) {
2718 if (sbi->s_qf_names[i] && 2729 kfree(sbi->s_qf_names[i]);
2719 old_opts.s_qf_names[i] != sbi->s_qf_names[i])
2720 kfree(sbi->s_qf_names[i]);
2721 sbi->s_qf_names[i] = old_opts.s_qf_names[i]; 2730 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
2722 } 2731 }
2723#endif 2732#endif