[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230413144557.20700-1-frank.li@vivo.com>
Date: Thu, 13 Apr 2023 22:45:57 +0800
From: Yangtao Li <frank.li@...o.com>
To: Jan Kara <jack@...e.com>
Cc: Yangtao Li <frank.li@...o.com>, linux-kernel@...r.kernel.org
Subject: [PATCH] quota: remove PRINT_QUOTA_WARNING support
It's deprecated since commit 8e8934695dfd ("quota: send messages
via netlink"), so let's remove it. User should use notification via
netlink socket instead.
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
fs/quota/Kconfig | 10 ------
fs/quota/dquot.c | 80 +-----------------------------------------------
2 files changed, 1 insertion(+), 89 deletions(-)
diff --git a/fs/quota/Kconfig b/fs/quota/Kconfig
index d5a85a8062d0..1b3bc0a99515 100644
--- a/fs/quota/Kconfig
+++ b/fs/quota/Kconfig
@@ -26,16 +26,6 @@ config QUOTA_NETLINK_INTERFACE
hardlimit, etc.) will be reported through netlink interface. If unsure,
say Y.
-config PRINT_QUOTA_WARNING
- bool "Print quota warnings to console (OBSOLETE)"
- depends on QUOTA
- default y
- help
- If you say Y here, quota warnings (about exceeding softlimit, reaching
- hardlimit, etc.) will be printed to the process' controlling terminal.
- Note that this behavior is currently deprecated and may go away in
- future. Please use notification via netlink socket instead.
-
config QUOTA_DEBUG
bool "Additional quota sanity checks"
depends on QUOTA
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index a6357f728034..10b46c403bdb 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -154,7 +154,7 @@ void __quota_error(struct super_block *sb, const char *func,
}
EXPORT_SYMBOL(__quota_error);
-#if defined(CONFIG_QUOTA_DEBUG) || defined(CONFIG_PRINT_QUOTA_WARNING)
+#if defined(CONFIG_QUOTA_DEBUG)
static char *quotatypes[] = INITQFNAMES;
#endif
static struct quota_format_type *quota_formats; /* List of registered formats */
@@ -1171,72 +1171,6 @@ static int warning_issued(struct dquot *dquot, const int warntype)
return test_and_set_bit(flag, &dquot->dq_flags);
}
-#ifdef CONFIG_PRINT_QUOTA_WARNING
-static int flag_print_warnings = 1;
-
-static int need_print_warning(struct dquot_warn *warn)
-{
- if (!flag_print_warnings)
- return 0;
-
- switch (warn->w_dq_id.type) {
- case USRQUOTA:
- return uid_eq(current_fsuid(), warn->w_dq_id.uid);
- case GRPQUOTA:
- return in_group_p(warn->w_dq_id.gid);
- case PRJQUOTA:
- return 1;
- }
- return 0;
-}
-
-/* Print warning to user which exceeded quota */
-static void print_warning(struct dquot_warn *warn)
-{
- char *msg = NULL;
- struct tty_struct *tty;
- int warntype = warn->w_type;
-
- if (warntype == QUOTA_NL_IHARDBELOW ||
- warntype == QUOTA_NL_ISOFTBELOW ||
- warntype == QUOTA_NL_BHARDBELOW ||
- warntype == QUOTA_NL_BSOFTBELOW || !need_print_warning(warn))
- return;
-
- tty = get_current_tty();
- if (!tty)
- return;
- tty_write_message(tty, warn->w_sb->s_id);
- if (warntype == QUOTA_NL_ISOFTWARN || warntype == QUOTA_NL_BSOFTWARN)
- tty_write_message(tty, ": warning, ");
- else
- tty_write_message(tty, ": write failed, ");
- tty_write_message(tty, quotatypes[warn->w_dq_id.type]);
- switch (warntype) {
- case QUOTA_NL_IHARDWARN:
- msg = " file limit reached.\r\n";
- break;
- case QUOTA_NL_ISOFTLONGWARN:
- msg = " file quota exceeded too long.\r\n";
- break;
- case QUOTA_NL_ISOFTWARN:
- msg = " file quota exceeded.\r\n";
- break;
- case QUOTA_NL_BHARDWARN:
- msg = " block limit reached.\r\n";
- break;
- case QUOTA_NL_BSOFTLONGWARN:
- msg = " block quota exceeded too long.\r\n";
- break;
- case QUOTA_NL_BSOFTWARN:
- msg = " block quota exceeded.\r\n";
- break;
- }
- tty_write_message(tty, msg);
- tty_kref_put(tty);
-}
-#endif
-
static void prepare_warning(struct dquot_warn *warn, struct dquot *dquot,
int warntype)
{
@@ -1259,9 +1193,6 @@ static void flush_warnings(struct dquot_warn *warn)
for (i = 0; i < MAXQUOTAS; i++) {
if (warn[i].w_type == QUOTA_NL_NOWARN)
continue;
-#ifdef CONFIG_PRINT_QUOTA_WARNING
- print_warning(&warn[i]);
-#endif
quota_send_warning(warn[i].w_dq_id,
warn[i].w_sb->s_dev, warn[i].w_type);
}
@@ -2936,15 +2867,6 @@ static struct ctl_table fs_dqstats_table[] = {
.mode = 0444,
.proc_handler = do_proc_dqstats,
},
-#ifdef CONFIG_PRINT_QUOTA_WARNING
- {
- .procname = "warnings",
- .data = &flag_print_warnings,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec,
- },
-#endif
{ },
};
--
2.35.1
Powered by blists - more mailing lists