Skip to content

Commit aad6cde

Browse files
committed
quota: Stop setting IMMUTABLE and NOATIME flags on quota files
Currently we set IMMUTABLE and NOATIME flags on quota files to stop userspace from messing with them. Now that all filesystems set these flags in their quota_on handlers, we can stop setting the flags in generic quota code. This will allow filesystems to stop copying i_flags to their on-disk flags on various occasions. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 12fd086 commit aad6cde

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎fs/quota/dquot.c‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,8 +2188,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
21882188
/* This can happen when suspending quotas on remount-ro... */
21892189
if (toputinode[cnt] && !sb_has_quota_loaded(sb, cnt)) {
21902190
inode_lock(toputinode[cnt]);
2191-
toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
2192-
S_NOATIME | S_NOQUOTA);
2191+
toputinode[cnt]->i_flags &= ~S_NOQUOTA;
21932192
truncate_inode_pages(&toputinode[cnt]->i_data, 0);
21942193
inode_unlock(toputinode[cnt]);
21952194
mark_inode_dirty_sync(toputinode[cnt]);
@@ -2237,7 +2236,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
22372236
struct super_block *sb = inode->i_sb;
22382237
struct quota_info *dqopt = sb_dqopt(sb);
22392238
int error;
2240-
int oldflags = -1;
22412239

22422240
if (!fmt)
22432241
return -ESRCH;
@@ -2285,9 +2283,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
22852283
* possible) Also nobody should write to the file - we use
22862284
* special IO operations which ignore the immutable bit. */
22872285
inode_lock(inode);
2288-
oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE |
2289-
S_NOQUOTA);
2290-
inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
2286+
inode->i_flags |= S_NOQUOTA;
22912287
inode_unlock(inode);
22922288
/*
22932289
* When S_NOQUOTA is set, remove dquot references as no more
@@ -2329,14 +2325,9 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
23292325
dqopt->files[type] = NULL;
23302326
iput(inode);
23312327
out_file_flags:
2332-
if (oldflags != -1) {
2333-
inode_lock(inode);
2334-
/* Set the flags back (in the case of accidental quotaon()
2335-
* on a wrong file we don't want to mess up the flags) */
2336-
inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE);
2337-
inode->i_flags |= oldflags;
2338-
inode_unlock(inode);
2339-
}
2328+
inode_lock(inode);
2329+
inode->i_flags &= ~S_NOQUOTA;
2330+
inode_unlock(inode);
23402331
out_fmt:
23412332
put_quota_format(fmt);
23422333

0 commit comments

Comments
 (0)