Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

Jan Kara aad6cde9 12fd086d

+5 -14
+5 -14
fs/quota/dquot.c
··· 2188 2188 /* This can happen when suspending quotas on remount-ro... */ 2189 2189 if (toputinode[cnt] && !sb_has_quota_loaded(sb, cnt)) { 2190 2190 inode_lock(toputinode[cnt]); 2191 - toputinode[cnt]->i_flags &= ~(S_IMMUTABLE | 2192 - S_NOATIME | S_NOQUOTA); 2191 + toputinode[cnt]->i_flags &= ~S_NOQUOTA; 2193 2192 truncate_inode_pages(&toputinode[cnt]->i_data, 0); 2194 2193 inode_unlock(toputinode[cnt]); 2195 2194 mark_inode_dirty_sync(toputinode[cnt]); ··· 2236 2237 struct super_block *sb = inode->i_sb; 2237 2238 struct quota_info *dqopt = sb_dqopt(sb); 2238 2239 int error; 2239 - int oldflags = -1; 2240 2240 2241 2241 if (!fmt) 2242 2242 return -ESRCH; ··· 2283 2285 * possible) Also nobody should write to the file - we use 2284 2286 * special IO operations which ignore the immutable bit. */ 2285 2287 inode_lock(inode); 2286 - oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | 2287 - S_NOQUOTA); 2288 - inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; 2288 + inode->i_flags |= S_NOQUOTA; 2289 2289 inode_unlock(inode); 2290 2290 /* 2291 2291 * When S_NOQUOTA is set, remove dquot references as no more ··· 2325 2329 dqopt->files[type] = NULL; 2326 2330 iput(inode); 2327 2331 out_file_flags: 2328 - if (oldflags != -1) { 2329 - inode_lock(inode); 2330 - /* Set the flags back (in the case of accidental quotaon() 2331 - * on a wrong file we don't want to mess up the flags) */ 2332 - inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); 2333 - inode->i_flags |= oldflags; 2334 - inode_unlock(inode); 2335 - } 2332 + inode_lock(inode); 2333 + inode->i_flags &= ~S_NOQUOTA; 2334 + inode_unlock(inode); 2336 2335 out_fmt: 2337 2336 put_quota_format(fmt); 2338 2337