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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D3B6C54EE9 for ; Thu, 8 Sep 2022 19:11:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229583AbiIHTLb (ORCPT ); Thu, 8 Sep 2022 15:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbiIHTLa (ORCPT ); Thu, 8 Sep 2022 15:11:30 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C8D7EC774 for ; Thu, 8 Sep 2022 12:11:29 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id g14so13652070qto.11 for ; Thu, 08 Sep 2022 12:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=QxnqVlxqtGJodT6yFH282ylz03SCDVQmV4f2aqWswBs=; b=iaM966+K2AFLebQEoWflFeq0FVhzIHaMUoxYUYHlqMGG5AjSSTJGD+Tf01p9y1Qtjh UcrODHgeJnXnZ5VXaDJJTfIw+rYD5QP87z0hqdewk3+2f/m8vF/y2vZ/Lj1rkVGq9+xl f+7M5KpCJpBIIhXQoskioj828MpgBJeLFFl/bBSByv/b18WolFMQ4KFUO3O0q8JRzkmx nK27R9JhxZaTckQKV/hYmNxokEyh+j8mnU3XUtlPLjDzICD0mDfc9pYf0AGxwutmoml5 KyFzS8CMd18BOxUH/GV0neqgN65o4b4d7FwKO9wOSuQJL3pOctvjouZN3JvHpGavrCtc aUkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=QxnqVlxqtGJodT6yFH282ylz03SCDVQmV4f2aqWswBs=; b=U10E26dw2dJLQ3MDS/B4xSN2HIx+tnF3J68nsUrL8sLLcDNwj2YrYjqy9JL0Doniqg A8fDsq3YcOHRBj2k1gBk1vnV0RxHkG46tAKCcnzWsNzjToQBFyTQkgQc3IspmhgGOv7N X2CtjnZJsNCgei1foPOwSdmeEWbxjqlgPBO+moGLPD5Nsg48S6/I9cf/9K9/lCN4BZVl 7c+y791lvEoAHq4BYRhzv4QS4uC3OIsNM/A52VdR5BPMUPt1Actd9lsHibHFLdx9RTCP z5Sym7J35OoeoTkowzin0Y5LOAEygkdzaKQ6zdfo7yW6Nl/x7lil0KoOI+FFE8sVA2+m pM3w== X-Gm-Message-State: ACgBeo0pbD6LGgpKkx1CzqPprin1wZrofS3vJDAQ8RAaqO2gYxQouVFx Hr9N+7ajBTsiXU3dgFrj8Zlzj5B/Y/9qxg== X-Google-Smtp-Source: AA6agR4GRV5QPPxgnt4eklLf9Zny+qDIXVz8kePOcaNKujGSRdlikEiuLKCynGR5vgmi6ysjht6FUA== X-Received: by 2002:a05:622a:1aa2:b0:344:5ffd:3190 with SMTP id s34-20020a05622a1aa200b003445ffd3190mr9618088qtc.80.1662664288195; Thu, 08 Sep 2022 12:11:28 -0700 (PDT) Received: from localhost (cpe-174-109-172-136.nc.res.rr.com. [174.109.172.136]) by smtp.gmail.com with ESMTPSA id z7-20020ac86b87000000b0034035e73be0sm15055732qts.4.2022.09.08.12.11.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:11:27 -0700 (PDT) Date: Thu, 8 Sep 2022 15:11:26 -0400 From: Josef Bacik To: Sweet Tea Dorminy Cc: "Theodore Y. Ts'o" , Jaegeuk Kim , Eric Biggers , Chris Mason , David Sterba , linux-fscrypt@vger.kernel.org, linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH v2 09/20] btrfs: setup fscrypt_names from dentrys using helper Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Mon, Sep 05, 2022 at 08:35:24PM -0400, Sweet Tea Dorminy wrote: > Most places that we create fscrypt_names, we are doing so from a dentry. > Fscrypt provides a helper for this common pattern: > fscrypt_setup_filename() initializes a filename to search for from a > dentry, performing encryption of the plaintext if it can and should be > done. This converts each setup of a fscrypt_name from a dentry to use > this helper; at present, since there are no encrypted directories, > nothing goes down the filename encryption paths. > > Signed-off-by: Sweet Tea Dorminy > diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c > index 40cfaa9feff3..53195cfe6a3d 100644 > --- a/fs/btrfs/tree-log.c > +++ b/fs/btrfs/tree-log.c > @@ -7443,13 +7443,13 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans, > if (old_dir && old_dir->logged_trans == trans->transid) { > struct btrfs_root *log = old_dir->root->log_root; > struct btrfs_path *path; > - struct fscrypt_name fname = { > - .disk_name = FSTR_INIT((char *) old_dentry->d_name.name, > - old_dentry->d_name.len) > - }; > - > + struct fscrypt_name fname; > ASSERT(old_dir_index >= BTRFS_DIR_START_INDEX); > > + ret = fscrypt_setup_filename(&old_dir->vfs_inode, > + &old_dentry->d_name, 0, &fname); > + if (ret) > + goto out; > /* > * We have two inodes to update in the log, the old directory and > * the inode that got renamed, so we must pin the log to prevent > @@ -7469,6 +7469,7 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans, There's another error case just above this that you missed. Thanks, Josef