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 35A27C433F5 for ; Thu, 5 May 2022 13:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbiEEN3a (ORCPT ); Thu, 5 May 2022 09:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379752AbiEEN3P (ORCPT ); Thu, 5 May 2022 09:29:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3B9E0F9 for ; Thu, 5 May 2022 06:25:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 416BDB82D55 for ; Thu, 5 May 2022 13:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89E2AC385A8; Thu, 5 May 2022 13:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651757133; bh=gxeqR/RgAN53Lk2qwtMZA8uGUF3fNwydmoUYWTm3GGg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=PcGXt/svY/HD5FYaRhWlRQKO/a2Ofy81X3xu/u5Uf1Tv1gXXQOFez1f7m6ZZiFLhy ibXgIMI/lyktyXDH2sDvfL9ByLITGMV6oxE9E2vGHs7q87Gi7Tk8ZkMQzFETxSHoZ7 QR8iZxWVtVg6L5CoJLGjQkZbnE68dqL7haBAsY1UivtUaL9hyOAtY39S9Y7PRDxhy3 4YvJfD6f9/yHPjYdESqTOkLFZhLvIstpe55P0iIELkv07pnihhRgKcHEMGS6glky2T Xf8Xxucvkp9ktsGgqnMr8U9fbiddd2sxjyPmLfd8Xr8DM+VlVMEN8/Sd8IXt3G8rvu 8pPle4UEh7WZg== Message-ID: Subject: Re: [PATCH v2] ceph: switch to VM_BUG_ON_FOLIO and continue the loop for none write op From: Jeff Layton To: Xiubo Li Cc: idryomov@gmail.com, vshankar@redhat.com, ceph-devel@vger.kernel.org Date: Thu, 05 May 2022 09:25:31 -0400 In-Reply-To: <20220505124718.50261-1-xiubli@redhat.com> References: <20220505124718.50261-1-xiubli@redhat.com> Content-Type: text/plain; charset="ISO-8859-15" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Thu, 2022-05-05 at 20:47 +0800, Xiubo Li wrote: > Use the VM_BUG_ON_FOLIO macro to get more infomation when we hit > the BUG_ON, and continue the loop when seeing the incorrect none > write opcode in writepages_finish(). > > URL: https://tracker.ceph.com/issues/55421 > Signed-off-by: Xiubo Li > --- > fs/ceph/addr.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c > index e52b62407b10..d4bcef1d9549 100644 > --- a/fs/ceph/addr.c > +++ b/fs/ceph/addr.c > @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio) > * Reference snap context in folio->private. Also set > * PagePrivate so that we get invalidate_folio callback. > */ > - BUG_ON(folio_get_private(folio)); > + VM_BUG_ON_FOLIO(folio_get_private(folio), folio); > folio_attach_private(folio, snapc); > > return ceph_fscache_dirty_folio(mapping, folio); > @@ -733,8 +733,11 @@ static void writepages_finish(struct ceph_osd_request *req) > > /* clean all pages */ > for (i = 0; i < req->r_num_ops; i++) { > - if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) > - break; > + if (req->r_ops[i].op != CEPH_OSD_OP_WRITE) { > + pr_warn("%s incorrect op %d req %p index %d tid %llu\n", > + __func__, req->r_ops[i].op, req, i, req->r_tid); > + continue; A break here is probably fine. We don't expect to see any non OP_WRITE ops in here, so if we do I don't see the point in continuing. > + } > > osd_data = osd_req_op_extent_osd_data(req, i); > BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_PAGES); Otherwise looks fine. -- Jeff Layton