Commit ac0c4939 authored by Linus Torvalds's avatar Linus Torvalds

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)
parents eca9fdf3 6174c2eb
...@@ -237,6 +237,8 @@ struct ext3_new_group_data { ...@@ -237,6 +237,8 @@ struct ext3_new_group_data {
#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION #define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION #define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
/* Number of supported quota types */
#define EXT3_MAXQUOTAS 2
/* /*
* Mount options * Mount options
...@@ -248,7 +250,7 @@ struct ext3_mount_options { ...@@ -248,7 +250,7 @@ struct ext3_mount_options {
unsigned long s_commit_interval; unsigned long s_commit_interval;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
int s_jquota_fmt; int s_jquota_fmt;
char *s_qf_names[MAXQUOTAS]; char *s_qf_names[EXT3_MAXQUOTAS];
#endif #endif
}; };
...@@ -669,7 +671,7 @@ struct ext3_sb_info { ...@@ -669,7 +671,7 @@ struct ext3_sb_info {
unsigned long s_commit_interval; unsigned long s_commit_interval;
struct block_device *journal_bdev; struct block_device *journal_bdev;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ char *s_qf_names[EXT3_MAXQUOTAS]; /* Names of quota files with journalled quota */
int s_jquota_fmt; /* Format of quota to use */ int s_jquota_fmt; /* Format of quota to use */
#endif #endif
}; };
...@@ -1183,9 +1185,9 @@ extern const struct inode_operations ext3_fast_symlink_inode_operations; ...@@ -1183,9 +1185,9 @@ extern const struct inode_operations ext3_fast_symlink_inode_operations;
#define EXT3_QUOTA_INIT_BLOCKS(sb) 0 #define EXT3_QUOTA_INIT_BLOCKS(sb) 0
#define EXT3_QUOTA_DEL_BLOCKS(sb) 0 #define EXT3_QUOTA_DEL_BLOCKS(sb) 0
#endif #endif
#define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb))
#define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb))
#define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (EXT3_MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb))
int int
ext3_mark_iloc_dirty(handle_t *handle, ext3_mark_iloc_dirty(handle_t *handle,
......
...@@ -441,7 +441,7 @@ static void ext3_put_super (struct super_block * sb) ...@@ -441,7 +441,7 @@ static void ext3_put_super (struct super_block * sb)
percpu_counter_destroy(&sbi->s_dirs_counter); percpu_counter_destroy(&sbi->s_dirs_counter);
brelse(sbi->s_sbh); brelse(sbi->s_sbh);
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
for (i = 0; i < MAXQUOTAS; i++) for (i = 0; i < EXT3_MAXQUOTAS; i++)
kfree(sbi->s_qf_names[i]); kfree(sbi->s_qf_names[i]);
#endif #endif
...@@ -1555,7 +1555,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, ...@@ -1555,7 +1555,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
/* Needed for iput() to work correctly and not trash data */ /* Needed for iput() to work correctly and not trash data */
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
/* Turn on quotas so that they are updated correctly */ /* Turn on quotas so that they are updated correctly */
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < EXT3_MAXQUOTAS; i++) {
if (EXT3_SB(sb)->s_qf_names[i]) { if (EXT3_SB(sb)->s_qf_names[i]) {
int ret = ext3_quota_on_mount(sb, i); int ret = ext3_quota_on_mount(sb, i);
if (ret < 0) if (ret < 0)
...@@ -1606,7 +1606,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, ...@@ -1606,7 +1606,7 @@ static void ext3_orphan_cleanup (struct super_block * sb,
PLURAL(nr_truncates)); PLURAL(nr_truncates));
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
/* Turn quotas off */ /* Turn quotas off */
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < EXT3_MAXQUOTAS; i++) {
if (sb_dqopt(sb)->files[i]) if (sb_dqopt(sb)->files[i])
dquot_quota_off(sb, i); dquot_quota_off(sb, i);
} }
...@@ -2139,7 +2139,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2139,7 +2139,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
kfree(sbi->s_group_desc); kfree(sbi->s_group_desc);
failed_mount: failed_mount:
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
for (i = 0; i < MAXQUOTAS; i++) for (i = 0; i < EXT3_MAXQUOTAS; i++)
kfree(sbi->s_qf_names[i]); kfree(sbi->s_qf_names[i]);
#endif #endif
ext3_blkdev_remove(sbi); ext3_blkdev_remove(sbi);
...@@ -2659,7 +2659,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) ...@@ -2659,7 +2659,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
old_opts.s_commit_interval = sbi->s_commit_interval; old_opts.s_commit_interval = sbi->s_commit_interval;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
old_opts.s_jquota_fmt = sbi->s_jquota_fmt; old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
for (i = 0; i < MAXQUOTAS; i++) for (i = 0; i < EXT3_MAXQUOTAS; i++)
if (sbi->s_qf_names[i]) { if (sbi->s_qf_names[i]) {
old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i], old_opts.s_qf_names[i] = kstrdup(sbi->s_qf_names[i],
GFP_KERNEL); GFP_KERNEL);
...@@ -2763,7 +2763,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) ...@@ -2763,7 +2763,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
} }
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
/* Release old quota file names */ /* Release old quota file names */
for (i = 0; i < MAXQUOTAS; i++) for (i = 0; i < EXT3_MAXQUOTAS; i++)
kfree(old_opts.s_qf_names[i]); kfree(old_opts.s_qf_names[i]);
#endif #endif
if (enable_quota) if (enable_quota)
...@@ -2777,7 +2777,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data) ...@@ -2777,7 +2777,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
sbi->s_commit_interval = old_opts.s_commit_interval; sbi->s_commit_interval = old_opts.s_commit_interval;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
sbi->s_jquota_fmt = old_opts.s_jquota_fmt; sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < EXT3_MAXQUOTAS; i++) {
kfree(sbi->s_qf_names[i]); kfree(sbi->s_qf_names[i]);
sbi->s_qf_names[i] = old_opts.s_qf_names[i]; sbi->s_qf_names[i] = old_opts.s_qf_names[i];
} }
......
...@@ -1252,7 +1252,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -1252,7 +1252,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
brelse(bh); brelse(bh);
/* Release quota pointers in case we acquired them */ /* Release quota pointers in case we acquired them */
for (qtype = 0; qtype < MAXQUOTAS; qtype++) for (qtype = 0; qtype < OCFS2_MAXQUOTAS; qtype++)
dqput(transfer_to[qtype]); dqput(transfer_to[qtype]);
if (!status && attr->ia_valid & ATTR_MODE) { if (!status && attr->ia_valid & ATTR_MODE) {
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#include "ocfs2.h" #include "ocfs2.h"
/* Number of quota types we support */
#define OCFS2_MAXQUOTAS 2
/* /*
* In-memory structures * In-memory structures
*/ */
...@@ -39,7 +42,7 @@ struct ocfs2_recovery_chunk { ...@@ -39,7 +42,7 @@ struct ocfs2_recovery_chunk {
}; };
struct ocfs2_quota_recovery { struct ocfs2_quota_recovery {
struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */ struct list_head r_list[OCFS2_MAXQUOTAS]; /* List of chunks to recover */
}; };
/* In-memory structure with quota header information */ /* In-memory structure with quota header information */
......
...@@ -336,7 +336,7 @@ void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex) ...@@ -336,7 +336,7 @@ void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex)
int ocfs2_global_read_info(struct super_block *sb, int type) int ocfs2_global_read_info(struct super_block *sb, int type)
{ {
struct inode *gqinode = NULL; struct inode *gqinode = NULL;
unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
GROUP_QUOTA_SYSTEM_INODE }; GROUP_QUOTA_SYSTEM_INODE };
struct ocfs2_global_disk_dqinfo dinfo; struct ocfs2_global_disk_dqinfo dinfo;
struct mem_dqinfo *info = sb_dqinfo(sb, type); struct mem_dqinfo *info = sb_dqinfo(sb, type);
......
...@@ -166,11 +166,11 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block, ...@@ -166,11 +166,11 @@ static int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
/* Check whether we understand format of quota files */ /* Check whether we understand format of quota files */
static int ocfs2_local_check_quota_file(struct super_block *sb, int type) static int ocfs2_local_check_quota_file(struct super_block *sb, int type)
{ {
unsigned int lmagics[MAXQUOTAS] = OCFS2_LOCAL_QMAGICS; unsigned int lmagics[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QMAGICS;
unsigned int lversions[MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS; unsigned int lversions[OCFS2_MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS;
unsigned int gmagics[MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS; unsigned int gmagics[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS;
unsigned int gversions[MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS; unsigned int gversions[OCFS2_MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS;
unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, unsigned int ino[OCFS2_MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
GROUP_QUOTA_SYSTEM_INODE }; GROUP_QUOTA_SYSTEM_INODE };
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct inode *linode = sb_dqopt(sb)->files[type]; struct inode *linode = sb_dqopt(sb)->files[type];
...@@ -336,7 +336,7 @@ void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec) ...@@ -336,7 +336,7 @@ void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec)
{ {
int type; int type;
for (type = 0; type < MAXQUOTAS; type++) for (type = 0; type < OCFS2_MAXQUOTAS; type++)
free_recovery_list(&(rec->r_list[type])); free_recovery_list(&(rec->r_list[type]));
kfree(rec); kfree(rec);
} }
...@@ -382,7 +382,7 @@ static struct ocfs2_quota_recovery *ocfs2_alloc_quota_recovery(void) ...@@ -382,7 +382,7 @@ static struct ocfs2_quota_recovery *ocfs2_alloc_quota_recovery(void)
rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS); rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS);
if (!rec) if (!rec)
return NULL; return NULL;
for (type = 0; type < MAXQUOTAS; type++) for (type = 0; type < OCFS2_MAXQUOTAS; type++)
INIT_LIST_HEAD(&(rec->r_list[type])); INIT_LIST_HEAD(&(rec->r_list[type]));
return rec; return rec;
} }
...@@ -392,9 +392,10 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( ...@@ -392,9 +392,10 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
struct ocfs2_super *osb, struct ocfs2_super *osb,
int slot_num) int slot_num)
{ {
unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, unsigned int feature[OCFS2_MAXQUOTAS] = {
OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
LOCAL_GROUP_QUOTA_SYSTEM_INODE }; LOCAL_GROUP_QUOTA_SYSTEM_INODE };
struct super_block *sb = osb->sb; struct super_block *sb = osb->sb;
struct ocfs2_local_disk_dqinfo *ldinfo; struct ocfs2_local_disk_dqinfo *ldinfo;
...@@ -412,7 +413,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery( ...@@ -412,7 +413,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
/* First init... */ /* First init... */
for (type = 0; type < MAXQUOTAS; type++) { for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
continue; continue;
/* At this point, journal of the slot is already replayed so /* At this point, journal of the slot is already replayed so
...@@ -589,7 +590,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, ...@@ -589,7 +590,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
struct ocfs2_quota_recovery *rec, struct ocfs2_quota_recovery *rec,
int slot_num) int slot_num)
{ {
unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, unsigned int ino[OCFS2_MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
LOCAL_GROUP_QUOTA_SYSTEM_INODE }; LOCAL_GROUP_QUOTA_SYSTEM_INODE };
struct super_block *sb = osb->sb; struct super_block *sb = osb->sb;
struct ocfs2_local_disk_dqinfo *ldinfo; struct ocfs2_local_disk_dqinfo *ldinfo;
...@@ -604,7 +605,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, ...@@ -604,7 +605,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
"slot %u\n", osb->dev_str, slot_num); "slot %u\n", osb->dev_str, slot_num);
mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
for (type = 0; type < MAXQUOTAS; type++) { for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (list_empty(&(rec->r_list[type]))) if (list_empty(&(rec->r_list[type])))
continue; continue;
trace_ocfs2_finish_quota_recovery(slot_num); trace_ocfs2_finish_quota_recovery(slot_num);
......
...@@ -899,11 +899,12 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) ...@@ -899,11 +899,12 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
{ {
int type; int type;
struct super_block *sb = osb->sb; struct super_block *sb = osb->sb;
unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, unsigned int feature[OCFS2_MAXQUOTAS] = {
OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
int status = 0; int status = 0;
for (type = 0; type < MAXQUOTAS; type++) { for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
continue; continue;
if (unsuspend) if (unsuspend)
...@@ -927,17 +928,19 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend) ...@@ -927,17 +928,19 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
static int ocfs2_enable_quotas(struct ocfs2_super *osb) static int ocfs2_enable_quotas(struct ocfs2_super *osb)
{ {
struct inode *inode[MAXQUOTAS] = { NULL, NULL }; struct inode *inode[OCFS2_MAXQUOTAS] = { NULL, NULL };
struct super_block *sb = osb->sb; struct super_block *sb = osb->sb;
unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, unsigned int feature[OCFS2_MAXQUOTAS] = {
OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE, unsigned int ino[OCFS2_MAXQUOTAS] = {
LOCAL_USER_QUOTA_SYSTEM_INODE,
LOCAL_GROUP_QUOTA_SYSTEM_INODE }; LOCAL_GROUP_QUOTA_SYSTEM_INODE };
int status; int status;
int type; int type;
sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE;
for (type = 0; type < MAXQUOTAS; type++) { for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
continue; continue;
inode[type] = ocfs2_get_system_file_inode(osb, ino[type], inode[type] = ocfs2_get_system_file_inode(osb, ino[type],
...@@ -952,12 +955,12 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) ...@@ -952,12 +955,12 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb)
goto out_quota_off; goto out_quota_off;
} }
for (type = 0; type < MAXQUOTAS; type++) for (type = 0; type < OCFS2_MAXQUOTAS; type++)
iput(inode[type]); iput(inode[type]);
return 0; return 0;
out_quota_off: out_quota_off:
ocfs2_disable_quotas(osb); ocfs2_disable_quotas(osb);
for (type = 0; type < MAXQUOTAS; type++) for (type = 0; type < OCFS2_MAXQUOTAS; type++)
iput(inode[type]); iput(inode[type]);
mlog_errno(status); mlog_errno(status);
return status; return status;
...@@ -972,7 +975,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) ...@@ -972,7 +975,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
/* We mostly ignore errors in this function because there's not much /* We mostly ignore errors in this function because there's not much
* we can do when we see them */ * we can do when we see them */
for (type = 0; type < MAXQUOTAS; type++) { for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
if (!sb_has_quota_loaded(sb, type)) if (!sb_has_quota_loaded(sb, type))
continue; continue;
/* Cancel periodic syncing before we grab dqonoff_mutex */ /* Cancel periodic syncing before we grab dqonoff_mutex */
...@@ -993,7 +996,8 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) ...@@ -993,7 +996,8 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
/* Handle quota on quotactl */ /* Handle quota on quotactl */
static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) static int ocfs2_quota_on(struct super_block *sb, int type, int format_id)
{ {
unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA, unsigned int feature[OCFS2_MAXQUOTAS] = {
OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA}; OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
......
...@@ -506,6 +506,9 @@ typedef struct reiserfs_proc_info_data { ...@@ -506,6 +506,9 @@ typedef struct reiserfs_proc_info_data {
} reiserfs_proc_info_data_t; } reiserfs_proc_info_data_t;
#endif #endif
/* Number of quota types we support */
#define REISERFS_MAXQUOTAS 2
/* reiserfs union of in-core super block data */ /* reiserfs union of in-core super block data */
struct reiserfs_sb_info { struct reiserfs_sb_info {
/* Buffer containing the super block */ /* Buffer containing the super block */
...@@ -615,7 +618,7 @@ struct reiserfs_sb_info { ...@@ -615,7 +618,7 @@ struct reiserfs_sb_info {
spinlock_t old_work_lock; /* protects old_work and work_queued */ spinlock_t old_work_lock; /* protects old_work and work_queued */
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
char *s_qf_names[MAXQUOTAS]; char *s_qf_names[REISERFS_MAXQUOTAS];
int s_jquota_fmt; int s_jquota_fmt;
#endif #endif
char *s_jdev; /* Stored jdev for mount option showing */ char *s_jdev; /* Stored jdev for mount option showing */
......
...@@ -206,7 +206,7 @@ static int finish_unfinished(struct super_block *s) ...@@ -206,7 +206,7 @@ static int finish_unfinished(struct super_block *s)
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
int i; int i;
int ms_active_set; int ms_active_set;
int quota_enabled[MAXQUOTAS]; int quota_enabled[REISERFS_MAXQUOTAS];
#endif #endif
/* compose key to look for "save" links */ /* compose key to look for "save" links */
...@@ -227,7 +227,7 @@ static int finish_unfinished(struct super_block *s) ...@@ -227,7 +227,7 @@ static int finish_unfinished(struct super_block *s)
s->s_flags |= MS_ACTIVE; s->s_flags |= MS_ACTIVE;
} }
/* Turn on quotas so that they are updated correctly */ /* Turn on quotas so that they are updated correctly */
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
quota_enabled[i] = 1; quota_enabled[i] = 1;
if (REISERFS_SB(s)->s_qf_names[i]) { if (REISERFS_SB(s)->s_qf_names[i]) {
int ret; int ret;
...@@ -370,7 +370,7 @@ static int finish_unfinished(struct super_block *s) ...@@ -370,7 +370,7 @@ static int finish_unfinished(struct super_block *s)
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
/* Turn quotas off */ /* Turn quotas off */
reiserfs_write_unlock(s); reiserfs_write_unlock(s);
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
if (sb_dqopt(s)->files[i] && quota_enabled[i]) if (sb_dqopt(s)->files[i] && quota_enabled[i])
dquot_quota_off(s, i); dquot_quota_off(s, i);
} }
...@@ -1360,7 +1360,7 @@ static void handle_quota_files(struct super_block *s, char **qf_names, ...@@ -1360,7 +1360,7 @@ static void handle_quota_files(struct super_block *s, char **qf_names,
{ {
int i; int i;
for (i = 0; i < MAXQUOTAS; i++) { for (i = 0; i < REISERFS_MAXQUOTAS; i++) {
if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
kfree(REISERFS_SB(s)->s_qf_names[i]); kfree(REISERFS_SB(s)->s_qf_names[i]);
REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; 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,7 +1381,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
struct reiserfs_journal *journal = SB_JOURNAL(s); struct reiserfs_journal *journal = SB_JOURNAL(s);
char *new_opts = kstrdup(arg, GFP_KERNEL); char *new_opts = kstrdup(arg, GFP_KERNEL);
int err; int err;
char *qf_names[MAXQUOTAS]; char *qf_names[REISERFS_MAXQUOTAS];
unsigned int qfmt = 0; unsigned int qfmt = 0;
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
int i; int i;
...@@ -1400,7 +1400,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) ...@@ -1400,7 +1400,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
(s, arg, &mount_options, &blocks, NULL, &commit_max_age, (s, arg, &mount_options, &blocks, NULL, &commit_max_age,
qf_names, &qfmt)) { qf_names, &qfmt)) {
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
for (i = 0; i < MAXQUOTAS; i++) for (i = 0; i < REISERFS_MAXQUOTAS; i++)
if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i])
kfree(qf_names[i]); kfree(qf_names[i]);
#endif #endif
...@@ -1844,7 +1844,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -1844,7 +1844,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
char *jdev_name; char *jdev_name;
struct reiserfs_sb_info *sbi; struct reiserfs_sb_info *sbi;
int errval = -EINVAL; int errval = -EINVAL;
char *qf_names[MAXQUOTAS] = {}; char *qf_names[REISERFS_MAXQUOTAS] = {};
unsigned int qfmt = 0; unsigned int qfmt = 0;
save_mount_options(s, data); save_mount_options(s, data);
...@@ -2169,7 +2169,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) ...@@ -2169,7 +2169,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
{ {
int j; int j;
for (j = 0; j < MAXQUOTAS; j++) for (j = 0; j < REISERFS_MAXQUOTAS; j++)
kfree(qf_names[j]); kfree(qf_names[j]);
} }
#endif #endif
......
...@@ -223,11 +223,18 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -223,11 +223,18 @@ long udf_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
static int udf_release_file(struct inode *inode, struct file *filp) static int udf_release_file(struct inode *inode, struct file *filp)
{ {
if (filp->f_mode & FMODE_WRITE) { if (filp->f_mode & FMODE_WRITE &&
atomic_read(&inode->i_writecount) > 1) {
/*
* Grab i_mutex to avoid races with writes changing i_size
* while we are running.
*/
mutex_lock(&inode->i_mutex);
down_write(&UDF_I(inode)->i_data_sem); down_write(&UDF_I(inode)->i_data_sem);
udf_discard_prealloc(inode); udf_discard_prealloc(inode);
udf_truncate_tail_extent(inode); udf_truncate_tail_extent(inode);
up_write(&UDF_I(inode)->i_data_sem); up_write(&UDF_I(inode)->i_data_sem);
mutex_unlock(&inode->i_mutex);
} }
return 0; return 0;
} }
......
...@@ -1277,7 +1277,7 @@ int udf_setsize(struct inode *inode, loff_t newsize) ...@@ -1277,7 +1277,7 @@ int udf_setsize(struct inode *inode, loff_t newsize)
*/ */
#define UDF_MAX_ICB_NESTING 1024 #define UDF_MAX_ICB_NESTING 1024
static int udf_read_inode(struct inode *inode) static int udf_read_inode(struct inode *inode, bool hidden_inode)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct fileEntry *fe; struct fileEntry *fe;
...@@ -1436,9 +1436,12 @@ static int udf_read_inode(struct inode *inode) ...@@ -1436,9 +1436,12 @@ static int udf_read_inode(struct inode *inode)
link_count = le16_to_cpu(fe->fileLinkCount); link_count = le16_to_cpu(fe->fileLinkCount);
if (!link_count) { if (!link_count) {
if (!hidden_inode) {
ret = -ESTALE; ret = -ESTALE;
goto out; goto out;
} }
link_count = 1;
}
set_nlink(inode, link_count); set_nlink(inode, link_count);
inode->i_size = le64_to_cpu(fe->informationLength); inode->i_size = le64_to_cpu(fe->informationLength);
...@@ -1826,7 +1829,8 @@ static int udf_update_inode(struct inode *inode, int do_sync) ...@@ -1826,7 +1829,8 @@ static int udf_update_inode(struct inode *inode, int do_sync)
return err; return err;
} }
struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino) struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
bool hidden_inode)
{ {
unsigned long block = udf_get_lb_pblock(sb, ino, 0); unsigned long block = udf_get_lb_pblock(sb, ino, 0);
struct inode *inode = iget_locked(sb, block); 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,7 +1843,7 @@ struct inode *udf_iget(struct super_block *sb, struct kernel_lb_addr *ino)
return inode; return inode;
memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr));
err = udf_read_inode(inode); err = udf_read_inode(inode, hidden_inode);
if (err < 0) { if (err < 0) {
iget_failed(inode); iget_failed(inode);
return ERR_PTR(err); return ERR_PTR(err);
......
...@@ -959,7 +959,7 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb, ...@@ -959,7 +959,7 @@ struct inode *udf_find_metadata_inode_efe(struct super_block *sb,
addr.logicalBlockNum = meta_file_loc; addr.logicalBlockNum = meta_file_loc;
addr.partitionReferenceNum = partition_num; addr.partitionReferenceNum = partition_num;
metadata_fe = udf_iget(sb, &addr); metadata_fe = udf_iget_special(sb, &addr);
if (IS_ERR(metadata_fe)) { if (IS_ERR(metadata_fe)) {
udf_warn(sb, "metadata inode efe not found\n"); 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,7 +1020,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
udf_debug("Bitmap file location: block = %d part = %d\n", udf_debug("Bitmap file location: block = %d part = %d\n",
addr.logicalBlockNum, addr.partitionReferenceNum); addr.logicalBlockNum, addr.partitionReferenceNum);
fe = udf_iget(sb, &addr); fe = udf_iget_special(sb, &addr);
if (IS_ERR(fe)) { if (IS_ERR(fe)) {
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n"); 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,7 +1119,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
}; };
struct inode *inode; struct inode *inode;
inode = udf_iget(sb, &loc); inode = udf_iget_special(sb, &loc);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
udf_debug("cannot load unallocSpaceTable (part %d)\n", udf_debug("cannot load unallocSpaceTable (part %d)\n",
p_index); p_index);
...@@ -1154,7 +1154,7 @@ static int udf_fill_partdesc_info(struct super_block *sb, ...@@ -1154,7 +1154,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
}; };
struct inode *inode; struct inode *inode;
inode = udf_iget(sb, &loc); inode = udf_iget_special(sb, &loc);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
udf_debug("cannot load freedSpaceTable (part %d)\n", udf_debug("cannot load freedSpaceTable (part %d)\n",
p_index); p_index);
...@@ -1198,7 +1198,7 @@ static void udf_find_vat_block(struct super_block *sb, int p_index, ...@@ -1198,7 +1198,7 @@ static void udf_find_vat_block(struct super_block *sb, int p_index,
vat_block >= map->s_partition_root && vat_block >= map->s_partition_root &&
vat_block >= start_block - 3; vat_block--) { vat_block >= start_block - 3; vat_block--) {
ino.logicalBlockNum = vat_block - map->s_partition_root; ino.logicalBlockNum = vat_block - map->s_partition_root;
inode = udf_iget(sb, &ino); inode = udf_iget_special(sb, &ino);
if (!IS_ERR(inode)) { if (!IS_ERR(inode)) {
sbi->s_vat_inode = inode; sbi->s_vat_inode = inode;
break; break;
......
...@@ -138,7 +138,18 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *, ...@@ -138,7 +138,18 @@ extern int udf_write_fi(struct inode *inode, struct fileIdentDesc *,
/* file.c */ /* file.c */
extern long udf_ioctl(struct file *, unsigned int, unsigned long); extern long udf_ioctl(struct file *, unsigned int, unsigned long);
/* inode.c */ /* inode.c */
extern struct inode *udf_iget(struct super_block *, struct kernel_lb_addr *); extern struct inode *__udf_iget(struct super_block *, struct kernel_lb_addr *,
bool hidden_inode);
static inline struct inode *udf_iget_special(struct super_block *sb,
struct kernel_lb_addr *ino)
{
return __udf_iget(sb, ino, true);
}
static inline struct inode *udf_iget(struct super_block *sb,
struct kernel_lb_addr *ino)
{
return __udf_iget(sb, ino, false);
}
extern int udf_expand_file_adinicb(struct inode *); extern int udf_expand_file_adinicb(struct inode *);
extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *);
extern struct buffer_head *udf_bread(struct inode *, int, int, int *); extern struct buffer_head *udf_bread(struct inode *, int, int, int *);
......
...@@ -81,8 +81,6 @@ static time_t year_seconds[MAX_YEAR_SECONDS] = { ...@@ -81,8 +81,6 @@ static time_t year_seconds[MAX_YEAR_SECONDS] = {
/*2038*/ SPY(68, 17, 0) /*2038*/ SPY(68, 17, 0)
}; };
extern struct timezone sys_tz;
#define SECS_PER_HOUR (60 * 60) #define SECS_PER_HOUR (60 * 60)
#define SECS_PER_DAY (SECS_PER_HOUR * 24) #define SECS_PER_DAY (SECS_PER_HOUR * 24)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment