Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26597276rwd; Mon, 3 Jul 2023 11:56:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlEoIBQ5JPv1h1wjAzJInMzfp6B4DKG9W6JOJes0foj3/EKy5b+u1j3bJlf7A4YABzJ1S9tO X-Received: by 2002:a05:6a00:c8f:b0:66c:a45:f00b with SMTP id a15-20020a056a000c8f00b0066c0a45f00bmr17638395pfv.23.1688410609750; Mon, 03 Jul 2023 11:56:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688410609; cv=none; d=google.com; s=arc-20160816; b=c9+FPSi8zBp4hx/JstbdbTOse9oi3g7x4Cf5JYLGkM/FVhimYaOrLGpdYvA/FPunUF 8PINv9aMwewGKTVy8f0AAC7dA3BDRyNDfDF+Dd2AllegZEoiLZf81GCZ6YEqx0Toggi8 m5Xi4fGotZGANmRcS3T/T+UAqWvbbann+aT8nQTJgl9eqAiGAxhlrPelCuFyzNjBjmZ+ wjqxXI7nBFAu6P8QvuN3f3B/1X9VGWmaZVf2h9QBDDIpJKYAtsxQYFnnJS0XhhCZXTjA Okn0B3dN2rpEawd3hE5LOicAQqjMH4x30F0e0DjzMsbBJTjK3vrk0ZR6FnehPMAqGenc +hIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Zg54bx4XEvunLiZj82LGfi5c5+FX4BrGVPRNU463J4Y=; fh=FsFIOGll/8cSLDGqy4bG/y7xuu374zxJxDiPoS/nY2k=; b=gI8P1bm0L2nIvp9nLOi3RQrI3P1wwptkoBRX38mx4FNAVZcWY9Q4qiPpkypxh9TW7H jD7M2hdcMDJV6AtEJW7PtXh5xeafIJWa/mabxA9io780u9yKlF5k6hOiI3RRxxwOzKFY 5+PNu+MYoE9spSJrBXVninAvZ8JK/7KtmIwo2bg+txWMerCMIgDQu+0/7QJCsGfgQU+C zvulchDJnnb3hHLDG1SV5vJGauO+DrruFr68xRxgifIoMAUGBK5xQhcQRE7b93Y2et1R dmMPlR1/5tvAJ3tFWHB7NtXR/dgvvprU0q3n/1om+b897YcgiLlX0soGYqkELfiN9z9D Ireg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QY1EzV1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by5-20020a056a00400500b006785d3c33b6si15540284pfb.285.2023.07.03.11.56.35; Mon, 03 Jul 2023 11:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QY1EzV1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbjGCSrv (ORCPT + 99 others); Mon, 3 Jul 2023 14:47:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229977AbjGCSru (ORCPT ); Mon, 3 Jul 2023 14:47:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A972AE73 for ; Mon, 3 Jul 2023 11:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688410017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zg54bx4XEvunLiZj82LGfi5c5+FX4BrGVPRNU463J4Y=; b=QY1EzV1UI0Mf3efJg1ipf7deMNKfF5aMCqGzzXhMY/T93VxEyLvs14ODN41nK2IZRludSp yN2hzMW7IbHv3u5yzWMpN/1eZLzbZP7JMjQ3vXZmIbnYDYC4lYtCzuyWgwLZ0ENgAq4efB 02aDb9dXdx325yx1MZTOEvW+xVe/lkM= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-7KEoV_mnOLGMPv7VQQ_V4g-1; Mon, 03 Jul 2023 14:46:56 -0400 X-MC-Unique: 7KEoV_mnOLGMPv7VQQ_V4g-1 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-26304c2e178so6617487a91.3 for ; Mon, 03 Jul 2023 11:46:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688410015; x=1691002015; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zg54bx4XEvunLiZj82LGfi5c5+FX4BrGVPRNU463J4Y=; b=Ie2T9MZr2ToBkhg89uRtsDI8j/AsB+iNnAMmGzJBGGQDsMuZw2Q2NO2l4iyETAVOsz +GVXPtCzuFnOPDimMOKWi0Cv3aZgarrwgUVCQjThsfSDy904GtpelTS519hz3rygngtG ptXlpVPtq1O4JmiZngR/7S9C6icl3fOo0GrTzl0iZjkpZpkmwMZ4c0Uu6uSDzSKi4gvN GEOUEpeniMHSTXQkGa54EDvWEvxexiGxtYLm2PLCAFstJjOAo2yZCs0UYTdx34kPSawF aJRJBJRuZ/NMttFsHWoCZ2z2DmUUorSsCc+F68Io2sp5Wzz3+DbaqL+vVadsB0zvWP6j H3sQ== X-Gm-Message-State: ABy/qLbwuiDNMVhwBrfQqh8xJnbb51emplQbGMdYaqz49bfcst6W1c8P ZpxudKlSDZkADACOTD+IflUjxJqnSSmLJXrXpwNbMkmRvBiY6pRJogVm8bc5wYffFCiwU582STm 7AX5r+lgyXMucrePx6RwF5mIVyR3adm3SrpG5uRhx X-Received: by 2002:a17:90a:db87:b0:262:d1b5:3390 with SMTP id h7-20020a17090adb8700b00262d1b53390mr11049013pjv.3.1688410015740; Mon, 03 Jul 2023 11:46:55 -0700 (PDT) X-Received: by 2002:a17:90a:db87:b0:262:d1b5:3390 with SMTP id h7-20020a17090adb8700b00262d1b53390mr11049002pjv.3.1688410015479; Mon, 03 Jul 2023 11:46:55 -0700 (PDT) MIME-Version: 1.0 References: <20230703114318.1576ea24@rorschach.local.home> In-Reply-To: From: David Wysochanski Date: Mon, 3 Jul 2023 14:46:19 -0400 Message-ID: Subject: Re: Buggy rwsem locking code in fs/smb/client/file.c To: Linus Torvalds Cc: Steven Rostedt , LKML , Ronnie Sahlberg , Pavel Shilovsky , Peter Zijlstra , Thomas Gleixner , Ajay Kaher Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 3, 2023 at 1:00=E2=80=AFPM Linus Torvalds wrote: > > On Mon, 3 Jul 2023 at 08:43, Steven Rostedt wrote: > > > > And hides the bug by wrapping the down_write() with: > > > > +void > > +cifs_down_write(struct rw_semaphore *sem) > > +{ > > + while (!down_write_trylock(sem)) > > + msleep(10); > > +} > > That is indeed disgusting. > > It may *work* - because as the commit message says, it means that > writers are now never queued up and thus never block recursive > readers. > > And in the process it now becomes absolutely horribly unfair to > writers, who will easily get starved by readers. > > This is absolutely not acceptable in any sane situation. Are writers > *so* rare and special that starving them is ok? > > Because starvation can be just as deadly as a deadlock. You're just > hiding the problem from lockdep and yourself. > > This is very much a "head in the sand" solution. > > Linus > Steve and Linus, Thank you for pointing this out. I'll have to get with Ronnie on this and come up with something better.