From patchwork Tue Oct 6 14:55:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 11818821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 899A8112E for ; Tue, 6 Oct 2020 14:55:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67F41207EA for ; Tue, 6 Oct 2020 14:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996133; bh=W+WRJiA5Dyo40yCBkIH+gN+ujGTSXHZQ4oEjCxbLe9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Owe7qZoqWhJ893YMg5YKjL2Isv+9FMA2wHrSNT2CODLaXaLj21rs1JU6dGg3QOUqt Bpj1lAMYLqZtzeabiNFIHwJfLHurJ0GSFcQhgqe8VRTh7TwhvTBKTi903JqR54he74 Sqe+mrQuOWiPumbW+fgIXGo3DunPULf/tSBHql3I= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbgJFOzc (ORCPT ); Tue, 6 Oct 2020 10:55:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:38186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgJFOzb (ORCPT ); Tue, 6 Oct 2020 10:55:31 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3BE35206DD; Tue, 6 Oct 2020 14:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996130; bh=W+WRJiA5Dyo40yCBkIH+gN+ujGTSXHZQ4oEjCxbLe9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E6z8sjHtJg5Iv8q5OQ8FstPSCrNnbqHo6UPwlT8Ytj5k5VTJ+adR5p4SPEDX1C5wr +LcMZ23XgaOFUeAKnWUov/NmUR3ZqIFY1iL95/Pj0Lv+aVexrm/RPZD+pCmtou7EOD 0M/83kS9s8y3/VcVnKzmDiTXiK7owlVfX75t4EIM= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v3 1/5] ceph: don't WARN when removing caps due to blocklisting Date: Tue, 6 Oct 2020 10:55:22 -0400 Message-Id: <20201006145526.313151-2-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201006145526.313151-1-jlayton@kernel.org> References: <20201006145526.313151-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org We expect to remove dirty caps when the client is blocklisted. Don't throw a warning in that case. Signed-off-by: Jeff Layton --- fs/ceph/caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index c7e69547628e..2ee3f316afcf 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1149,7 +1149,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release) /* remove from inode's cap rbtree, and clear auth cap */ rb_erase(&cap->ci_node, &ci->i_caps); if (ci->i_auth_cap == cap) { - WARN_ON_ONCE(!list_empty(&ci->i_dirty_item)); + WARN_ON_ONCE(!list_empty(&ci->i_dirty_item) && !mdsc->fsc->blocklisted); ci->i_auth_cap = NULL; } From patchwork Tue Oct 6 14:55:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 11818831 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 52141112E for ; Tue, 6 Oct 2020 14:55:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34DE3206CB for ; Tue, 6 Oct 2020 14:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996138; bh=gF3voaBm2copooG2glx9EOo01/CXMpMjhX84fpOBpdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=j+RSsyulh7GHbzA9s9kqfsywcFxX472B8K2ruDD0S75JPkHFT3NAtFVVk8g73p9Yt NoV+OVO57PsEwh3VP1t0wCBp/15eKn3I+TSz6hppnVIbc5Tr2Ow7b6p0C6WM2R4mH3 jeyStoXMudH4NySTBCf0edd6/1llcYjQ6vrc6/oE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726398AbgJFOzh (ORCPT ); Tue, 6 Oct 2020 10:55:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:38200 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbgJFOzc (ORCPT ); Tue, 6 Oct 2020 10:55:32 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F405A20782; Tue, 6 Oct 2020 14:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996131; bh=gF3voaBm2copooG2glx9EOo01/CXMpMjhX84fpOBpdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0D4KvxfRBCJzH2Erpr4RO9Nl38IlZi5bTbi/7lx4vi30lacUoh9X9SyQ4GD3+PVB9 iIrXvu7ZznUbNfo5Y6/VD4FTagZzTFBGi2fTczoDuzHldgBjoTYjnYpScrV9CmFrxw HbSUiz7f6dnbhQKaNlpoHdciTpdhud7fgaaJK5Bg= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v3 2/5] ceph: make fsc->mount_state an int Date: Tue, 6 Oct 2020 10:55:23 -0400 Message-Id: <20201006145526.313151-3-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201006145526.313151-1-jlayton@kernel.org> References: <20201006145526.313151-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This field is an unsigned long currently, which is a bit of a waste on most arches since this just holds an enum. Make it (signed) int instead. Signed-off-by: Jeff Layton --- fs/ceph/super.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 582694899130..d0cb6a51c6a4 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -106,7 +106,7 @@ struct ceph_fs_client { struct ceph_mount_options *mount_options; struct ceph_client *client; - unsigned long mount_state; + int mount_state; unsigned long last_auto_reconnect; bool blocklisted; From patchwork Tue Oct 6 14:55:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 11818823 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A71A139F for ; Tue, 6 Oct 2020 14:55:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08F0120782 for ; Tue, 6 Oct 2020 14:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996134; bh=kLFmp5Dzc242ZFcd1UBywGbxeYTbNVYXxUPXRIJl6XY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=TrMBJx/O5JVdeQwgtmoDAo2Js+UkZULMed1jrWIzL1GLgqQj+KTr81ShxX+x3cvpV BdlIqMFpxRwv9F9SrupDuCNel3bcKa/jbYxSIuRbZdKLDdU9rkYuXjtO8Qt/ZN8aYK k02Sc286edB7p82omm6g4xpEBFfG0ckNYbSz7sYk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726235AbgJFOzd (ORCPT ); Tue, 6 Oct 2020 10:55:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:38218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbgJFOzc (ORCPT ); Tue, 6 Oct 2020 10:55:32 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BEAF720789; Tue, 6 Oct 2020 14:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996132; bh=kLFmp5Dzc242ZFcd1UBywGbxeYTbNVYXxUPXRIJl6XY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJStYxa3OBTPpjSgffux2onwY9w+50ZYImsD8if/uj9tr0c/dkkLD7m8EJbZAGUBO kP5mBN2qshykEKtiW6MnP2k/i0yqSBfwKO+qxQdnsUdHKeKDqYEGMoNiZT8ExZ99kE J1Y7ZBbnzNMuzgGis5AhjW9rOAsCJdK3zo6q5jcc= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v3 3/5] ceph: don't mark mount as SHUTDOWN when recovering session Date: Tue, 6 Oct 2020 10:55:24 -0400 Message-Id: <20201006145526.313151-4-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201006145526.313151-1-jlayton@kernel.org> References: <20201006145526.313151-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org When recovering a session (a'la recover_session=clean), we want to do all of the operations that we do on a forced umount, but changing the mount state to SHUTDOWN is can cause queued MDS requests to fail when the session comes back. Reserve SHUTDOWN state for forced umount, and make a new RECOVER state for the forced reconnect situation. Cc: "Yan, Zheng" Signed-off-by: Jeff Layton SQUASH: add new CEPH_MOUNT_RECOVER state Signed-off-by: Jeff Layton --- fs/ceph/inode.c | 2 +- fs/ceph/mds_client.c | 2 +- fs/ceph/super.c | 14 ++++++++++---- include/linux/ceph/libceph.h | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 526faf4778ce..02b11a4a4d39 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1888,7 +1888,7 @@ static void ceph_do_invalidate_pages(struct inode *inode) mutex_lock(&ci->i_truncate_mutex); - if (READ_ONCE(fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) { + if (READ_ONCE(fsc->mount_state) >= CEPH_MOUNT_SHUTDOWN) { pr_warn_ratelimited("invalidate_pages %p %lld forced umount\n", inode, ceph_ino(inode)); mapping_set_error(inode->i_mapping, -EIO); diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 6b408851eea1..cd46f7e40370 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1595,7 +1595,7 @@ static int remove_session_caps_cb(struct inode *inode, struct ceph_cap *cap, struct ceph_cap_flush *cf; struct ceph_mds_client *mdsc = fsc->mdsc; - if (READ_ONCE(fsc->mount_state) == CEPH_MOUNT_SHUTDOWN) { + if (READ_ONCE(fsc->mount_state) >= CEPH_MOUNT_SHUTDOWN) { if (inode->i_data.nrpages > 0) invalidate = true; if (ci->i_wrbuffer_ref > 0) diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 2516304379d3..2f530a111b3a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -832,6 +832,13 @@ static void destroy_caches(void) ceph_fscache_unregister(); } +static void __ceph_umount_begin(struct ceph_fs_client *fsc) +{ + ceph_osdc_abort_requests(&fsc->client->osdc, -EIO); + ceph_mdsc_force_umount(fsc->mdsc); + fsc->filp_gen++; // invalidate open files +} + /* * ceph_umount_begin - initiate forced umount. Tear down the * mount, skipping steps that may hang while waiting for server(s). @@ -844,9 +851,7 @@ static void ceph_umount_begin(struct super_block *sb) if (!fsc) return; fsc->mount_state = CEPH_MOUNT_SHUTDOWN; - ceph_osdc_abort_requests(&fsc->client->osdc, -EIO); - ceph_mdsc_force_umount(fsc->mdsc); - fsc->filp_gen++; // invalidate open files + __ceph_umount_begin(fsc); } static const struct super_operations ceph_super_ops = { @@ -1235,7 +1240,8 @@ int ceph_force_reconnect(struct super_block *sb) struct ceph_fs_client *fsc = ceph_sb_to_client(sb); int err = 0; - ceph_umount_begin(sb); + fsc->mount_state = CEPH_MOUNT_RECOVER; + __ceph_umount_begin(fsc); /* Make sure all page caches get invalidated. * see remove_session_caps_cb() */ diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index c8645f0b797d..eb5a7ca13f9c 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h @@ -104,6 +104,7 @@ enum { CEPH_MOUNT_UNMOUNTING, CEPH_MOUNT_UNMOUNTED, CEPH_MOUNT_SHUTDOWN, + CEPH_MOUNT_RECOVER, }; static inline unsigned long ceph_timeout_jiffies(unsigned long timeout) From patchwork Tue Oct 6 14:55:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 11818825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CEE4D112E for ; Tue, 6 Oct 2020 14:55:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFFE7206DD for ; Tue, 6 Oct 2020 14:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996134; bh=sidwf1KhBEvp0V1xv1dd+iN5rzt7H2NoFEk5TAP1Vlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nFYQD4jFjDSC6O64iEg+Sx9qV0mqUn3IlGu+1M2J4wxZjKN5BVz1wU/1ee77e56jl sAYimbLAnRL3L4J1HO+owqsRDbnys5nDMnG9Yn/TueYHANR2FkZeXUaxwtcsGjB5sC QW4AFxpPm+nYmVfL99AFxO1DgZBC9BvxGQnhYJZ4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726362AbgJFOze (ORCPT ); Tue, 6 Oct 2020 10:55:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:38230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbgJFOzd (ORCPT ); Tue, 6 Oct 2020 10:55:33 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77A90206CB; Tue, 6 Oct 2020 14:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996133; bh=sidwf1KhBEvp0V1xv1dd+iN5rzt7H2NoFEk5TAP1Vlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K07HGnfZbazjzxzs4U7jwOMNEOholn/wkiyhGtenpB3O+hJsfDtfs74eiTJ26tHBA v1QqSH2OvEmpvcxSH7HZkQukxCg+Cob6ahmQB9uETpO0Zun91Sys3iFF5TSzLA8lOw iAAdZ5NSL5CVam3sOHJXSVWb+0mZeQ4NJGPe38HU= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v3 4/5] ceph: remove timeout on allowing reconnect after blocklisting Date: Tue, 6 Oct 2020 10:55:25 -0400 Message-Id: <20201006145526.313151-5-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201006145526.313151-1-jlayton@kernel.org> References: <20201006145526.313151-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 30 minutes is a long time to wait, and this makes it difficult to test the feature by manually blocklisting clients. Remove the timeout infrastructure and just allow the client to reconnect at will. Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 5 ----- fs/ceph/super.h | 1 - 2 files changed, 6 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index cd46f7e40370..1727931248b5 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4374,12 +4374,7 @@ static void maybe_recover_session(struct ceph_mds_client *mdsc) if (!READ_ONCE(fsc->blocklisted)) return; - if (fsc->last_auto_reconnect && - time_before(jiffies, fsc->last_auto_reconnect + HZ * 60 * 30)) - return; - pr_info("auto reconnect after blocklisted\n"); - fsc->last_auto_reconnect = jiffies; ceph_force_reconnect(fsc->sb); } diff --git a/fs/ceph/super.h b/fs/ceph/super.h index d0cb6a51c6a4..9ced23b092f5 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -108,7 +108,6 @@ struct ceph_fs_client { int mount_state; - unsigned long last_auto_reconnect; bool blocklisted; bool have_copy_from2; From patchwork Tue Oct 6 14:55:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 11818827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B5EC0112E for ; Tue, 6 Oct 2020 14:55:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A2D5206CB for ; Tue, 6 Oct 2020 14:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996135; bh=U4J8eGm0R/9hjPzUbbQUvlzzv/eH4RUSWC9qdVgd0w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OoIuY6wMQLYWD8gAAkfRvYrX80K4jGwHlVYV/XhWkaxQ/tHipzuqXpHWJtjqmwLdP re6kzyN0UzyHUj8t5kLzJSlTJU9OyN/x4/v2a18TxuBlgBXD6WGqA2bOZ1iiGu7icF Fe8pxiL69ID3BXnnf2o7w4sJIbhb/hdlbratID1o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726364AbgJFOzf (ORCPT ); Tue, 6 Oct 2020 10:55:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:38254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726319AbgJFOze (ORCPT ); Tue, 6 Oct 2020 10:55:34 -0400 Received: from tleilax.com (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D54F2078E; Tue, 6 Oct 2020 14:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601996133; bh=U4J8eGm0R/9hjPzUbbQUvlzzv/eH4RUSWC9qdVgd0w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VeTG6xse+JU4wPo+1Loash/PGAO1vyAGUv55KuBfk1HiCLqcPsdd4UgE7RG1Bc8Yi s3MeO6tKZVzLKwLndpsSo7wWK2da39cyHDPIfPdSXD5wxO6/i8PNQDCPgeckDCOVPK pTa0DUwK9mXeuuAEzFfeaYuZ6npYEOZmPLCHVN9c= From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com Subject: [PATCH v3 5/5] ceph: queue MDS requests to REJECTED sessions when CLEANRECOVER is set Date: Tue, 6 Oct 2020 10:55:26 -0400 Message-Id: <20201006145526.313151-6-jlayton@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201006145526.313151-1-jlayton@kernel.org> References: <20201006145526.313151-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Ilya noticed that the first access to a blacklisted mount would often get back -EACCES, but then subsequent calls would be OK. The problem is in __do_request. If the session is marked as REJECTED, a hard error is returned instead of waiting for a new session to come into being. When the session is REJECTED and the mount was done with recover_session=clean, queue the request to the waiting_for_map queue, which will be awoken after tearing down the old session. We can only do this for sync requests though, so check for async ones first and just let the callers redrive a sync request. URL: https://tracker.ceph.com/issues/47385 Reported-by: Ilya Dryomov Signed-off-by: Jeff Layton --- fs/ceph/mds_client.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 1727931248b5..048eb69be29e 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -2818,10 +2818,6 @@ static void __do_request(struct ceph_mds_client *mdsc, ceph_session_state_name(session->s_state)); if (session->s_state != CEPH_MDS_SESSION_OPEN && session->s_state != CEPH_MDS_SESSION_HUNG) { - if (session->s_state == CEPH_MDS_SESSION_REJECTED) { - err = -EACCES; - goto out_session; - } /* * We cannot queue async requests since the caps and delegated * inodes are bound to the session. Just return -EJUKEBOX and @@ -2831,6 +2827,20 @@ static void __do_request(struct ceph_mds_client *mdsc, err = -EJUKEBOX; goto out_session; } + + /* + * If the session has been REJECTED, then return a hard error, + * unless it's a CLEANRECOVER mount, in which case we'll queue + * it to the mdsc queue. + */ + if (session->s_state == CEPH_MDS_SESSION_REJECTED) { + if (ceph_test_mount_opt(mdsc->fsc, CLEANRECOVER)) + list_add(&req->r_wait, &mdsc->waiting_for_map); + else + err = -EACCES; + goto out_session; + } + if (session->s_state == CEPH_MDS_SESSION_NEW || session->s_state == CEPH_MDS_SESSION_CLOSING) { err = __open_session(mdsc, session);