linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: <linux-ext4@vger.kernel.org>, <reiserfs-devel@vger.kernel.org>,
	jfs-discussion@lists.sourceforge.net, Jan Kara <jack@suse.cz>
Subject: [PATCH 05/11] quota: Stop setting IMMUTABLE and NOATIME flags on quota files
Date: Wed, 12 Apr 2017 09:26:05 +0200	[thread overview]
Message-ID: <20170412072611.29017-6-jack@suse.cz> (raw)
In-Reply-To: <20170412072611.29017-1-jack@suse.cz>

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.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 74b489e3714d..7e94cb0ecdde 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2188,8 +2188,7 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags)
 		/* This can happen when suspending quotas on remount-ro... */
 		if (toputinode[cnt] && !sb_has_quota_loaded(sb, cnt)) {
 			inode_lock(toputinode[cnt]);
-			toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
-				  S_NOATIME | S_NOQUOTA);
+			toputinode[cnt]->i_flags &= ~S_NOQUOTA;
 			truncate_inode_pages(&toputinode[cnt]->i_data, 0);
 			inode_unlock(toputinode[cnt]);
 			mark_inode_dirty_sync(toputinode[cnt]);
@@ -2237,7 +2236,6 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
 	struct super_block *sb = inode->i_sb;
 	struct quota_info *dqopt = sb_dqopt(sb);
 	int error;
-	int oldflags = -1;
 
 	if (!fmt)
 		return -ESRCH;
@@ -2285,9 +2283,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
 		 * possible) Also nobody should write to the file - we use
 		 * special IO operations which ignore the immutable bit. */
 		inode_lock(inode);
-		oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE |
-					     S_NOQUOTA);
-		inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
+		inode->i_flags |= S_NOQUOTA;
 		inode_unlock(inode);
 		/*
 		 * 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,
 	dqopt->files[type] = NULL;
 	iput(inode);
 out_file_flags:
-	if (oldflags != -1) {
-		inode_lock(inode);
-		/* Set the flags back (in the case of accidental quotaon()
-		 * on a wrong file we don't want to mess up the flags) */
-		inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE);
-		inode->i_flags |= oldflags;
-		inode_unlock(inode);
-	}
+	inode_lock(inode);
+	inode->i_flags &= ~S_NOQUOTA;
+	inode_unlock(inode);
 out_fmt:
 	put_quota_format(fmt);
 
-- 
2.12.0

  parent reply	other threads:[~2017-04-12  7:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12  7:26 [PATCH 0/11] quota: Stop setting IMMUTABLE and NOATIME flags directly Jan Kara
2017-04-12  7:26 ` [PATCH 01/11] ext4: Set flags on quota files directly Jan Kara
2017-04-12 21:00   ` Andreas Dilger
2017-04-13  8:01     ` Jan Kara
2017-04-12  7:26 ` [PATCH 02/11] reiserfs: " Jan Kara
2017-04-12  7:26 ` [PATCH 03/11] ext2: " Jan Kara
2017-04-12  7:26 ` [PATCH 04/11] jfs: " Jan Kara
2017-04-12  7:26 ` Jan Kara [this message]
2017-04-13  4:04   ` [PATCH 05/11] quota: Stop setting IMMUTABLE and NOATIME flags on quota files Andreas Dilger
2017-04-12  7:26 ` [PATCH 06/11] ext4: Remove ext4_get_inode_flags() Jan Kara
2017-04-13  4:05   ` Andreas Dilger
2017-04-12  7:26 ` [PATCH 07/11] ext2: Remove ext2_get_inode_flags() Jan Kara
2017-04-13  4:05   ` Andreas Dilger
2017-04-12  7:26 ` [PATCH 08/11] jfs: Remove jfs_get_inode_flags() Jan Kara
2017-04-12  7:26 ` [PATCH 09/11] reiserfs: Remove useless setting of i_flags Jan Kara
2017-04-12  7:26 ` [PATCH 10/11] reiserfs: Remove i_attrs_to_sd_attrs() Jan Kara
2017-04-12  7:26 ` [PATCH 11/11] quota: Remove dquot_quotactl_ops Jan Kara
2017-04-15  3:22 ` Can the patch set [1] be put up on openSUSE Build Service as well please ? doiggl
2017-04-18  9:18   ` Jan Kara
2017-04-19 10:34 ` [PATCH 0/11] quota: Stop setting IMMUTABLE and NOATIME flags directly Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170412072611.29017-6-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reiserfs-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).