linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: cem@kernel.org
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] Enable support for tmpfs quotas
Date: Wed, 17 Jan 2024 18:59:54 +0100	[thread overview]
Message-ID: <20240117175954.jikporwmchenbkrk@quack3> (raw)
In-Reply-To: <20240109134651.869887-4-cem@kernel.org>

On Tue 09-01-24 14:46:05, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
> 
> To achieve so, add a new function handle_quota() to the quotaio subsystem,
> this will call do_quotactl() with or without a valid quotadev, according to the
> filesystem type.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>

Thanks for the patch. Some comments bewow.

> diff --git a/quotaio.c b/quotaio.c
> index 9bebb5e..3cc2bb7 100644
> --- a/quotaio.c
> +++ b/quotaio.c
> @@ -34,6 +34,22 @@ struct disk_dqheader {
>  	u_int32_t dqh_version;
>  } __attribute__ ((packed));
>  
> +int handle_quota(int cmd, struct quota_handle *h, int id, void *addr)

Call this quotactl_handle()?

> +{
> +	int err = -EINVAL;
> +
> +	if (!h)
> +		return err;
> +
> +	if (!strcmp(h->qh_fstype, MNTTYPE_TMPFS))
> +		err = do_quotactl(QCMD(cmd, h->qh_type), NULL, h->qh_dir,
> +					id, addr);
> +	else
> +		err = do_quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
> +					h->qh_dir, id, addr);
> +
> +	return err;
> +}

...

> diff --git a/quotasys.c b/quotasys.c
> index 903816b..1f66302 100644
> --- a/quotasys.c
> +++ b/quotasys.c
> @@ -1384,7 +1390,11 @@ alloc:
>  			continue;
>  		}
>  
> -		if (!nfs_fstype(mnt->mnt_type)) {
> +		/*
> +		 * If devname and mnt->mnt_fsname matches, there is no real
> +		 * underlyin device, so skip these checks
> +		 */
> +		if (!nfs_fstype(mnt->mnt_type) && strcmp(devname, mnt->mnt_fsname)) {
>  			if (stat(devname, &st) < 0) {	/* Can't stat mounted device? */
>  				errstr(_("Cannot stat() mounted device %s: %s\n"), devname, strerror(errno));
>  				free((char *)devname);

I'm a bit uneasy about the added check because using device name the same
as filesystem name is just a common agreement but not enforced in any way.
So perhaps just add an explicit check for tmpfs? Later we can generalize
this if there are more filesystems like this...

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2024-01-17 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 13:46 [PATCH RFC 0/3] Enable tmpfs quotas cem
2024-01-09 13:46 ` [PATCH 1/3] Rename searched_dir->sd_dir to sd_isdir cem
2024-01-09 13:46 ` [PATCH 2/3] Add quotactl_fd() support cem
2024-01-17 18:08   ` Jan Kara
2024-01-24 11:25     ` Carlos Maiolino
2024-01-09 13:46 ` [PATCH 3/3] Enable support for tmpfs quotas cem
2024-01-17 17:59   ` Jan Kara [this message]
2024-01-24 11:42     ` Carlos Maiolino
2024-01-24 15:16       ` Jan Kara
2024-01-25 16:04 [PATCH 0/3] Add " cem
2024-01-25 16:04 ` [PATCH 3/3] Enable " cem
2024-01-26 18:02 [PATCH RESEND 0/3] Add " cem
2024-01-26 18:02 ` [PATCH 3/3] Enable " cem

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=20240117175954.jikporwmchenbkrk@quack3 \
    --to=jack@suse.cz \
    --cc=cem@kernel.org \
    --cc=linux-fsdevel@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).