Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp442169ybr; Fri, 22 May 2020 10:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxocFozkXOMFgtOyfGhTUEnOzqvw2f6rvZleM7HA9gS2MRd6orQSnjfx6lvruyXj8qGzJWJ X-Received: by 2002:a17:906:4406:: with SMTP id x6mr9056503ejo.160.1590167502460; Fri, 22 May 2020 10:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590167502; cv=none; d=google.com; s=arc-20160816; b=0HQLzJSV8cXn4oRyPoRq0xlgfoApgq6f+OvCVEC2F9Cg0+LZMNj/SyGnBmsJmFVRDs Lt5gRHONnaVcnla7YkWPmfsuV0U6JptW3yz0vFe+nVOKmGkuxY2KaVwlhkpM1gtiBqPc J7scOfMR52XUXCZy3aEV8wCTF8Lm/kSL4mtMVT96uxe9kWer53/cRaJTvIjFwCam9m7T cDjppK0MSmBXvS3glZ7PDVuPfDMvSAxhdHHyhKJkiS4b6hDXGfZ53I7lW0gF6m+Xa22u r7acskRAe1TuQKG1o6YBd+vjBO20F45OTwR9CdzcYLHtvcXB26QfjSEOMWmjjEBta5Be JsRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=5oEjRlutZgesjZsBZiS7Pr4cJPVCPyetipAJ+rscTg4=; b=z/V0Wn5bW59yobL5CujOGpSAz1ORX7dAyaEt3F6HBKOVl+7abBWVnbt54NqyyGWhBZ GvTDqgwQ88iPN4nmGdvrNIk9hapUmyuyDK3R2ncznDw5EPpI9r3/yiSTSHWCZp7FYasI B9VOrvqIVGNs+NTz4WP9S70t+250o3xOW8sWeB+SQtQzDubtImxWz5wPOgONVi/1jKYC H0fIsifXalRz2eC+hw9mtQEIBn/UO1p6dYxZkJpPSZ9L6ugl5ipU5DqUvMFbWHMf9u/o PBaI2p/j/ySH8yEaMbMehfC1YQnD+5gRnrjNPaDwuf9ZujSmDvWIKfK4J0Oh5xL6jZBE chrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="n98JT5//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z7si5135796ejf.749.2020.05.22.10.10.52; Fri, 22 May 2020 10:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="n98JT5//"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730742AbgEVRCw (ORCPT + 99 others); Fri, 22 May 2020 13:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730665AbgEVRCv (ORCPT ); Fri, 22 May 2020 13:02:51 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52D6EC061A0E; Fri, 22 May 2020 10:02:50 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id q8so10686373iow.7; Fri, 22 May 2020 10:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5oEjRlutZgesjZsBZiS7Pr4cJPVCPyetipAJ+rscTg4=; b=n98JT5//RP8Wvyu9VLvSNejJOq74cqmdRu2GtXGCOZw+Jr0LyauRuu5OQV6CGUdNNi 2DP0kjZCfNmTSf0pVZX1WCu5QIeTytgjkIZV3zJBapZCr5koWfmnPKoS+OH+nxl+Wp4t dxXL18qA4DRC+/9/9hKNPyzbz0syZ/eNn5KLQwLs3qAOE9rGdHNohtNLzMtO8L5WTWSJ kz8/scjklAb/6U91mL6ktfl3bgFvznonDRAem3LXoeZhLJq0Rc1XXL5aJVe05DghWd2+ 3YMOMX7RtUB9cp02VYmWO7ju0Z1h8aUJpEco4aOOCyXyjKmudu6sDy8vW1AKZlnScn4q 4/AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5oEjRlutZgesjZsBZiS7Pr4cJPVCPyetipAJ+rscTg4=; b=IS2Yrb4rFMGQGlbX7/EdAX9K7/DX8OASwdA1V+v/rYH0QLKOXeO4KuVMeQE9N/com5 yGnrVjFXFTS/nSsDvZhObnpnVM3VxJBs7ITEN8X0jJBWR5932FowetcxTYWgu0mSqK2a YVUzEBGdy+8E2EN/LTHojjCK/uBvjnNSZABpkzPtFS1tgLEyk+DbwSOQtzHL5AVatGwH Ufk56jx1gSGQe5Vosi0f+wP8klN8FWLyb2+HGF8voBL+5Pr68x03xMJwlj07iN5OOEXe sZAk3ncp1jvgR3rsmc5B0o2GZBffCM2kbdXhid4uGsw5SFsI+D9rhFEP8XFT4LBcwhk1 NUtw== X-Gm-Message-State: AOAM532d7I2vRWnws7XtEA9P1O9NLok+CH3TQEquy0m8ZRzLLWlPcQ8w t7NmcqHwjPXf15ve9Ct91xpdcioNDJaqgKMxZ4xxClre X-Received: by 2002:a5e:840d:: with SMTP id h13mr3873782ioj.64.1590166969578; Fri, 22 May 2020 10:02:49 -0700 (PDT) MIME-Version: 1.0 References: <20200522085723.29007-1-mszeredi@redhat.com> <20200522160815.GT23230@ZenIV.linux.org.uk> In-Reply-To: From: Amir Goldstein Date: Fri, 22 May 2020 20:02:37 +0300 Message-ID: Subject: Re: [PATCH] ovl: make private mounts longterm To: Miklos Szeredi Cc: Al Viro , overlayfs , linux-fsdevel , lkml Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > - mntput(ofs->upper_mnt); > > > - for (i = 1; i < ofs->numlayer; i++) { > > > - iput(ofs->layers[i].trap); > > > - mntput(ofs->layers[i].mnt); > > > + > > > + if (!ofs->layers) { > > > + /* Deal with partial setup */ > > > + kern_unmount(ofs->upper_mnt); > > > + } else { > > > + /* Hack! Reuse ofs->layers as a mounts array */ > > > + struct vfsmount **mounts = (struct vfsmount **) ofs->layers; > > > + > > > + for (i = 0; i < ofs->numlayer; i++) { > > > + iput(ofs->layers[i].trap); > > > + mounts[i] = ofs->layers[i].mnt; > > > + } > > > + kern_unmount_many(mounts, ofs->numlayer); > > > + kfree(ofs->layers); > > > > That's _way_ too subtle. AFAICS, you rely upon ->upper_mnt == ->layers[0].mnt, > > ->layers[0].trap == NULL, without even mentioning that. And the hack you do > > mention... Yecchhh... How many layers are possible, again? > > 500, mounts array would fit inside a page and a page can be allocated > with __GFP_NOFAIL. But why bother? It's not all that bad, is it? FWIW, it seems fine to me. We can transfer the reference from upperdir_trap to layers[0].trap when initializing layers[0] for the sake of clarity. Thanks, Amir.