mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Yangtao Li <frank.li@vivo.com>
Cc: Jan Kara <jack@suse.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] quota: remove PRINT_QUOTA_WARNING support
Date: Thu, 13 Apr 2023 17:57:05 +0200	[thread overview]
Message-ID: <20230413155705.cgmkdveu6gw7f7ii@quack3> (raw)
In-Reply-To: <20230413144557.20700-1-frank.li@vivo.com>

On Thu 13-04-23 22:45:57, Yangtao Li wrote:
> 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@vivo.com>

Yeah, but frankly I'm not sure whether there are not people still relying
on this. In particular distributions still seem to enable this config
option in their kernels. So rather than removing this config right away, we
could maybe make it depend on CONFIG_BROKEN and see who complains...

								Honza

> 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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2023-04-13 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13 14:45 Yangtao Li
2023-04-13 15:57 ` Jan Kara [this message]

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=20230413155705.cgmkdveu6gw7f7ii@quack3 \
    --to=jack@suse.cz \
    --cc=frank.li@vivo.com \
    --cc=jack@suse.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®