On Mon 25-01-21 09:38:54, Sascha Hauer wrote: > On Fri, Jan 22, 2021 at 05:16:58PM +0000, Christoph Hellwig wrote: > > On Fri, Jan 22, 2021 at 04:15:29PM +0100, Sascha Hauer wrote: > > > This patch introduces the Q_PATH flag to the quotactl cmd argument. > > > When given, the path given in the special argument to quotactl will > > > be the mount path where the filesystem is mounted, instead of a path > > > to the block device. > > > This is necessary for filesystems which do not have a block device as > > > backing store. Particularly this is done for upcoming UBIFS support. > > > > > > Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> > > > > I hate overloading quotactl even more. Why not add a new quotactl_path > > syscall instead? > > We can probably do that. Honza, what do you think? Hum, yes, probably it would be cleaner to add a new syscall for this so that we don't overload quotactl(2). I just didn't think of this. > > > +static struct super_block *quotactl_path(const char __user *special, int cmd) > > > +{ > > > + struct super_block *sb; > > > + struct path path; > > > + int error; > > > + > > > + error = user_path_at(AT_FDCWD, special, LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT, > > > + &path); > > > > This adds an overly long line. > > ok, will change. > > > > > > + if (error) > > > + return ERR_PTR(error); > > > + > > > + sb = quotactl_sb(path.mnt->mnt_sb->s_dev, cmd); > > > > I think quotactl_sb should take the superblock directly. This will > > need a little refactoring of user_get_super, but will lead to much > > better logic. > > What do you mean by "take"? Take the superblock as an argument to > quotactl_sb() or take a reference to the superblock? > Sorry, I don't really get where you aiming at. I think Christoph was pointing at the fact it is suboptimal to search for superblock by device number when you already have a pointer to it. And I guess he was suggesting we could pass 'sb' pointer to quotactl_sb() when we already have it. Although to be honest, I'm not sure how Christoph imagines the refactoring of user_get_super() he mentions - when we have a path looked up through user_path(), that pins the superblock the path is on so it cannot be unmounted. So perhaps quotactl_sb() can done like: ... retry: if (passed_sb) { sb = passed_sb; sb->s_count++; if (excl) down_write(&sb->s_umount); else down_read(&sb->s_umount); } else { sb = user_get_super(dev, excl); if (!sb) return ERR_PTR(-ENODEV); } ... Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR