@@ -2125,6 +2125,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
mutex_lock(&toputinode[cnt]->i_mutex);
toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
S_NOATIME | S_NOQUOTA);
+ toputinode[cnt]->i_flags |= dqopt->old_flags[cnt];
truncate_inode_pages(&toputinode[cnt]->i_data,
0);
mutex_unlock(&toputinode[cnt]->i_mutex);
@@ -2223,6 +2224,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE |
S_NOQUOTA);
inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
+ dqopt->old_flags[type] = oldflags;
mutex_unlock(&inode->i_mutex);
/*
* When S_NOQUOTA is set, remove dquot references as no more
@@ -507,6 +507,7 @@ struct quota_info {
struct mutex dqio_mutex; /* lock device while I/O in progress */
struct mutex dqonoff_mutex; /* Serialize quotaon & quotaoff */
struct inode *files[MAXQUOTAS]; /* inodes of quotafiles */
+ unsigned int old_flags[MAXQUOTAS]; /* i_flags for each quota file */
struct mem_dqinfo info[MAXQUOTAS]; /* Information for each quota type */
const struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
};
When we load quota files, we set the i_flags of the inodes to (S_NOQUOTA | S_NOATIME | S_IMMUTABLE). In dquot_disable() we only clear these flags, But we do not restore the old flags. That would change the i_flags of quota files if some of these flags were set before loading quota files. Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> --- fs/quota/dquot.c | 2 ++ include/linux/quota.h | 1 + 2 files changed, 3 insertions(+)