Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp897851lqd; Wed, 24 Apr 2024 23:06:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYUzcLj0qL4v2tVkeUQg62W8ue4mITDnBtrEf3FtDbbEnA139yzCkr9W4rQJROsoF1xfgdbgtB+LblcFaNiUuNN13X54OKjYrQJ76pRg== X-Google-Smtp-Source: AGHT+IEFI2GkpD4lCayUprGfMBnE4NoKp2Ye6iOrM1kPsmavwgvDRuWaqBI9o2snVW/52IwzQ+7z X-Received: by 2002:a05:6870:c194:b0:220:ee88:6107 with SMTP id h20-20020a056870c19400b00220ee886107mr5357345oad.23.1714025218415; Wed, 24 Apr 2024 23:06:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714025218; cv=pass; d=google.com; s=arc-20160816; b=eB2n7E4Iov8X27asymbIH/b9c+o9VNUh+VhfB54M3aZdGlwwUTvb2pViA6tYqxakz7 0obMLbwAlUZnBMz/NZcHnHz+df+V7E2D5ybdUILSyuxnYxKo2k4KFCNKmzGfmFmS/ud/ RpsC8ZP9avRSiVJ/Rio4ssGyiCSOOuH88d9/wqLnnTjkjUmp4dqv/4Z7UTsRA+AQh8gP +HNBVM2ZyiunYvnGvs/1KLrqtKiq8ixiSyfPOYyvFIrx1qQX0kM309DAPrAIQ+N5jkxh HOWvgcy1wil+7V5OAv7SIZ2tCvFXAHfE+gpq07rkJQZU/VUtfhE8tekTrD+yq4QFfp1e J8Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Kdu2kkuJAVCmKf8384cv38eneufBKUPC8ObGdfPhtmQ=; fh=e95vDW4Ehhkit26Hq7yqBaRmdDqQmZYaArJOgAGwhZs=; b=V38AcN9I/WU0k62ywC/vY0iURonwkXUcfNd048aXyfUJ8WIchtEp13lM9PeLYe5GSL hvPEYxyb/QrId5Vy2VrcrG7sdL760lsr538NEF6iAW1JHGFgOqsaYH4opda2G0RzcqrY A5vGCJW1Bna5O+DwPgtsNDwgMeOGt3zGSD3QHkbI/Tom6Im/UPvkq1xuy0V9Dtar85Xi lQjNPxpu49uAL5dEs25GaeGK/jh7jgfHdFlahYuXQmqfGeIiS2ayZlTSUBu+m718w0oB Nn2VtP7+Pa4P/Ip9NpPaVe5dacnDuKMIE0t1jzr8r4QqkVLZ0OYiWY5nGmvzoeI6CFT2 Hzyw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Mixn5Q1O; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-158047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lm1-20020a056a003c8100b006ea8cb1b66dsi13086881pfb.66.2024.04.24.23.06.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 23:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Mixn5Q1O; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-158047-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158047-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 91A7AB22D9B for ; Thu, 25 Apr 2024 06:06:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 07CF13D541; Thu, 25 Apr 2024 06:06:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mixn5Q1O" Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B5F23A1AC; Thu, 25 Apr 2024 06:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714025183; cv=none; b=RXsFCUZJC6oz1p7CNWZ+KhjjStrQLYr4zdschUFXtK0gzyb3e0n2TJnu7b/IR36olxBeQw4yEMPG6R9p32DbqJhhja2EPrOgoqon0l4x9hhRuSsQ0ZRfjWZUU4EVvZQBZ89EGXkiyc6t6DKz9yUZJy/c+EUABIZMListtZC7cFU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714025183; c=relaxed/simple; bh=dvKTlg+kg92Mkx6G+gt4m/08khRB2H/WrYx/Ku1ZpbE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rHqFh3vhuus6sj3JsLVbthWygoIPh+nWJPY45h/hDR9KQkYNSgwRnilkmjjkroUCupct29SbTsgg5h8up+ILNAPPs7ar33L8YyRT6w7B692cFRbnME9zOBGqrNKYsI2AjsJbiDYdPUFC5OckQ+LM9652EsjsC2v2otqqLK60rA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mixn5Q1O; arc=none smtp.client-ip=209.85.219.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yb1-f169.google.com with SMTP id 3f1490d57ef6-db4364ecd6aso723735276.2; Wed, 24 Apr 2024 23:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714025180; x=1714629980; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Kdu2kkuJAVCmKf8384cv38eneufBKUPC8ObGdfPhtmQ=; b=Mixn5Q1OFXDc81vU1Qdk7R/RDlRfa2UKOxDOD7XfW5uvAxrahf6wGID1IzzdVPZp6L XglxnuhY5ChneLfq1LG4chcmKLwn/p88UytBylHPAj1XUmf/LemcsH0X5epYlU9xQl2c fuJA2aeoU98Ro2WcfcJr4mGGHSUYblr5xSx16+79DEurtuKPbAG2/i9jGDE1EmuMTxZ2 jkGynFnSxao8Dqg26mGdn92aXRB10EGBLD/DqK552YC3RLSVyWlyl2lmUVNBICYBGSq9 3IldWuDGHV3x8LKoJT6/8hZjp02k8tR9tHYPOl0WPHqSvq/jCZvLp3h5gjefQfN0AzPa +e9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714025180; x=1714629980; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kdu2kkuJAVCmKf8384cv38eneufBKUPC8ObGdfPhtmQ=; b=FhWMeyavrreRrhYlYmWI0NwdEqpq87TmboVnNaksegQ8HL5M8xg6oTuIi0Y74hORzC Hih/ZKxtczyrwGB4hfNlJlVQf1Z5V+AeJ49vh0fKuBaG3epPUwr28aQguYB2vb/Jfdzv 71Ki+N/g6XqICQSl9WGlhd9XUeuClkCzZ7N33CzUd/8U9wmw1tExz58yOL99yhYoMlsx 7kHOEvyxUqxTuEvgdodo9MBO1kCcdoZd5tnklufog/sZDipVcHuS8nI4Cx4emSjp3MGi AmR8ujx6GAOQGobwc25QJo5spDX+gNBGgGIvodWDl6tL4COiF+pIMXdpruuGrUQsIfXd EpxQ== X-Forwarded-Encrypted: i=1; AJvYcCV5aTSGdrrpCbzC7j3VOZHQziFjq/Ohgpn+vXhSGZ4xIQ0t+zoNcLN205ruwD+HxidSKIg6NV9HTPp9eI+rhQ92MOTKsinUo6noIpMC78WKhWPAik1sxi9apkjLj+ek4nvVO9ePXlRIkwzdrUIPYpI28rm+J2I509Ppa9BmLEW+vMzygOi29WfWG7I= X-Gm-Message-State: AOJu0YyWRIWUd3u2LxZ9odkbj6DiftUs5Knt5lxtfO2SfyUuvvlZCKH8 o0D2/tVts3agzgxt14T0Klvv0LZwNE0GtUjjL5UKaQ5rpCg2iRIFu0Cl+Lfyq4uWcQ5dIeql6C7 R/L/ffcmvC7K0ntznJtr9UK8Fj+E= X-Received: by 2002:a25:820a:0:b0:de4:70e2:16c with SMTP id q10-20020a25820a000000b00de470e2016cmr5037857ybk.14.1714025180256; Wed, 24 Apr 2024 23:06:20 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240403021808.309900-1-vinicius.gomes@intel.com> <87frvay47x.fsf@intel.com> In-Reply-To: <87frvay47x.fsf@intel.com> From: Amir Goldstein Date: Thu, 25 Apr 2024 09:06:08 +0300 Message-ID: Subject: Re: [PATCH v1 0/3] overlayfs: Optimize override/revert creds To: Vinicius Costa Gomes Cc: Miklos Szeredi , brauner@kernel.org, hu1.chen@intel.com, malini.bhandaru@intel.com, tim.c.chen@intel.com, mikko.ylinen@intel.com, lizhen.you@intel.com, linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 24, 2024 at 10:01=E2=80=AFPM Vinicius Costa Gomes wrote: > > Miklos Szeredi writes: > > > On Wed, 3 Apr 2024 at 04:18, Vinicius Costa Gomes > > wrote: > > > >> - in ovl_rename() I had to manually call the "light" the overrides, > >> both using the guard() macro or using the non-light version causes > >> the workload to crash the kernel. I still have to investigate why > >> this is happening. Hints are appreciated. > > > > Don't know. Well, there's nesting (in ovl_nlink_end()) but I don't > > see why that should be an issue. > > > > I see why Amir suggested moving away from scoped guards, but that also > > introduces the possibility of subtle bugs if we don't audit every one > > of those sites carefully... > > > > Maybe patchset should be restructured to first do the > > override_creds_light() conversion without guards, and then move over > > to guards. Or the other way round, I don't have a preference. But > > mixing these two independent changes doesn't sound like a great idea > > in any case. > > Sounds good. Here's I am thinking: > > patch 1: introduce *_creds_light() > patch 2: move backing-file.c to *_creds_light() > patch 3: move overlayfs to *_creds_light() > patch 4: introduce the guard helpers > patch 5: move backing-file.c to the guard helpers > patch 6: move overlayfs to the guard helpers > > (and yeah, the subject of the patches will be better than these ;-) > > Is this what you had in mind? > I think this series would make a lot of sense. It first addresses the issue that motivated your work and I expect patch 3 would be rather simple to review. Please use your best judgement to break patch 6 into more chewable pieces because the current ovl patch is quite large to review in one go. I will leave it up to you to find the right balance. Also w.r.t the guard() vs. scoped_guard() question, remember that there is another option that may be better than either in some cases - re-factoring to a helper with a guard(). One example that jumps to me is ovl_copyfile() - seems nicer to add a guard() in all the specific helpers then adding the scoped_guard() around the switch statement. But really this is a question of taste and avoiding unneeded code churn and unneeded nested scopes. There is no one clear way, so please use your judgement per case and we can debate on your choices in review. Thanks, Amir.