From patchwork Fri Jan 5 15:21:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13512250 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60AE2E823 for ; Fri, 5 Jan 2024 15:21:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="OTdPdfL4" Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 1A7503F186 for ; Fri, 5 Jan 2024 15:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1704468112; bh=va+R088LK5HPp976U93J7EMukikDVxpd8L8bbCz8s64=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OTdPdfL4vD88WxjnXOS8DD5iLwX3e7wWdtD9P7YoHSs1fdFhDNnavWmqVxPpN1WFY 1e/HX1qtjoL5zaazt2OVcRyNuv4zf326Jxt9x6h5h4laoPbsBsQsOjo6+tItU9efXr EZ30cCCUq2/QRcfzxnxQeuQCeBchjnGRv4e21dXc+e12Chv74bpRS6gJwUOkCptgkk doMjxd8YPN8X6ZPiAVKNqouxH7qOBvY/nS2hYODZJv5Kuny7x97FN0P58jNCkeO/7n Vgt1+r7cR3wPD1cpNSxNgp+JAkYMew5tPVUXJ8X42piKf2cq9CAmKZyyFqvK3zzHdk mteQyU0dq+yvg== Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-50eb710ee18so141659e87.2 for ; Fri, 05 Jan 2024 07:21:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704468111; x=1705072911; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=va+R088LK5HPp976U93J7EMukikDVxpd8L8bbCz8s64=; b=GYbP6GjTOKrF4No9SM3/gPFIwSw0PCqW2VKKjnBT5vTaL0AGhHgm1CHml2LzeOAO6o EGxxtdzbiloAiDTkv2BPtittgztfjkJKUQ3LgfgCI00BYZpByAZjz1wNq2pUJu/bRiTE /GQT0MJF39ZodvlAeCD4UQcYb2kskmkT5OLhAHjgpKgPsTRppOeDr1yj/yxlAhKZ5v7h S1rcAWghX+9sy94Yqd67NH2/OqO2VvypJ8EzT+JPWOibMil+FEecJ/M9TjqyIm8M/c2j O9KAIc7FGCmHSS5B7xvPyiDgyaVLoGGHIlWwgoLJawdDgpIgKnw0PhHqqjPqcEEH9EHj ZjUA== X-Gm-Message-State: AOJu0YxRXO9B+PoW30+bBeSa8mkGR1s5Q4RUyGIqSnc9huMCl+DhtE0a t3Kjx4iGZS8BBpPscUuVeqU95ZZcCX2sofmcWA/Kx67y7pht4YtS7HCOLtR1eMZCW8gtB4YA4dh GWgMMZJ6ND7o9aMMyaCzoz/Z7vBp0WAPT4smJGBrMGf8zUV6hZw== X-Received: by 2002:a05:6512:6c7:b0:50e:4375:712 with SMTP id u7-20020a05651206c700b0050e43750712mr1334023lff.16.1704468111590; Fri, 05 Jan 2024 07:21:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2/T4cw9Nt8HWcefUxCTnHCLrQ/5/WQYn6R+9zUBE3oW/gttm32aQ4NbV3GZMIq02etobbVg== X-Received: by 2002:a05:6512:6c7:b0:50e:4375:712 with SMTP id u7-20020a05651206c700b0050e43750712mr1334017lff.16.1704468111287; Fri, 05 Jan 2024 07:21:51 -0800 (PST) Received: from amikhalitsyn.lan ([91.64.72.41]) by smtp.gmail.com with ESMTPSA id i23-20020a170906115700b00a298adde5a1sm345630eja.189.2024.01.05.07.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 07:21:50 -0800 (PST) From: Alexander Mikhalitsyn To: mszeredi@redhat.com Cc: Alexander Mikhalitsyn , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/3] fuse: fix typo for fuse_permission comment Date: Fri, 5 Jan 2024 16:21:27 +0100 Message-Id: <20240105152129.196824-2-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> References: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Found by chance while working on support for idmapped mounts in fuse. Cc: Miklos Szeredi Cc: Cc: Signed-off-by: Alexander Mikhalitsyn --- fs/fuse/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index d19cbf34c634..6f5f9ff95380 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1485,7 +1485,7 @@ static int fuse_perm_getattr(struct inode *inode, int mask) * * 1) Local access checking ('default_permissions' mount option) based * on file mode. This is the plain old disk filesystem permission - * modell. + * model. * * 2) "Remote" access checking, where server is responsible for * checking permission in each inode operation. An exception to this From patchwork Fri Jan 5 15:21:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13512251 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B7122E84B for ; Fri, 5 Jan 2024 15:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="jeLTI0B/" Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id B2A7D3F2C4 for ; Fri, 5 Jan 2024 15:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1704468118; bh=lY3Wm0rqUAhsDJUxSGP7DuG2vuWegRTpE6t0VrqtHps=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jeLTI0B/iGD4kYv1X6OzcLyIqcUp9pAx63SDlbSVBTrPjzAMsGIMXLWcuk5rdBm81 XOmLAGFOynjdiHiWnc4yUjZsGXM5xsGwx+qhd6heNdbSlAiUO6ULewRMlwvcKd1MuJ gCkOMqg3pnnXgZrSA71kRR1um5A1qpJD8azBFvBGDKpnNx/6fBClFWSzlffVMeBiu7 gYG/OqLeEEmDZDx5L5DXMa2e+viiujjU/7296/n3KgKeCJ4NKj9Yfpog0HtU+6K6oY Lk3d8/8f0sQJtgeYlp1wqYVxCM+OOwK9++JWj+8uFFwcq1r6AfgEAum0M5QoJYUbyL 4sY7XEAIxvByw== Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a28f0137fd9so63761266b.2 for ; Fri, 05 Jan 2024 07:21:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704468116; x=1705072916; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lY3Wm0rqUAhsDJUxSGP7DuG2vuWegRTpE6t0VrqtHps=; b=bi0Ym1AjDgCoUrpG8D2XmZCZsVGCEpKcmuqMeXw/wlUs0kErYpLfABBUWmHCx2EnWv bpXyHY21/jrhcPKKxByEP1xDIleOUKgxey4P35HsHm4F3fKsRwz12u3j/dJWLzPQc3zv cdugT9Yo3V2bUEe/P+u+m7Cf9gdfdW4sfx5VM0hEb1QKNEbLG9YK/Kio8nmP4KACOGgM w9HbmiT+A2ahnEbhGTIrN19KH/sl3FKfxvLHdfFyFkNC4ybrDy7BuihhEgYfXjgOeirv EVyKQglBIg1WtSgDYZ8SPRcvrnFVq1tk6dLYJXBJTq9D2op1mkiBb/+uzDlxQJfwvhPO 0W5Q== X-Gm-Message-State: AOJu0YzDOKhVw+dFZwjZId5FsED0JSi0E3fvJTtBCIxoJs95ttczPr/w M9fi8U/FjsgDxBl0oFkEYIt58tHkrxtBE8EfB65rRM5pHLuCy4AC/GmseryeMfCZazK5LU7nEnr DTnuLpKf17XKZEckbsWYVC/4x/eQ2jr24Z3tqsUV/ABh2vyVGxAelrF7Slg== X-Received: by 2002:a17:906:270b:b0:a28:e451:b023 with SMTP id z11-20020a170906270b00b00a28e451b023mr1093667ejc.145.1704468116334; Fri, 05 Jan 2024 07:21:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQY4isbmkx0ezLO2LhTLTYXcX8Thqdvs1vKKmu4JjT/DRJLBcJ+3Na9NmK4+yNkl3jyGF0vg== X-Received: by 2002:a17:906:270b:b0:a28:e451:b023 with SMTP id z11-20020a170906270b00b00a28e451b023mr1093664ejc.145.1704468116100; Fri, 05 Jan 2024 07:21:56 -0800 (PST) Received: from amikhalitsyn.lan ([91.64.72.41]) by smtp.gmail.com with ESMTPSA id i23-20020a170906115700b00a298adde5a1sm345630eja.189.2024.01.05.07.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 07:21:55 -0800 (PST) From: Alexander Mikhalitsyn To: mszeredi@redhat.com Cc: Alexander Mikhalitsyn , Miklos Szeredi , Amir Goldstein , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/3] fuse: use GFP_KERNEL_ACCOUNT for allocations in fuse_dev_alloc Date: Fri, 5 Jan 2024 16:21:28 +0100 Message-Id: <20240105152129.196824-3-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> References: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 fuse_dev_alloc() is called from the process context and it makes sense to properly account allocated memory to the kmemcg as these allocations are for long living objects. Cc: Miklos Szeredi Cc: Amir Goldstein Cc: Cc: Signed-off-by: Alexander Mikhalitsyn --- fs/fuse/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 2a6d44f91729..b8636b5e79dc 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1415,11 +1415,11 @@ struct fuse_dev *fuse_dev_alloc(void) struct fuse_dev *fud; struct list_head *pq; - fud = kzalloc(sizeof(struct fuse_dev), GFP_KERNEL); + fud = kzalloc(sizeof(struct fuse_dev), GFP_KERNEL_ACCOUNT); if (!fud) return NULL; - pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL); + pq = kcalloc(FUSE_PQ_HASH_SIZE, sizeof(struct list_head), GFP_KERNEL_ACCOUNT); if (!pq) { kfree(fud); return NULL; From patchwork Fri Jan 5 15:21:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksandr Mikhalitsyn X-Patchwork-Id: 13512252 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AD6F31739 for ; Fri, 5 Jan 2024 15:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=canonical.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=canonical.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=canonical.com header.i=@canonical.com header.b="rwPkPCBi" Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id DC8743F2D2 for ; Fri, 5 Jan 2024 15:22:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1704468120; bh=3ehRu/Zuzjv9SF1nMloRA0oZhzJAyfoaCoaYcJRfDMg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rwPkPCBiHVlCldgv1sD58NcKh6RZeUqv43gVGNFpIrNa5xhPBiV3B54lXJMaZlnzY HAudK6cegJ49sxWgtlXKY/Ln+Ht+pmtaB3C2dXn4xqwqCa0Gk51j5ioHbcYzOIufrZ s5lUzk4QCqTTv02CjFNJdyrpgwvFHmVSRSAB5NPfhfHjnl5iLVUEaofKfMn0dgPRq4 3MRr5lniVgIFsCQmXuz/NwAX1N1IOG6wzLD4WGcFeL+WwHiHJ1Ws2heHfx+GyLyVzO dZLT9yePaQxNODjaXtb/VVrg5uCB5cIZX/St1u4bLS/tgWrpv0UgIvYZ25Qp6a3OsU uGlfjEVTvx5Wg== Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a19c5cbbe86so93139866b.1 for ; Fri, 05 Jan 2024 07:22:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704468120; x=1705072920; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ehRu/Zuzjv9SF1nMloRA0oZhzJAyfoaCoaYcJRfDMg=; b=ESokJtBv5P2QhigisNfYXyqVeTYB86QhB/RvPyLVUFTmwHFKLyakD1GfJOOPOABxrS 3TJvtv8v5s8hpgxik1xwBb4KMAhoJvZzZ3a239jsyCSDW1XpIIfS0gUpOkizoVV+cAdz Is+LPAwIpwQqFppkQ3MM2Hm/4noyIIekSrKxG4hrJ1QwrMlbFWE7JCTOqxaIuPm9h15O 1uFq2df5Yv44VBg7tticzd8Hgi4+qRrV6+hNFITxF1iiRtpvt9B3VI7GGCVVZwEKWXPp J1ZcQPQ6La1ofYDZIa33gizPPkILOkFcxoO20+8c6SQOHV80dl8oanf3IWC35ZfYW2Vh TynA== X-Gm-Message-State: AOJu0YzhmcijqjdQAXOEUoA8gvV91WtT/OC/C5DpTNnjUoVGb8wAHo1k erHTfcIS3nlBVIU2+f1uVEUrABMFN2DjpNnSD5pzLsNwC+PCE/BozoWiFDROvX7uUkaBkzPhQwI Mjt8d/aLIKUQjBS8xHa16hXaWl7n+o6fxvqKZxN2sfudhe6x0jA== X-Received: by 2002:a17:906:e0d8:b0:a27:6e73:a248 with SMTP id gl24-20020a170906e0d800b00a276e73a248mr773798ejb.68.1704468120504; Fri, 05 Jan 2024 07:22:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1Qf95Xc1DtQrvYbmkcZs/ajyvnuK5OKpFVhctUoOgo9efyvmBIthHb9SYj+TsVGtv7sYLnA== X-Received: by 2002:a17:906:e0d8:b0:a27:6e73:a248 with SMTP id gl24-20020a170906e0d800b00a276e73a248mr773791ejb.68.1704468120298; Fri, 05 Jan 2024 07:22:00 -0800 (PST) Received: from amikhalitsyn.lan ([91.64.72.41]) by smtp.gmail.com with ESMTPSA id i23-20020a170906115700b00a298adde5a1sm345630eja.189.2024.01.05.07.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 07:21:59 -0800 (PST) From: Alexander Mikhalitsyn To: mszeredi@redhat.com Cc: Alexander Mikhalitsyn , Christian Brauner , Miklos Szeredi , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/3] fuse: __kuid_val/__kgid_val helpers in fuse_fill_attr_from_inode() Date: Fri, 5 Jan 2024 16:21:29 +0100 Message-Id: <20240105152129.196824-4-aleksandr.mikhalitsyn@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> References: <20240105152129.196824-1-aleksandr.mikhalitsyn@canonical.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 For the sake of consistency, let's use these helpers to extract {u,g}id_t values from k{u,g}id_t ones. There are no functional changes, just to make code cleaner. Cc: Christian Brauner Cc: Miklos Szeredi Cc: Cc: Signed-off-by: Alexander Mikhalitsyn Reviewed-by: Christian Brauner --- fs/fuse/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index b8636b5e79dc..ab824a8908b7 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1489,8 +1489,8 @@ static void fuse_fill_attr_from_inode(struct fuse_attr *attr, .ctimensec = ctime.tv_nsec, .mode = fi->inode.i_mode, .nlink = fi->inode.i_nlink, - .uid = fi->inode.i_uid.val, - .gid = fi->inode.i_gid.val, + .uid = __kuid_val(fi->inode.i_uid), + .gid = __kgid_val(fi->inode.i_gid), .rdev = fi->inode.i_rdev, .blksize = 1u << fi->inode.i_blkbits, };