Re: [PATCH 05/11] quota: Allow to pass quotactl a mountpoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 15, 2019 at 12:39:46AM +0100, Al Viro wrote:
> On Thu, Aug 15, 2019 at 12:36:32AM +0100, Al Viro wrote:
> > On Wed, Aug 14, 2019 at 02:18:28PM +0200, Sascha Hauer wrote:
> > > +/**
> > > + * reference_super - get a reference to a given superblock
> > > + * @sb: superblock to get the reference from
> > > + *
> > > + * Takes a reference to a superblock. Can be used as when the superblock
> > > + * is known and leaves it in a state as if get_super had been called.
> > > + */
> > > +void reference_super(struct super_block *sb)
> > > +{
> > > +	spin_lock(&sb_lock);
> > > +	sb->s_count++;
> > > +	spin_unlock(&sb_lock);
> > > +
> > > +	down_read(&sb->s_umount);
> > > +}
> > > +EXPORT_SYMBOL_GPL(reference_super);
> > 
> > NAK, for a plenty of reasons
> > 
> > 1) introduction of EXPORT_SYMBOL_GPL garbage
> > 2) aforementioned garbage on something that doesn't need to be exported
> > 3) *way* too easily abused - get_super() is, at least, not tempting to
> > play with in random code.  This one is, and it's too low-level to
> > allow.
> 
> ... and this is a crap userland API.
> 
> *IF* you want mountpoint-based variants of quotactl() commands, by all means,
> add those.  Do not overload the old ones.  And for path-based you don't
> need to mess with superblock references - just keep the struct path until
> the end.  That will keep the superblock alive and active just fine.

I'll happily drop these changes. To clarify, quota currently does:

	if (quotactl_cmd_onoff(cmd))
		sb = get_super_exclusive_thawed(bdev);
	else if (quotactl_cmd_write(cmd))
		sb = get_super_thawed(bdev);
	else
		sb = get_super(bdev);

You are saying that the struct super_block I get from a struct path pointer is
in a suitable state for all the cases above, right?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux