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 8848AC00140 for ; Mon, 15 Aug 2022 23:42:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD4738D0001; Mon, 15 Aug 2022 19:42:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D5BEC6B0075; Mon, 15 Aug 2022 19:42:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFCC88D0001; Mon, 15 Aug 2022 19:42:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AB08A6B0073 for ; Mon, 15 Aug 2022 19:42:16 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7C078160E44 for ; Mon, 15 Aug 2022 23:42:16 +0000 (UTC) X-FDA: 79803453072.23.CE9A68D Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf04.hostedemail.com (Postfix) with ESMTP id F3ED540018 for ; Mon, 15 Aug 2022 23:42:15 +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 ams.source.kernel.org (Postfix) with ESMTPS id 13E4EB81249; Mon, 15 Aug 2022 23:42:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 649B6C433D6; Mon, 15 Aug 2022 23:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660606932; bh=58yaH86pz9K1ViOeBYMbEaj6JwLLYw1QuwMYWbFIqSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z5tfJVQnWKVAG16qIRgqi3fCmE3mTSQw0KPhfX3Q6aJIooYnLto5EuCtluPfX7DAZ Pr9ppSo8LDcHBOoy8cPr6L3pqYg3Qtj2dw17v1972R+12v/7HuZtLP+ScPG9jfixwW PkPCrnlbx7g4PXj4hEkVpBa/F9sOJgvVXjk+poFANQBGkzM6V4os/7/Ufpz3aftUec UPC+cGIfbQmMU2r5PfNihQB95A7s6P3flii9RewL0DG6m7AWY2kfhR0UQ6ngla+93L HzjpIZNnQWfZQdytFtmg0gCzxv9cK1rP4pu3d79+IPJkIkNleLqWtQ7u9BeDUHfV0R SvwSwFi80YRpQ== From: SeongJae Park To: "Pulavarty, Badari" Cc: SeongJae Park , "damon@lists.linux.dev" , "linux-mm@kvack.org" Subject: RE: [PATCH] DAMON dbgfs_mk_context() error handling Date: Mon, 15 Aug 2022 23:42:10 +0000 Message-Id: <20220815234210.95016-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660606936; 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=jeBNnKT4mONlPG8IPCYGQZyBjX04Ooh+I8aO7ujMf9E=; b=da4Oy8dPu3LM3ntxxX8Hgq0KN/gZnM5GTxK4ClIjUUIZZVCDLaKmX5181U6rSlZSWc1+iU 0dDtvG3zfpD7+bVx+iiDk9UXSqDiYT0i3pWUP9P3vSTjl7MHOSjL0J6wdZHRmf+3kSRqrY P3FmuTN+QGoLMCAIQy5q387+M1D194A= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z5tfJVQn; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660606936; a=rsa-sha256; cv=none; b=I2XDxKA/nbqyCO/JeGvSBUMo2+9G1C6g4ckEAQ9dD6wP+SSaab6089Z0O8l6sfe0fnOK0U L/WNghr22RFa9V7XujBi+c5k8sTKeBCreFRAxPXvIZh3i6fqBWjO1OfMhaIU/gERaTqaaw AR7FdqEb9bu5atKxiEPovaB44hGfivs= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F3ED540018 X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z5tfJVQn; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: jbfjhbdkghfft53sx73ofo9etuht9akd X-HE-Tag: 1660606935-556258 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: 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? Thanks, SJ > new_dir = debugfs_create_dir(name, root); > dbgfs_dirs[dbgfs_nr_ctxs] = new_dir;