From patchwork Thu Oct 14 13:51:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1540939 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=QSUeVU1k; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HVW6l3wf6z9sPB for ; Fri, 15 Oct 2021 00:52:15 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mb19V-0004sK-CZ; Thu, 14 Oct 2021 13:52:09 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mb19U-0004rP-8Y for kernel-team@lists.ubuntu.com; Thu, 14 Oct 2021 13:52:08 +0000 Received: from mussarela.. (unknown [177.9.89.30]) (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-canonical-1.canonical.com (Postfix) with ESMTPSA id 6C8EA3FFE6 for ; Thu, 14 Oct 2021 13:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634219528; bh=cOgaC2uPnEigU6riqdAYYKuSq8Jet0oExOW1BNiOb1w=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QSUeVU1kMhR+963GyM9eCzPgoPlx2AXCgDgUw5tyhWQZ7fdaHyZs2CitkGDKWlwRj h/VNrr2pbvTeZnywvC3YMOekQxZXif0PyrAFbOVUNvsClKkauYj8niwvZr3i1fSzdH vtwGKnYMluAkIYbDCjnpeIo/Q5JVbNjQgGNAJH2KvAN1BfvOXe99XwXUjBfqdhDEuo kxNM95oNwuxvaOvdxuvh2/x97A9AYJ82IDX07zAOred3r7jDfLPA2sG6cCsPKMUpy9 6a9JEMyeGaImt+uKMhwU0enV5ZwTO5h92YQuIZ6wCZnOzok2GIe34Pi/FWuKvjuzyo 92pToYwBmzE6g== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU Bionic/Focal 1/2] ocfs2: fix remounting needed after setfacl command Date: Thu, 14 Oct 2021 10:51:58 -0300 Message-Id: <20211014135159.45981-2-cascardo@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211014135159.45981-1-cascardo@canonical.com> References: <20211014135159.45981-1-cascardo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Gang He https://bugs.launchpad.net/bugs/1947161 When use setfacl command to change a file's acl, the user cannot get the latest acl information from the file via getfacl command, until remounting the file system. e.g. setfacl -m u:ivan:rw /ocfs2/ivan getfacl /ocfs2/ivan getfacl: Removing leading '/' from absolute path names file: ocfs2/ivan owner: root group: root user::rw- group::r-- mask::r-- other::r-- The latest acl record("u:ivan:rw") cannot be returned via getfacl command until remounting. Signed-off-by: Gang He Signed-off-by: Andrew Morton Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Jun Piao Link: http://lkml.kernel.org/r/20200717023751.9922-1-ghe@suse.com Signed-off-by: Linus Torvalds (cherry picked from commit 504ec37dfdfbf9c65166c51f7b12126d2a9b18dc) Signed-off-by: Thadeu Lima de Souza Cascardo --- fs/ocfs2/acl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index bb981ec76456..7b07f5df3a29 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c @@ -256,6 +256,8 @@ static int ocfs2_set_acl(handle_t *handle, ret = ocfs2_xattr_set(inode, name_index, "", value, size, 0); kfree(value); + if (!ret) + set_cached_acl(inode, type, acl); return ret; } From patchwork Thu Oct 14 13:51:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1540940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=tALI9ufU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HVW6n2RGGz9sNH for ; Fri, 15 Oct 2021 00:52:17 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mb19X-0004tO-Iv; Thu, 14 Oct 2021 13:52:11 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mb19V-0004sJ-Dd for kernel-team@lists.ubuntu.com; Thu, 14 Oct 2021 13:52:09 +0000 Received: from mussarela.. (unknown [177.9.89.30]) (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-canonical-1.canonical.com (Postfix) with ESMTPSA id 98D4E3FFE6 for ; Thu, 14 Oct 2021 13:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634219529; bh=BPz4ZWOd37uyL71zXRDdnEd1XX/GhSr+XjDjlMxrI9g=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tALI9ufUj/1UKaAEg783af7FOvGluvRC5uqWEDXyU9bxp/IV6ueHKYcf4da2O2PT2 uhhzQwwTQCuDZJyqQhvHBS1NL86xFq4iSk7okVCtDzynl3xyP/mUOBZwQzaqFQb53Q eJRy6+rY0iItHNdfuAtR/MdYOxHVKDGtAojPXWVKzhx9C95lzkWcQCxB6L20qtHEhx 5OM5YKCJjjmg4XQkCpODEgRmhuwrfZBa2g8hBNJIHmLKtuTAr3DFxEFnq4Jhp59/ch /y+nG8sMMjNk1pIfq2Ko1tnmSsMqcgVpVjS2QNFrny3R+LiT4s3Atq2BjiGupFKsh5 WTj9dRdR6S/2A== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU Bionic/Focal/Hirsute/Impish 2/2] ocfs2: drop acl cache for directories too Date: Thu, 14 Oct 2021 10:51:59 -0300 Message-Id: <20211014135159.45981-3-cascardo@canonical.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211014135159.45981-1-cascardo@canonical.com> References: <20211014135159.45981-1-cascardo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Wengang Wang https://bugs.launchpad.net/bugs/1947161 ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale. The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case: Node 1 Node 2 -------------- ---------------- getfacl dir1 getfacl dir1 <-- this is OK setfacl -m u:user1:rwX dir1 getfacl dir1 <-- see the change for user1 getfacl dir1 <-- can't see change for user1 Link: https://lkml.kernel.org/r/20210903012631.6099-1-wen.gang.wang@oracle.com Signed-off-by: Wengang Wang Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds (cherry picked from commit 9c0f0a03e386f4e1df33db676401547e1b7800c6) Signed-off-by: Thadeu Lima de Souza Cascardo --- fs/ocfs2/dlmglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 50a863fc1779..207ec61569ea 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c @@ -3933,7 +3933,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, oi = OCFS2_I(inode); oi->ip_dir_lock_gen++; mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); - goto out; + goto out_forget; } if (!S_ISREG(inode->i_mode)) @@ -3964,6 +3964,7 @@ static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, filemap_fdatawait(mapping); } +out_forget: forget_all_cached_acls(inode); out: