From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DA54C43381 for ; Mon, 25 Jan 2021 20:47:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25BE0224DF for ; Mon, 25 Jan 2021 20:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732200AbhAYUol (ORCPT ); Mon, 25 Jan 2021 15:44:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732174AbhAYUoZ (ORCPT ); Mon, 25 Jan 2021 15:44:25 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50144C061574 for ; Mon, 25 Jan 2021 12:43:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=50rdGGRcUaSkPpis7lUfu3LrVnBfoRkaHShYQAQljW4=; b=rNyfrzJJFlsslQGGX976kUrj14 qY5AVfDFICTZjzTsCoZ+4TO735fTLbAkzmOdCHo/KD2vt65u/osgVXyZ0DOOGv4mkGv9xyHfQXx8j PTgGQ3jlJPKhk4cNtju5TmP4PVpeEKNjEJeyRH1WD9hQC/AKp8y9BgH1uUorzbFRGiMwGrWaycJI/ q5Hr/5PcoHLYfc2na36Wo3deya2bFao1a3cOU+F3fvgzlu1fAddpTT+JYJjqXkzcnlcYpZ3UQL2vw CjbPG9gIMd9yhih2uo16nLMCI9lrX1hRDG+akVoxmLE5q9QUnYK9uABcW0QyurnmFX4n4poy6L//a W15JiESg==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l48hF-004ddP-FH; Mon, 25 Jan 2021 20:42:54 +0000 Date: Mon, 25 Jan 2021 20:42:49 +0000 From: Christoph Hellwig To: Jan Kara Cc: Sascha Hauer , Christoph Hellwig , linux-fsdevel@vger.kernel.org, Richard Weinberger , linux-mtd@lists.infradead.org, kernel@pengutronix.de, Jan Kara Subject: Re: [PATCH 1/8] quota: Allow to pass mount path to quotactl Message-ID: <20210125204249.GA1103662@infradead.org> References: <20210122151536.7982-1-s.hauer@pengutronix.de> <20210122151536.7982-2-s.hauer@pengutronix.de> <20210122171658.GA237653@infradead.org> <20210125083854.GB31738@pengutronix.de> <20210125154507.GH1175@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210125154507.GH1175@quack2.suse.cz> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Jan 25, 2021 at 04:45:07PM +0100, Jan Kara wrote: > > 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: I don't think we need a quotactl_sb at all, do_quotactl is in fact a pretty good abstraction as-is. For the path based one we just need to factor out a little helper to set excl and thaw and then call it like: sb = path.dentry->d_inode->i_sb; if (excl) down_write(&sb->s_umount); else down_read(&sb->s_umount); if (thawed && sb->s_writers.frozen != SB_UNFROZEN) ret = -EBUSY; else ret = do_quotactl(sb, type, cmds, id, addr, &path); if (excl) up_write(&sb->s_umount); else up_read(&sb->s_umount); as there is no good reason to bring over the somewhat strange wait until unfrozen semantics to a new syscall.