Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1121932rwd; Tue, 16 May 2023 12:07:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6e3OXly3lA92lJ+ITW/amHR2DAQ8l3n4xDA9Zm5fFREjqoBoD3grgx5FcODaBswhw50lII X-Received: by 2002:a17:90b:1810:b0:250:981f:365a with SMTP id lw16-20020a17090b181000b00250981f365amr28749035pjb.23.1684264042835; Tue, 16 May 2023 12:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684264042; cv=none; d=google.com; s=arc-20160816; b=B3UA3Q/lNxFE3jFnyDd6LgmfI7WHVnGC6OSy0mVx8BNls0DCPAcK5uZeZ0MDu/0wJp cIvOjBzIY64c53rl3DdYKSAPiLC0VbgZBu5SGoYlwJ4FuPSDuP0LfZH2isiO58x6Selx USEqBL3Ra5MEhsOGidR2Vm5wfkdNhGx8kXa/pJMi/9Jl4Z09hpc0xCij54d2M33u0FIV xXOkoHwJX5u3JlAMgMfzcbGtxWQZz8ISdkKVIe6xL3GnsgAGZSjFQnH3RcmRiFkpRQ/o cibHogs3OeLU+q0gI3Onp+TF5MlgEqmMyqFvu2xtRTgH07qM4+bNbZqB5I7Sfre1DFId ND+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=R5qqL0tI2dOiejDyZ7VOmiOl9EqxMnzWMLa7+ZUk7zQ=; b=WxO9lOHHH2cZK3tEYeIOj7Vih1ZWOHEKLrqjb+cal61qK4uF19qDOqzkdoUul+rdL3 zeHkiNbJY0c+abQDGPoj2IWdV+PUXiqSxCJIlHLyvurKW0zKs+fJzxs6C5h0zcPk5Qlz vJX5fYfQu/kMkan/UcRstVUKpWz9F8FZlDds7/aqrs2YqfFSt3yAvsjw02+5cFXTXliy xpEoF9j6PuAmmvg4vXnFe7sU09fbtK5tPrzy4nAKmq8/2QEY5fhpjOZ1n5N+TvAZg/XC FXTNeq40v1IVfHfjJkF1rqtQNkbIWj8ARxFYIH3rTQcxSMyoEWOfmnLDW02YqTahFVhQ KU/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OQx6RZCS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y17-20020a63b511000000b005031abe8d8bsi12605919pge.745.2023.05.16.12.07.07; Tue, 16 May 2023 12:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=OQx6RZCS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230269AbjEPSzb (ORCPT + 99 others); Tue, 16 May 2023 14:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbjEPSz2 (ORCPT ); Tue, 16 May 2023 14:55:28 -0400 Received: from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com [IPv6:2607:f8b0:4864:20::92e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CD0AD01; Tue, 16 May 2023 11:55:23 -0700 (PDT) Received: by mail-ua1-x92e.google.com with SMTP id a1e0cc1a2514c-7835b0bd5c8so7184241.0; Tue, 16 May 2023 11:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684263322; x=1686855322; 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=R5qqL0tI2dOiejDyZ7VOmiOl9EqxMnzWMLa7+ZUk7zQ=; b=OQx6RZCSTh4bwlJyOUTd4kkGy68lRBiDUlsumPXl7jiqWr18N0lu2RexJX51DWX9R5 MqEgxeSx1Z7oq00GP6F+Jl+Z+hVK++nbaAS5BRnr9bdK2iohj3jrv/QEUnZvEG1/pZZW fBQVra50SWImHr7Zz5CIufqXH4s/zoj9T2hx7xLrwrHKphjA3n7PpeL68eA+wQL0S3LX D6o7OfkAjPJB6QF6DBrvoKTKUaVvgY35qx3LXvwJMe8DcjZLHQBSmgOK2x8FLLA8uGPE VcNEGLRaLcckHtH0WZyIWsJSbwkGGCSs9Ucxddz20EVZCZuAS6BcRXjRm10fwi/MpusY v6Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684263322; x=1686855322; 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=R5qqL0tI2dOiejDyZ7VOmiOl9EqxMnzWMLa7+ZUk7zQ=; b=VTxcUZ09fBpFJQR9Gotkh/LT13WyhnXA4CoylqdkbslIb2IXlqe+EvXkJ4afe+yiLY YwGKK+MA1/W4wiw2lGo0IaicNh18MeCup6i8mUsRwFICa4KMJdKeA8mdy4fNPx35SCgQ 51miCGr6ifWOi3oIQ3H6A/TyWc6Etp3Bwb14tveDtDKn32V4O/VUwyk8I0IY6kP6MEyK 0CxgFLEaImR0SZ/23JnzSc/r0fZJoCq6z+UbjReYSC0VFKVBBHVoPBBZhad7SsHv8t9o QkvlE7rnP65XLuuus2b30S6aOKVnI28g0L0Tdgl8GbqR0OUNPnZtEvtQDg8288x4NvwC iEfQ== X-Gm-Message-State: AC+VfDxGoETPZC8VIvnZtUgSpBOf4/SpYLnus7Cv/TqGDF7aerJbpyDt 4v1xE14UYXsmslZeItBOEgwieiWJKiCV7ywQdte31ZoyN9E= X-Received: by 2002:a05:6102:3a56:b0:42f:e9be:5921 with SMTP id c22-20020a0561023a5600b0042fe9be5921mr15386001vsu.12.1684263322056; Tue, 16 May 2023 11:55:22 -0700 (PDT) MIME-Version: 1.0 References: <20230516141619.2160800-1-chengzhihao1@huawei.com> <20230516141619.2160800-2-chengzhihao1@huawei.com> In-Reply-To: <20230516141619.2160800-2-chengzhihao1@huawei.com> From: Amir Goldstein Date: Tue, 16 May 2023 21:55:10 +0300 Message-ID: Subject: Re: [PATCH v3 1/3] ovl: Let helper ovl_i_path_real() return the realinode To: Zhihao Cheng Cc: miklos@szeredi.hu, brauner@kernel.org, linux-unionfs@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 16, 2023 at 5:19=E2=80=AFPM Zhihao Cheng wrote: > > Let helper ovl_i_path_real() return the realinode to prepare for > checking non-null realinode in rcu walking path. > > Signed-off-by: Zhihao Cheng Reviewed-by: Amir Goldstein > --- > fs/overlayfs/overlayfs.h | 2 +- > fs/overlayfs/util.c | 7 ++++--- > 2 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h > index 4d0b278f5630..7398de332527 100644 > --- a/fs/overlayfs/overlayfs.h > +++ b/fs/overlayfs/overlayfs.h > @@ -382,7 +382,7 @@ enum ovl_path_type ovl_path_type(struct dentry *dentr= y); > void ovl_path_upper(struct dentry *dentry, struct path *path); > void ovl_path_lower(struct dentry *dentry, struct path *path); > void ovl_path_lowerdata(struct dentry *dentry, struct path *path); > -void ovl_i_path_real(struct inode *inode, struct path *path); > +struct inode *ovl_i_path_real(struct inode *inode, struct path *path); > enum ovl_path_type ovl_path_real(struct dentry *dentry, struct path *pat= h); > enum ovl_path_type ovl_path_realdata(struct dentry *dentry, struct path = *path); > struct dentry *ovl_dentry_upper(struct dentry *dentry); > diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c > index 923d66d131c1..00d31e38b57d 100644 > --- a/fs/overlayfs/util.c > +++ b/fs/overlayfs/util.c > @@ -250,7 +250,7 @@ struct dentry *ovl_i_dentry_upper(struct inode *inode= ) > return ovl_upperdentry_dereference(OVL_I(inode)); > } > > -void ovl_i_path_real(struct inode *inode, struct path *path) > +struct inode *ovl_i_path_real(struct inode *inode, struct path *path) > { > path->dentry =3D ovl_i_dentry_upper(inode); > if (!path->dentry) { > @@ -259,6 +259,8 @@ void ovl_i_path_real(struct inode *inode, struct path= *path) > } else { > path->mnt =3D ovl_upper_mnt(OVL_FS(inode->i_sb)); > } > + > + return path->dentry ? d_inode(path->dentry) : NULL; > } > > struct inode *ovl_inode_upper(struct inode *inode) > @@ -1105,8 +1107,7 @@ void ovl_copyattr(struct inode *inode) > vfsuid_t vfsuid; > vfsgid_t vfsgid; > > - ovl_i_path_real(inode, &realpath); > - realinode =3D d_inode(realpath.dentry); > + realinode =3D ovl_i_path_real(inode, &realpath); > real_idmap =3D mnt_idmap(realpath.mnt); > > vfsuid =3D i_uid_into_vfsuid(real_idmap, realinode); > -- > 2.39.2 >