Linux filesystem development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Carlos Maiolino <cem@kernel.org>
Cc: Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] Enable support for tmpfs quotas
Date: Wed, 24 Jan 2024 16:16:59 +0100	[thread overview]
Message-ID: <20240124151659.cd3f5fcadryxjv7t@quack3> (raw)
In-Reply-To: <ozwso3vxlqvhncphhxdmqyhtcdjkngdm3zkthhdr2otr2jhbcf@vy57quyazjv5>

On Wed 24-01-24 12:42:39, Carlos Maiolino wrote:
> On Wed, Jan 17, 2024 at 06:59:54PM +0100, Jan Kara wrote:
> > On Tue 09-01-24 14:46:05, cem@kernel.org wrote:
> > > 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...
> 
> What about adding a new tmpfs_fstype() helper, to mimic nfs_fstype, and use it
> here? like:
> 
> if (!nfs_fstype(mnt->mnt_type) && tmpfs_fstype(mnt->mnt_type))) {
> 	/* skipe S_ISBLK && S_ISCHR checks */
> }
> 
> We could open code !strcmp(mnt->mnt_type, MNTTYPE_TMPFS), but it seems to me
> adding a new tmpfs_fstype() helper is easier on the eyes, and also OCFS2 does
> something similar.
> 
> Perhaps that's exactly what you meant as having an explicit check for tmpfs, but
> I'm not really sure?!

Yes, this would be a nice way of doing it.

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

  reply	other threads:[~2024-01-24 15:17 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
2024-01-24 11:42     ` Carlos Maiolino
2024-01-24 15:16       ` Jan Kara [this message]
  -- strict thread matches above, loose matches on Subject: below --
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=20240124151659.cd3f5fcadryxjv7t@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