Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4769247ioa; Wed, 27 Apr 2022 10:40:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww0T2CeRM6SaCu2oJEn2Lz6R8orGu+7I33V1ZnKKsiObt2lnkN5LBYKeUH/rT7mBk1xab5 X-Received: by 2002:a63:2b8a:0:b0:3aa:f59e:a4a7 with SMTP id r132-20020a632b8a000000b003aaf59ea4a7mr19206856pgr.91.1651081248421; Wed, 27 Apr 2022 10:40:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651081248; cv=none; d=google.com; s=arc-20160816; b=tsmVcfk8NPoU1a+8d0CcwwN7BdK6DoAWYL7z/ulLP1mpTIJy6lMmgHrVOmsZR5sS3d vsNIVjhr+zwrzVqe/Cx+fMbpS37Y/32HVCh9O+UcPCJCYQ5juQKNdGjKiJp6qsl9NQX9 IGiPWp68Z5AOZcGc1rt8SD+SLZzBQnzmPeyjx7hjGp6Vrs2WNEF+Bgac0FdpGqGJMRAI pfJ/mU8iIHGiocv00geyrROzqhVm7WGKbCbNTYFQXD4+KiMyhTve9IpOP/UsgzHpGh0u mLeNy4lIlSIc8LT4qqbTcLygzzSCsOzbEHqK0TKvhcPLLxkgwlB1CPU+MI5Agqxaaf2A l5gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BkjJC3atGNZLbDtpxaTEoGR+ldCQ7Vj1pUM/H8AnDYM=; b=e5fUuUyxu2EMrdViFqew5hm0yTKmPkNJB9FlibgzUPMU4DfJGMoG5npi6YsONQRzaN babn6A7NR3ZDV78APrxTrcNleWWcvvHve8EnLtgSG1g60aHjfvEFdVvPWTpalgRrf5Is RJdVyYOmLLiHgFxeD0DEpN4aYlNtveu3Rm33kadyuZrdbMNw1ieyWKpan4sTIgRRCEOI s2WE/AhPTdU6hzqr4bLSNAYxm+h8+6lKL3uHxT/sQDjw+TIFdqP05O34FNCFTetKMT4I /qAcq4jTfPxfi96FJNqaQgAUgJ54Mvr1f1fvPgTPuWCJlDFKceJnxOcwGDp5IegH2AIJ xuZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="GgsK/vod"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e14-20020a170902ef4e00b0015d2feba726si2173194plx.208.2022.04.27.10.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 10:40:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="GgsK/vod"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2A2C042EEC; Wed, 27 Apr 2022 10:13:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243940AbiD0RQo (ORCPT + 99 others); Wed, 27 Apr 2022 13:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243939AbiD0RQl (ORCPT ); Wed, 27 Apr 2022 13:16:41 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A778C42A29 for ; Wed, 27 Apr 2022 10:13:29 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id q14so3489773ljc.12 for ; Wed, 27 Apr 2022 10:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BkjJC3atGNZLbDtpxaTEoGR+ldCQ7Vj1pUM/H8AnDYM=; b=GgsK/vod/0h6Z3q/viJfHLTa/y3ItPCOjt4m7HT1PGJwZ2zLilClTKdELGxGN4UhXm GfZvOi7Q+W7/fcfcblmu06c4NqVRSsiY5riv6RbowCpEqC/2d+fBtAEJlu4H65Cpao8E wA+7jQFmJYEawrv7bfULBOVaxxz3nkm6pCEkY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BkjJC3atGNZLbDtpxaTEoGR+ldCQ7Vj1pUM/H8AnDYM=; b=XfcNV79tCKBzOlLWglxKPZUhGOFb63bmogV0P2zhRzO80UyuNBl1x3+aMtXGAx66Q5 DILC9xsxdourxZ0FRKD9itBjZcHBjy6FzI8Nk1D6QZQcFI7kR/ZFBxT4enb9/y97FZHJ lQ5gVcAJebIiQhI0hKptZ9G7ZxKMvGL7JB6Paul1UN28CMvB2N4FInMxuZvKKKcYo/Hu u+RvQZ7/HtLM0O9GMmjBFA4gOsFw0zXGrTZgIIaxtd8hrc/uFdk0wC2tdsCB7jkmEqxh 8sbmVsqBt87nXf0WUNT2GXlvHMBil6JgdFIPsljQUFZp7AHDl6/EpFD1XBWiESjmdhXN kD3g== X-Gm-Message-State: AOAM530e5+d+m7ihJd5h7aTvfiUfySTPzAR6rvKbSEr8OOVjEdYbXmaA xjefU3yAqxD32oJUKkH5v+/MiG3WPdPyn5OVPqI= X-Received: by 2002:a05:651c:1a09:b0:24f:199c:9d1a with SMTP id by9-20020a05651c1a0900b0024f199c9d1amr6759722ljb.173.1651079607683; Wed, 27 Apr 2022 10:13:27 -0700 (PDT) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com. [209.85.208.174]) by smtp.gmail.com with ESMTPSA id b11-20020ac2410b000000b004457116a575sm2100971lfi.273.2022.04.27.10.13.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Apr 2022 10:13:26 -0700 (PDT) Received: by mail-lj1-f174.google.com with SMTP id 17so3559241lji.1 for ; Wed, 27 Apr 2022 10:13:26 -0700 (PDT) X-Received: by 2002:a2e:b8d4:0:b0:24f:2cc3:2c51 with SMTP id s20-20020a2eb8d4000000b0024f2cc32c51mr1706392ljp.176.1651079606302; Wed, 27 Apr 2022 10:13:26 -0700 (PDT) MIME-Version: 1.0 References: <20220426145445.2282274-1-agruenba@redhat.com> In-Reply-To: From: Linus Torvalds Date: Wed, 27 Apr 2022 10:13:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [GIT PULL] gfs2 fix To: Andreas Gruenbacher Cc: cluster-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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 Wed, Apr 27, 2022 at 5:29 AM Andreas Gruenbacher wrote: > > Regular (buffered) reads and writes are expected to be atomic with > respect to each other. Linux has actually never honored that completely broken POSIX requirement, although I think some filesystems (notably XFS) have tried. It's a completely broken concept. It's not possible to honor atomicity with mmap(), and nobody has *ever* cared. And it causes huge amounts of problems and basically makes any sane locking entirely impossible. The fact that you literally broke regular file writes in ways that are incompatible with (much MUCH more important) POSIX file behavior to try to get that broken read/write atomicity is only one example among many for why that alleged rule just has to be ignored. We do honor the PIPE_BUF atomicity on pipes, which is a completely different kind of atomicity wrt read/write, and doesn't have the fundamental issues that arbitrary regular file reads/writes have. There is absolutely no sane way to do that file atomicity wrt arbitrary read/write calls (*), and you shouldn't even try. That rule needs to be forgotten about, and buried 6ft deep. So please scrub any mention of that idiotic rule from documentation, and from your brain. And please don't break "partial write means disk full or IO error" due to trying to follow this broken rule, which was apparently what you did. Because that "regular file read/write is done in full" is a *MUCH* more important rule, and there is a shitton of applications that most definitely depend on *that* rule. Just go to debian code search, and look for "if (write(" and you'll get thousands of hits, and on the first page of hits 9 out of 10 of the hits are literally about that "partial write is an error", eg code like this: if (write(fd,&triple,sizeof(triple)) != sizeof(triple)) reporterr(1,NULL); from libreoffice. Linus (*) Yeah, if you never care about performance(**) of mixed read/write, and you don't care about mmap, and you have no other locking issues, it's certainly possible. The old rule came about from original UNIX literally taking an inode lock around the whole IO access, because that was simple, and back in the days you'd never have multiple concurrent readers/writers anyway. (**) It's also instructive how O_DIRECT literally throws that rule away, and then some direct-IO people said for years that direct-IO is superior and used this as one of their arguments. Probably the same people who thought that "oh, don't report partial success", because we can't deal with it.