aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-11 08:02:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-11 08:02:31 -0400
commitac0c49396d5ed9a33f08ce661635ac1bff80bb4f (patch)
treee2f066b931b133e94fde7e1157c57bef69a928e7
parenteca9fdf32dd48976eab18d310acb0b8d4cc9bf26 (diff)
parent6174c2eb8ecef271159bdcde460ce8af54d8f72f (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull UDF and quota updates from Jan Kara: "A few UDF fixes and also a few patches which are preparing filesystems for support of project quotas in VFS" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: udf: Fix loading of special inodes ocfs2: Back out change to use OCFS2_MAXQUOTAS in ocfs2_setattr() udf: remove redundant sys_tz declaration ocfs2: Don't use MAXQUOTAS value reiserfs: Don't use MAXQUOTAS value ext3: Don't use MAXQUOTAS value udf: Fix race between write(2) and close(2)
-rw-r--r--fs/ext3/ext3.h12
-rw-r--r--fs/ext3/super.c14
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/ocfs2/quota.h5
-rw-r--r--fs/ocfs2/quota_global.c4
-rw-r--r--fs/ocfs2/quota_local.c33
-rw-r--r--fs/ocfs2/super.c30
-rw-r--r--fs/reiserfs/reiserfs.h5
-rw-r--r--fs/reiserfs/super.c16
-rw-r--r--fs/udf/file.c9
-rw-r--r--fs/udf/inode.c14
-rw-r--r--fs/udf/super.c10
-rw-r--r--fs/udf/udfdecl.h13
-rw-r--r--fs/udf/udftime.c2
14 files changed, 101 insertions, 68 deletions
diff --git a/fs/ext3/ext3.h b/fs/ext3/ext3.h
index e85ff15a060e..fc3cdcf24aed 100644
--- a/fs/ext3/ext3.h
+++ b/fs/ext3/ext3.h
@@ -237,6 +237,8 @@ struct ext3_new_group_data {
237#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION 237#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
238#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION 238#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
239 239
240/* Number of supported quota types */
241#define EXT3_MAXQUOTAS 2
240 242
241/* 243/*
242 * Mount options 244 * Mount options
@@ -248,7 +250,7 @@ struct ext3_mount_options {
248 unsigned long s_commit_interval; 250 unsigned long s_commit_interval;
249#ifdef CONFIG_QUOTA 251#ifdef CONFIG_QUOTA
250 int s_jquota_fmt; 252 int s_jquota_fmt;
251 char *s_qf_names[MAXQUOTAS]; 253 char *s_qf_names[EXT3_MAXQUOTAS];
252#endif 254#endif
253}; 255};
254 256
@@ -669,7 +671,7 @@ struct ext3_sb_info {
669 unsigned long s_commit_interval; 671 unsigned long s_commit_interval;
670 struct block_device *journal_bdev; 672 struct block_device *journal_bdev;
671#ifdef CONFIG_QUOTA 673#ifdef CONFIG_QUOTA
672 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ 674 char *s_qf_names[EXT3_MAXQUOTAS]; /* Names of quota files with journalled quota */
673 int s_jquota_fmt; /* Format of quota to use */ 675 int s_jquota_fmt; /* Format of quota to use */
674#endif 676#endif
675}; 677};
@@ -1183,9 +1185,9 @@ extern const struct inode_operations ext3_fast_symlink_inode_operations;
1183#define EXT3_QUOTA_INIT_BLOCKS(sb) 0 1185#define EXT3_QUOTA_INIT_BLOCKS(sb) 0
1184#define EXT3_QUOTA_DEL_BLOCKS(sb) 0 1186#define EXT3_QUOTA_DEL_BLOCKS(sb) 0
1185#endif 1187#endif
1186#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) 1188#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
1187#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) 1189#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
1188#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) 1190#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
1189 1191
1190int 1192int
1191ext3_mark_iloc_dirty(handle_t *handle, 1193ext3_mark_iloc_dirty(handle_t *handle,
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index bb0fdacad058..7015db0bafd1 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -441,7 +441,7 @@ static void ext3_put_super (struct super_block * sb)
441 percpu_counter_destroy(&sbi->s_dirs_counter); 441 percpu_counter_destroy(&sbi->s_dirs_counter);
442 brelse(sbi->s_sbh); 442 brelse(sbi->s_sbh);
443#ifdef CONFIG_QUOTA 443#ifdef CONFIG_QUOTA
444 for (i = 0; i < MAXQUOTAS; i++) 444 for (i = 0; i < EXT3_MAXQUOTAS; i++)
445 kfree(sbi->s_qf_names[i]); 445 kfree(sbi->s_qf_names[i]);
446#endif 446#endif
447 447
@@ -1555,7 +1555,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1555 /* Needed for iput() to work correctly and not trash data */ 1555 /* Needed for iput() to work correctly and not trash data */
1556 sb->s_flags |= MS_ACTIVE; 1556 sb->s_flags |= MS_ACTIVE;
1557 /* Turn on quotas so that they are updated correctly */ 1557 /* Turn on quotas so that they are updated correctly */
1558 for (i = 0; i < MAXQUOTAS; i++) { 1558 for (i = 0; i < EXT3_MAXQUOTAS; i++) {
1559 if (EXT3_SB(sb)->s_qf_names[i]) { 1559 if (EXT3_SB(sb)->s_qf_names[i]) {
1560 int ret = ext3_quota_on_mount(sb, i); 1560 int ret = ext3_quota_on_mount(sb, i);
1561 if (ret < 0) 1561 if (ret < 0)
@@ -1606,7 +1606,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1606 PLURAL(nr_truncates)); 1606 PLURAL(nr_truncates));
1607#ifdef CONFIG_QUOTA 1607#ifdef CONFIG_QUOTA
1608 /* Turn quotas off */ 1608 /* Turn quotas off */
1609 for (i = 0; i < MAXQUOTAS; i++) { 1609 for (i = 0; i < EXT3_MAXQUOTAS; i++) {
1610 if (sb_dqopt(sb)->files[i]) 1610 if (sb_dqopt(sb)->files[i])
1611 dquot_quota_off(sb, i); 1611 dquot_quota_off(sb, i);
1612 } 1612 }
@@ -2139,7 +2139,7 @@ failed_mount2:
2139 kfree(sbi->s_group_desc); 2139 kfree(sbi->s_group_desc);
2140failed_mount: 2140failed_mount:
2141#ifdef CONFIG_QUOTA 2141#ifdef CONFIG_QUOTA
2142 for (i = 0; i < MAXQUOTAS; i++) 2142 for (i = 0; i < EXT3_MAXQUOTAS; i++)
2143 kfree(sbi->s_qf_names[i]); 2143 kfree(sbi->s_qf_names[i]);
2144#endif 2144#endif
2145 ext3_blkdev_remove(sbi); 2145 ext3_blkdev_remove(sbi);
@@ -2659,7 +2659,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2659 old_opts.s_commit_interval = sbi->s_commit_interval; 2659 old_opts.s_commit_interval = sbi->s_commit_interval;
2660#ifdef CONFIG_QUOTA 2660#ifdef CONFIG_QUOTA
2661 old_opts.s_jquota_fmt = sbi->s_jquota_fmt; 2661 old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
2662 for (i = 0; i < MAXQUOTAS; i++) 2662 for (i = 0; i < EXT3_MAXQUOTAS; i++)
2663 if (sbi->s_qf_names[i]) { 2663 if (sbi->s_qf_names[i]) {
2664 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], 2664 old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
2665 GFP_KERNEL); 2665 GFP_KERNEL);
@@ -2763,7 +2763,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2763 } 2763 }
2764#ifdef CONFIG_QUOTA 2764#ifdef CONFIG_QUOTA
2765 /* Release old quota file names */ 2765 /* Release old quota file names */
2766 for (i = 0; i < MAXQUOTAS; i++) 2766 for (i = 0; i < EXT3_MAXQUOTAS; i++)
2767 kfree(old_opts.s_qf_names[i]); 2767 kfree(old_opts.s_qf_names[i]);
2768#endif 2768#endif
2769 if (enable_quota) 2769 if (enable_quota)
@@ -2777,7 +2777,7 @@ restore_opts:
2777 sbi->s_commit_interval = old_opts.s_commit_interval; 2777 sbi->s_commit_interval = old_opts.s_commit_interval;
2778#ifdef CONFIG_QUOTA 2778#ifdef CONFIG_QUOTA
2779 sbi->s_jquota_fmt = old_opts.s_jquota_fmt; 2779 sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
2780 for (i = 0; i < MAXQUOTAS; i++) { 2780 for (i = 0; i < EXT3_MAXQUOTAS; i++) {
2781 kfree(sbi->s_qf_names[i]); 2781 kfree(sbi->s_qf_names[i]);
2782 sbi->s_qf_names[i] = old_opts.s_qf_names[i]; 2782 sbi->s_qf_names[i] = old_opts.s_qf_names[i];
2783 } 2783 }
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 682732f3f0d8..324dc93ac896 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1252,7 +1252,7 @@ bail:
1252 brelse(bh); 1252 brelse(bh);
1253 1253
1254 /* Release quota pointers in case we acquired them */ 1254 /* Release quota pointers in case we acquired them */
1255 for (qtype = 0; qtype < MAXQUOTAS; qtype++) 1255 for (qtype = 0; qtype < OCFS2_MAXQUOTAS; qtype++)
1256 dqput(transfer_to[qtype]); 1256 dqput(transfer_to[qtype]);
1257 1257
1258 if (!status && attr->ia_valid & ATTR_MODE) { 1258 if (!status && attr->ia_valid & ATTR_MODE) {
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h
index f266d67df3c6..1eae330193a6 100644
--- a/fs/ocfs2/quota.h
+++ b/fs/ocfs2/quota.h
@@ -17,6 +17,9 @@
17 17
18#include "ocfs2.h" 18#include "ocfs2.h"
19 19
20/* Number of quota types we support */
21#define OCFS2_MAXQUOTAS 2
22
20/* 23/*
21 * In-memory structures 24 * In-memory structures
22 */ 25 */
@@ -39,7 +42,7 @@ struct ocfs2_recovery_chunk {
39}; 42};
40 43
41struct ocfs2_quota_recovery { 44struct ocfs2_quota_recovery {
42 struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */ 45 struct list_head r_list[OCFS2_MAXQUOTAS]; /* List of chunks to recover */
43}; 46};
44 47
45/* In-memory structure with quota header information */ 48/* In-memory structure with quota header information */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index b990a62cff50..c93d67220887 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -336,8 +336,8 @@ void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex)
336int ocfs2_global_read_info(struct super_block *sb, int type) 336int ocfs2_global_read_info(struct super_block *sb, int type)
337{ 337{
338 struct inode *gqinode = NULL; 338 struct inode *gqinode = NULL;
339 unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, 339 unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
340 GROUP_QUOTA_SYSTEM_INODE }; 340 GROUP_QUOTA_SYSTEM_INODE };
341 struct ocfs2_global_disk_dqinfo dinfo; 341 struct ocfs2_global_disk_dqinfo dinfo;
342 struct mem_dqinfo *info = sb_dqinfo(sb, type); 342 struct mem_dqinfo *info = sb_dqinfo(sb, type);
343 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; 343 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 2001862bf2b1..10b653930ee2 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -166,12 +166,12 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
166/* Check whether we understand format of quota files */ 166/* Check whether we understand format of quota files */
167static int ocfs2_local_check_quota_file(struct super_block *sb, int type) 167static int ocfs2_local_check_quota_file(struct super_block *sb, int type)
168{ 168{
169 unsigned int lmagics[MAXQUOTAS] = OCFS2_LOCAL_QMAGICS; 169 unsigned int lmagics[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QMAGICS;
170 unsigned int lversions[MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS; 170 unsigned int lversions[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS;
171 unsigned int gmagics[MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS; 171 unsigned int gmagics[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS;
172 unsigned int gversions[MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS; 172 unsigned int gversions[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS;
173 unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, 173 unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
174 GROUP_QUOTA_SYSTEM_INODE }; 174 GROUP_QUOTA_SYSTEM_INODE };
175 struct buffer_head *bh = NULL; 175 struct buffer_head *bh = NULL;
176 struct inode *linode = sb_dqopt(sb)->files[type]; 176 struct inode *linode = sb_dqopt(sb)->files[type];
177 struct inode *ginode = NULL; 177 struct inode *ginode = NULL;
@@ -336,7 +336,7 @@ void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec)
336{ 336{
337 int type; 337 int type;
338 338
339 for (type = 0; type < MAXQUOTAS; type++) 339 for (type = 0; type < OCFS2_MAXQUOTAS; type++)
340 free_recovery_list(&(rec->r_list[type])); 340 free_recovery_list(&(rec->r_list[type]));
341 kfree(rec); 341 kfree(rec);
342} 342}
@@ -382,7 +382,7 @@ static struct ocfs2_quota_recovery *ocfs2_alloc_quota_recovery(void)
382 rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS); 382 rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS);
383 if (!rec) 383 if (!rec)
384 return NULL; 384 return NULL;
385 for (type = 0; type < MAXQUOTAS; type++) 385 for (type = 0; type < OCFS2_MAXQUOTAS; type++)
386 INIT_LIST_HEAD(&(rec->r_list[type])); 386 INIT_LIST_HEAD(&(rec->r_list[type]));
387 return rec; 387 return rec;
388} 388}
@@ -392,10 +392,11 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
392 struct ocfs2_super *osb, 392 struct ocfs2_super *osb,
393 int slot_num) 393 int slot_num)
394{ 394{
395 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 395 unsigned int feature[OCFS2_MAXQUOTAS] = {
396 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; 396 OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
397 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, 397 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
398 LOCAL_GROUP_QUOTA_SYSTEM_INODE }; 398 unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
399 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
399 struct super_block *sb = osb->sb; 400 struct super_block *sb = osb->sb;
400 struct ocfs2_local_disk_dqinfo *ldinfo; 401 struct ocfs2_local_disk_dqinfo *ldinfo;
401 struct inode *lqinode; 402 struct inode *lqinode;
@@ -412,7 +413,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
412 return ERR_PTR(-ENOMEM); 413 return ERR_PTR(-ENOMEM);
413 /* First init... */ 414 /* First init... */
414 415
415 for (type = 0; type < MAXQUOTAS; type++) { 416 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
416 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 417 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
417 continue; 418 continue;
418 /* At this point, journal of the slot is already replayed so 419 /* At this point, journal of the slot is already replayed so
@@ -589,8 +590,8 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
589 struct ocfs2_quota_recovery *rec, 590 struct ocfs2_quota_recovery *rec,
590 int slot_num) 591 int slot_num)
591{ 592{
592 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, 593 unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
593 LOCAL_GROUP_QUOTA_SYSTEM_INODE }; 594 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
594 struct super_block *sb = osb->sb; 595 struct super_block *sb = osb->sb;
595 struct ocfs2_local_disk_dqinfo *ldinfo; 596 struct ocfs2_local_disk_dqinfo *ldinfo;
596 struct buffer_head *bh; 597 struct buffer_head *bh;
@@ -604,7 +605,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
604 "slot %u\n", osb->dev_str, slot_num); 605 "slot %u\n", osb->dev_str, slot_num);
605 606
606 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); 607 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
607 for (type = 0; type < MAXQUOTAS; type++) { 608 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
608 if (list_empty(&(rec->r_list[type]))) 609 if (list_empty(&(rec->r_list[type])))
609 continue; 610 continue;
610 trace_ocfs2_finish_quota_recovery(slot_num); 611 trace_ocfs2_finish_quota_recovery(slot_num);
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 4142546aedae..93c85bc745e1 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -899,11 +899,12 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
899{ 899{
900 int type; 900 int type;
901 struct super_block *sb = osb->sb; 901 struct super_block *sb = osb->sb;
902 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 902 unsigned int feature[OCFS2_MAXQUOTAS] = {
903 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; 903 OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
904 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
904 int status = 0; 905 int status = 0;
905 906
906 for (type = 0; type < MAXQUOTAS; type++) { 907 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
907 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 908 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
908 continue; 909 continue;
909 if (unsuspend) 910 if (unsuspend)
@@ -927,17 +928,19 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
927 928
928static int ocfs2_enable_quotas(struct ocfs2_super *osb) 929static int ocfs2_enable_quotas(struct ocfs2_super *osb)
929{ 930{
930 struct inode *inode[MAXQUOTAS] = { NULL, NULL }; 931 struct inode *inode[OCFS2_MAXQUOTAS] = { NULL, NULL };
931 struct super_block *sb = osb->sb; 932 struct super_block *sb = osb->sb;
932 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 933 unsigned int feature[OCFS2_MAXQUOTAS] = {
933 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; 934 OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
934 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, 935 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
936 unsigned int ino[OCFS2_MAXQUOTAS] = {
937 LOCAL_USER_QUOTA_SYSTEM_INODE,
935 LOCAL_GROUP_QUOTA_SYSTEM_INODE }; 938 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
936 int status; 939 int status;
937 int type; 940 int type;
938 941
939 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; 942 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE;
940 for (type = 0; type < MAXQUOTAS; type++) { 943 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
941 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 944 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
942 continue; 945 continue;
943 inode[type] = ocfs2_get_system_file_inode(osb, ino[type], 946 inode[type] = ocfs2_get_system_file_inode(osb, ino[type],
@@ -952,12 +955,12 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb)
952 goto out_quota_off; 955 goto out_quota_off;
953 } 956 }
954 957
955 for (type = 0; type < MAXQUOTAS; type++) 958 for (type = 0; type < OCFS2_MAXQUOTAS; type++)
956 iput(inode[type]); 959 iput(inode[type]);
957 return 0; 960 return 0;
958out_quota_off: 961out_quota_off:
959 ocfs2_disable_quotas(osb); 962 ocfs2_disable_quotas(osb);
960 for (type = 0; type < MAXQUOTAS; type++) 963 for (type = 0; type < OCFS2_MAXQUOTAS; type++)
961 iput(inode[type]); 964 iput(inode[type]);
962 mlog_errno(status); 965 mlog_errno(status);
963 return status; 966 return status;
@@ -972,7 +975,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
972 975
973 /* We mostly ignore errors in this function because there's not much 976 /* We mostly ignore errors in this function because there's not much
974 * we can do when we see them */ 977 * we can do when we see them */
975 for (type = 0; type < MAXQUOTAS; type++) { 978 for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
976 if (!sb_has_quota_loaded(sb, type)) 979 if (!sb_has_quota_loaded(sb, type))
977 continue; 980 continue;
978 /* Cancel periodic syncing before we grab dqonoff_mutex */ 981 /* Cancel periodic syncing before we grab dqonoff_mutex */
@@ -993,8 +996,9 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
993/* Handle quota on quotactl */ 996/* Handle quota on quotactl */
994static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) 997static int ocfs2_quota_on(struct super_block *sb, int type, int format_id)
995{ 998{
996 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, 999 unsigned int feature[OCFS2_MAXQUOTAS] = {
997 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; 1000 OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
1001 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
998 1002
999 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 1003 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
1000 return -EINVAL; 1004 return -EINVAL;
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 735c2c2b4536..1894d96ccb7c 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -506,6 +506,9 @@ typedef struct reiserfs_proc_info_data {
506} reiserfs_proc_info_data_t; 506} reiserfs_proc_info_data_t;
507#endif 507#endif
508 508
509/* Number of quota types we support */
510#define REISERFS_MAXQUOTAS 2
511
509/* reiserfs union of in-core super block data */ 512/* reiserfs union of in-core super block data */
510struct reiserfs_sb_info { 513struct reiserfs_sb_info {
511 /* Buffer containing the super block */ 514 /* Buffer containing the super block */
@@ -615,7 +618,7 @@ struct reiserfs_sb_info {
615 spinlock_t old_work_lock; /* protects old_work and work_queued */ 618 spinlock_t old_work_lock; /* protects old_work and work_queued */
616 619
617#ifdef CONFIG_QUOTA 620#ifdef CONFIG_QUOTA
618 char *s_qf_names[MAXQUOTAS]; 621 char *s_qf_names[REISERFS_MAXQUOTAS];
619 int s_jquota_fmt; 622 int s_jquota_fmt;
620#endif 623#endif
621 char *s_jdev; /* Stored jdev for mount option showing */ 624 char *s_jdev; /* Stored jdev for mount option showing */
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index d46e88a33b02..f1376c92cf74 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -206,7 +206,7 @@ static int finish_unfinished(struct super_block *s)
206#ifdef CONFIG_QUOTA 206#ifdef CONFIG_QUOTA
207 int i; 207 int i;
208 int ms_active_set; 208 int ms_active_set;
209 int quota_enabled[MAXQUOTAS]; 209 int quota_enabled[REISERFS_MAXQUOTAS];
210#endif 210#endif
211 211
212 /* compose key to look for "save" links */ 212 /* compose key to look for "save" links */
@@ -227,7 +227,7 @@ static int finish_unfinished(struct super_block *s)
227 s->s_flags |= MS_ACTIVE; 227 s->s_flags |= MS_ACTIVE;
228 } 228 }
229 /* Turn on quotas so that they are updated correctly */ 229 /* Turn on quotas so that they are updated correctly */
230 for (i = 0; i < MAXQUOTAS; i++) { 230 for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
231 quota_enabled[i] = 1; 231 quota_enabled[i] = 1;
232 if (REISERFS_SB(s)->s_qf_names[i]) { 232 if (REISERFS_SB(s)->s_qf_names[i]) {
233 int ret; 233 int ret;
@@ -370,7 +370,7 @@ static int finish_unfinished(struct super_block *s)
370#ifdef CONFIG_QUOTA 370#ifdef CONFIG_QUOTA
371 /* Turn quotas off */ 371 /* Turn quotas off */
372 reiserfs_write_unlock(s); 372 reiserfs_write_unlock(s);
373 for (i = 0; i < MAXQUOTAS; i++) { 373 for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
374 if (sb_dqopt(s)->files[i] && quota_enabled[i]) 374 if (sb_dqopt(s)->files[i] && quota_enabled[i])
375 dquot_quota_off(s, i); 375 dquot_quota_off(s, i);
376 } 376 }
@@ -1360,7 +1360,7 @@ static void handle_quota_files(struct super_block *s, char **qf_names,
1360{ 1360{
1361 int i; 1361 int i;
1362 1362
1363 for (i = 0; i < MAXQUOTAS; i++) { 1363 for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
1364 if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) 1364 if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
1365 kfree(REISERFS_SB(s)->s_qf_names[i]); 1365 kfree(REISERFS_SB(s)->s_qf_names[i]);
1366 REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; 1366 REISERFS_SB(s)->s_qf_names[i] = qf_names[i];
@@ -1381,7 +1381,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1381 struct reiserfs_journal *journal = SB_JOURNAL(s); 1381 struct reiserfs_journal *journal = SB_JOURNAL(s);
1382 char *new_opts = kstrdup(arg, GFP_KERNEL); 1382 char *new_opts = kstrdup(arg, GFP_KERNEL);
1383 int err; 1383 int err;
1384 char *qf_names[MAXQUOTAS]; 1384 char *qf_names[REISERFS_MAXQUOTAS];
1385 unsigned int qfmt = 0; 1385 unsigned int qfmt = 0;
1386#ifdef CONFIG_QUOTA 1386#ifdef CONFIG_QUOTA
1387 int i; 1387 int i;
@@ -1400,7 +1400,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1400 (s, arg, &mount_options, &blocks, NULL, &commit_max_age, 1400 (s, arg, &mount_options, &blocks, NULL, &commit_max_age,
1401 qf_names, &qfmt)) { 1401 qf_names, &qfmt)) {
1402#ifdef CONFIG_QUOTA 1402#ifdef CONFIG_QUOTA
1403 for (i = 0; i < MAXQUOTAS; i++) 1403 for (i = 0; i < REISERFS_MAXQUOTAS; i++)
1404 if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) 1404 if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
1405 kfree(qf_names[i]); 1405 kfree(qf_names[i]);
1406#endif 1406#endif
@@ -1844,7 +1844,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
1844 char *jdev_name; 1844 char *jdev_name;
1845 struct reiserfs_sb_info *sbi; 1845 struct reiserfs_sb_info *sbi;
1846 int errval = -EINVAL; 1846 int errval = -EINVAL;
1847 char *qf_names[MAXQUOTAS] = {}; 1847 char *qf_names[REISERFS_MAXQUOTAS] = {};
1848 unsigned int qfmt = 0; 1848 unsigned int qfmt = 0;
1849 1849
1850 save_mount_options(s, data); 1850 save_mount_options(s, data);
@@ -2169,7 +2169,7 @@ error_unlocked:
2169#ifdef CONFIG_QUOTA 2169#ifdef CONFIG_QUOTA
2170 { 2170 {
2171 int j; 2171 int j;
2172 for (j = 0; j < MAXQUOTAS; j++) 2172 for (j = 0; j < REISERFS_MAXQUOTAS; j++)
2173 kfree(qf_names[j]); 2173 kfree(qf_names[j]);
2174 } 2174 }
2175#endif 2175#endif
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 86c6743ec1fe..bb15771b92ae 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -223,11 +223,18 @@ out:
223 223
224static int udf_release_file(struct inode *inode, struct file *filp) 224static int udf_release_file(struct inode *inode, struct file *filp)
225{ 225{
226 if (filp->f_mode & FMODE_WRITE) { 226 if (filp->f_mode & FMODE_WRITE &&
227 atomic_read(&inode->i_writecount) > 1) {
228 /*
229 * Grab i_mutex to avoid races with writes changing i_size
230 * while we are running.
231 */
232 mutex_lock(&inode->i_mutex);
227 down_write(&UDF_I(inode)->i_data_sem); 233 down_write(&UDF_I(inode)->i_data_sem);
228 udf_discard_prealloc(inode); 234 udf_discard_prealloc(inode);
229 udf_truncate_tail_extent(inode); 235 udf_truncate_tail_extent(inode);
230 up_write(&UDF_I(inode)->i_data_sem); 236 up_write(&UDF_I(inode)->i_data_sem);
237 mutex_unlock(&inode->i_mutex);
231 } 238 }
232 return 0; 239 return 0;
233} 240}
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 08598843288f..c9b4df5810d5 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1277,7 +1277,7 @@ update_time:
1277 */ 1277 */
1278#define UDF_MAX_ICB_NESTING 1024 1278#define UDF_MAX_ICB_NESTING 1024
1279 1279
1280static int udf_read_inode(struct inode *inode) 1280static int udf_read_inode(struct inode *inode, bool hidden_inode)
1281{ 1281{
1282 struct buffer_head *bh = NULL; 1282 struct buffer_head *bh = NULL;
1283 struct fileEntry *fe; 1283 struct fileEntry *fe;
@@ -1436,8 +1436,11 @@ reread:
1436 1436
1437 link_count = le16_to_cpu(fe->fileLinkCount); 1437 link_count = le16_to_cpu(fe->fileLinkCount);
1438 if (!link_count) { 1438 if (!link_count) {
1439 ret = -ESTALE; 1439 if (!hidden_inode) {
1440 goto out; 1440 ret = -ESTALE;
1441 goto out;
1442 }
1443 link_count = 1;
1441 } 1444 }
1442 set_nlink(inode, link_count); 1445 set_nlink(inode, link_count);
1443 1446
@@ -1826,7 +1829,8 @@ out:
1826 return err; 1829 return err;
1827} 1830}
1828 1831
1829struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino) 1832struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
1833 bool hidden_inode)
1830{ 1834{
1831 unsigned long block = udf_get_lb_pblock(sb, ino, 0); 1835 unsigned long block = udf_get_lb_pblock(sb, ino, 0);
1832 struct inode *inode = iget_locked(sb, block); 1836 struct inode *inode = iget_locked(sb, block);
@@ -1839,7 +1843,7 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino)
1839 return inode; 1843 return inode;
1840 1844
1841 memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); 1845 memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr));
1842 err = udf_read_inode(inode); 1846 err = udf_read_inode(inode, hidden_inode);
1843 if (err < 0) { 1847 if (err < 0) {
1844 iget_failed(inode); 1848 iget_failed(inode);
1845 return ERR_PTR(err); 1849 return ERR_PTR(err);
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 5401fc33f5cc..e229315bbf7a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -959,7 +959,7 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb,
959 addr.logicalBlockNum = meta_file_loc; 959 addr.logicalBlockNum = meta_file_loc;
960 addr.partitionReferenceNum = partition_num; 960 addr.partitionReferenceNum = partition_num;
961 961
962 metadata_fe = udf_iget(sb, &addr); 962 metadata_fe = udf_iget_special(sb, &addr);
963 963
964 if (IS_ERR(metadata_fe)) { 964 if (IS_ERR(metadata_fe)) {
965 udf_warn(sb, "metadata inode efe not found\n"); 965 udf_warn(sb, "metadata inode efe not found\n");
@@ -1020,7 +1020,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
1020 udf_debug("Bitmap file location: block = %d part = %d\n", 1020 udf_debug("Bitmap file location: block = %d part = %d\n",
1021 addr.logicalBlockNum, addr.partitionReferenceNum); 1021 addr.logicalBlockNum, addr.partitionReferenceNum);
1022 1022
1023 fe = udf_iget(sb, &addr); 1023 fe = udf_iget_special(sb, &addr);
1024 if (IS_ERR(fe)) { 1024 if (IS_ERR(fe)) {
1025 if (sb->s_flags & MS_RDONLY) 1025 if (sb->s_flags & MS_RDONLY)
1026 udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); 1026 udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n");
@@ -1119,7 +1119,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1119 }; 1119 };
1120 struct inode *inode; 1120 struct inode *inode;
1121 1121
1122 inode = udf_iget(sb, &loc); 1122 inode = udf_iget_special(sb, &loc);
1123 if (IS_ERR(inode)) { 1123 if (IS_ERR(inode)) {
1124 udf_debug("cannot load unallocSpaceTable (part %d)\n", 1124 udf_debug("cannot load unallocSpaceTable (part %d)\n",
1125 p_index); 1125 p_index);
@@ -1154,7 +1154,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1154 }; 1154 };
1155 struct inode *inode; 1155 struct inode *inode;
1156 1156
1157 inode = udf_iget(sb, &loc); 1157 inode = udf_iget_special(sb, &loc);
1158 if (IS_ERR(inode)) { 1158 if (IS_ERR(inode)) {
1159 udf_debug("cannot load freedSpaceTable (part %d)\n", 1159 udf_debug("cannot load freedSpaceTable (part %d)\n",
1160 p_index); 1160 p_index);
@@ -1198,7 +1198,7 @@ static void udf_find_vat_block(struct super_block *sb, int p_index,
1198 vat_block >= map->s_partition_root && 1198 vat_block >= map->s_partition_root &&
1199 vat_block >= start_block - 3; vat_block--) { 1199 vat_block >= start_block - 3; vat_block--) {
1200 ino.logicalBlockNum = vat_block - map->s_partition_root; 1200 ino.logicalBlockNum = vat_block - map->s_partition_root;
1201 inode = udf_iget(sb, &ino); 1201 inode = udf_iget_special(sb, &ino);
1202 if (!IS_ERR(inode)) { 1202 if (!IS_ERR(inode)) {
1203 sbi->s_vat_inode = inode; 1203 sbi->s_vat_inode = inode;
1204 break; 1204 break;
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 742557be9936..1cc3c993ebd0 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -138,7 +138,18 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
138/* file.c */ 138/* file.c */
139extern long udf_ioctl(struct file *, unsigned int, unsigned long); 139extern long udf_ioctl(struct file *, unsigned int, unsigned long);
140/* inode.c */ 140/* inode.c */
141extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); 141extern struct inode *__udf_iget(struct super_block *, struct kernel_lb_addr *,
142 bool hidden_inode);
143static inline struct inode *udf_iget_special(struct super_block *sb,
144 struct kernel_lb_addr *ino)
145{
146 return __udf_iget(sb, ino, true);
147}
148static inline struct inode *udf_iget(struct super_block *sb,
149 struct kernel_lb_addr *ino)
150{
151 return __udf_iget(sb, ino, false);
152}
142extern int udf_expand_file_adinicb(struct inode *); 153extern int udf_expand_file_adinicb(struct inode *);
143extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); 154extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *);
144extern struct buffer_head *udf_bread(struct inode *, int, int, int *); 155extern struct buffer_head *udf_bread(struct inode *, int, int, int *);
diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c
index 1f11483eba6a..77c331f1a770 100644
--- a/fs/udf/udftime.c
+++ b/fs/udf/udftime.c
@@ -81,8 +81,6 @@ static time_t year_seconds[MAX_YEAR_SECONDS] = {
81/*2038*/ SPY(68, 17, 0) 81/*2038*/ SPY(68, 17, 0)
82}; 82};
83 83
84extern struct timezone sys_tz;
85
86#define SECS_PER_HOUR (60 * 60) 84#define SECS_PER_HOUR (60 * 60)
87#define SECS_PER_DAY (SECS_PER_HOUR * 24) 85#define SECS_PER_DAY (SECS_PER_HOUR * 24)
88 86