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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE69EC25B0D for ; Tue, 16 Aug 2022 00:12:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41A706B0073; Mon, 15 Aug 2022 20:12:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CAC98D0002; Mon, 15 Aug 2022 20:12:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 297DE8D0001; Mon, 15 Aug 2022 20:12:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1A7986B0073 for ; Mon, 15 Aug 2022 20:12:20 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E1D96A06B6 for ; Tue, 16 Aug 2022 00:12:19 +0000 (UTC) X-FDA: 79803528798.11.472B7B5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf11.hostedemail.com (Postfix) with ESMTP id 8A29840049 for ; Tue, 16 Aug 2022 00:12:19 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 915B460B64; Tue, 16 Aug 2022 00:12:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A26ECC433D6; Tue, 16 Aug 2022 00:12:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660608738; bh=8Jobnfnb834DpLHUqKSpTUo6dVZq1+29pR0tWVF0JZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ek0Mv6qxbGV2+YblJKEPMiTmBjvbTS5fWtxqwZUZRz3hHjh1tkcEH5LeIyNf/jqzD T5LD4Bl3zDupErWpSS2L3jYFYKdAsYheGvTy8xRS9O9tsAoGECmZzV0hRbctB7i2FG wqkKmJu8IKIr4BsXjJjLGZQ0dJwP6n8FtenJHdPN3QfsW/Ziw6w94HN32N896+Yji8 lNDnhtrhe45LIctU+eBameohmiUg2KWCw9miDCgpbicHi/vTFaLjpc1T75lOYUtbMb gaf9JoUnXSSo+XSPznkQRZYDoiARdTOzQqF2ViU3GSVyE20q+pC1BIbkBFU7LbimFq U5W2ByBpHjXOQ== From: SeongJae Park To: SeongJae Park Cc: "Pulavarty, Badari" , "damon@lists.linux.dev" , "linux-mm@kvack.org" Subject: RE: [PATCH] DAMON dbgfs_mk_context() error handling Date: Tue, 16 Aug 2022 00:12:15 +0000 Message-Id: <20220816001215.95156-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220815234210.95016-1-sj@kernel.org> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660608739; a=rsa-sha256; cv=none; b=7hk9d8aZaZINH4qMPYv4eevGcmDMOdjJgPU97h9er2s9T9Ge/p/rb6/i9Crz2TA4KX68Kf dF7ml10U8ExzeDWrPQa2NiWgmeVCL6jk5x+OLE/J7WioLauAFXP5sMqC++tFLtqc+IHNe8 Ch3SPLAAK3eRCYc7JdokakdyagsGgpw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ek0Mv6qx; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660608739; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oZ4WaIUVwHXge0oXL1TfM2HidzAATYp9Cbr2opkMokE=; b=NAhrdkX+ZCS8Z/cruFwnITq+WXk4Bql4T+5+/Z+dtE3g3lAJ9meVTawPIh6Dtb7P4SzVh8 7IzbJOcyQZiRWhUHPQTGRFTD0UxCjJkpWo+BhTnQ5hdz+TWYOWGE05UnvK010Y5BppDqVV Db6n8ljV7t7mRxC7aqDO1omwJDUo/0Y= Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ek0Mv6qx; spf=pass (imf11.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspam-User: X-Stat-Signature: 98dnpkfiwbzbqc3rqak7om7kbfxqq6kr X-Rspamd-Queue-Id: 8A29840049 X-Rspamd-Server: rspam06 X-HE-Tag: 1660608739-924496 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 15 Aug 2022 23:42:10 +0000 SeongJae Park wrote: > Hi Badari, > > > On Mon, 15 Aug 2022 21:51:04 +0000 "Pulavarty, Badari" wrote: > > > [-- Attachment #1: Type: text/plain, Size: 350 bytes --] > > > > Hi SI, > > > > > Nice finding, thank you! But, the return value of the debugfs call is intentionally ignored[2]. How about doing the duplicated name check in > > > dbgfs_mk_context() itself before the debugfs_create_dir() call? > > Please don't unwrap wrapped message. My monitor is not so wide :'( > > > > > > > [2] https://lore.kernel.org/linux-mm/20210205155902.31102-1-sjpark@amazon.com/ > > > > How about this? > > > > Thanks, > > Badari > > > > > > > > [-- Attachment #2: damon-mkcontext-fix.patch --] > > [-- Type: application/octet-stream, Size: 858 bytes --] > > Could you please don't send a patch as an attached file of the mail but put it > in the mail body so that we can easily read the patch and comment in line? > > > > > damon dbgfs_mk_context() should check to make sure there is no existing > > context with the same name. Otherwise, it will cause failure when we > > enabling the monitor. > > > > Test case: > > > > echo "off" > /sys/kernel/debug/damon/monitor_on > > echo "abc" > /sys/kernel/debug/damon/mk_context > > echo "abc" > /sys/kernel/debug/damon/mk_context > > echo > /sys/kernel/debug/damon/abc/target_ids > > echo "on" > /sys/kernel/debug/damon/monitor_on <<< fails > > > > Signed-off-by: Badari Pulavarty > > --- > > It would be good to put the changelog of this patch here: > https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format > > > --- a/mm/damon/dbgfs.c 2022-08-15 14:27:38.308806431 -0700 > > +++ b/mm/damon/dbgfs.c 2022-08-15 14:33:31.661163048 -0700 > > @@ -817,6 +817,12 @@ > > if (!root) > > return -ENOENT; > > > > + new_dir = debugfs_lookup(name, root); > > + if (new_dir) { > > + dput(new_dir); > > + return -EEXIST; > > + } > > + > > The change looks ok to me at a glance, but the attached file seems not an > appropriate patch. Could you please repost this as a formal patch as suggested > for a better review? Also, please add 'Fixes:' tag and Cc stable@vger.kernel.org to the patch. Thanks, SJ > > Thanks, > SJ > > > new_dir = debugfs_create_dir(name, root); > > dbgfs_dirs[dbgfs_nr_ctxs] = new_dir;