From nobody Tue Feb 07 01:59:59 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P9mY941b9z3njlx for ; Tue, 7 Feb 2023 02:00:13 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P9mY83QNnz3NWn; Tue, 7 Feb 2023 02:00:12 +0000 (UTC) (envelope-from asomers@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.217.50 as permitted sender) smtp.mailfrom=asomers@gmail.com; dmarc=none Received: by mail-vs1-f50.google.com with SMTP id k4so14767449vsc.4; Mon, 06 Feb 2023 18:00:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=ivYl6PWfgc4L/ZZ6oLD2dbu3f7Hx9+UkudRvWVGkmGA=; b=0OeeCqej8prO+fTkw4+/EJKx/IzKMiHKG9M9NwU8uj19Nr58rIQpMdFkm5eyTyieeX Rs864eB+z9bjSGcXOOeiDgyaJu2s5+L3fTT9yrpwH6xy+k5iHL8ieuDXqpGT7ln6ezj4 pqHzLMe9lRls6w6Uu6UcTQbIkSZkLLbmouD9hzcUsK28Z56AS2GZj6zMNSAJO6/WgRMQ VkZOwmO6noZ5o3I8f34ZwTSmSkRdXdyQ6EwcY7o6UqwA8seW+xOXrBvNFZ8CJNt5Lo+k cRU7A0g+rfiMPRoL0bTV4l3V1XpO+9a0ytSXcOig1vEZdEGu4x0AeHMWHyqRoT9rrSfD yGqw== X-Gm-Message-State: AO0yUKUm7Cxnhfg3sCBD6C5TkYG9Dd1PMcMRGnQrjqTDl+EYjzrlOsuf T5fW6Vn5sKa54Kh6WmBOMj1KGwsFLj/yTNaG1UQ= X-Google-Smtp-Source: AK7set+56HqbjPW76KXhJexuLmRVdGr9uaD0PMadhmnYR6K6vljifRwkokPWEVY0FMpn4oxGhm6NYZqTRcHjZB8KYgM= X-Received: by 2002:a67:8c05:0:b0:40e:7b91:ffc6 with SMTP id o5-20020a678c05000000b0040e7b91ffc6mr352628vsd.53.1675735211647; Mon, 06 Feb 2023 18:00:11 -0800 (PST) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 References: In-Reply-To: From: Alan Somers Date: Mon, 6 Feb 2023 18:59:59 -0700 Message-ID: Subject: Re: RFC: Should fspacectl() commit changes to stable storage? To: Rick Macklem Cc: FreeBSD CURRENT , Konstantin Belousov Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [-2.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_SHORT(-1.00)[-0.996]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RCVD_TLS_LAST(0.00)[]; TAGGED_RCPT(0.00)[]; TO_DN_ALL(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_IN_DNSWL_NONE(0.00)[209.85.217.50:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_THREE(0.00)[3]; FREEFALL_USER(0.00)[asomers]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FROM_HAS_DN(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; ARC_NA(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.217.50:from]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4P9mY83QNnz3NWn X-Spamd-Bar: - X-ThisMailContainsUnwantedMimeParts: N On Mon, Feb 6, 2023 at 6:23 PM Rick Macklem wrote: > > PR#269328 reports an issue related to fspacectl() being > mixed with mmap'd I/O. > > When working on a fix for this for the NFS client, I realized that > "man fspacectl" does not clarify if the deallocation should commit > changes to stable storage before returning success. > vop_stddeallocate() currently does not do this so, if a machine > crashes immediately after fspacectl() returns success, the hole > may not be there when the machine reboots. > > For POSIX writes, it is clear that recently written data may be > lost when a machine crashes/reboots and fsync(2) is used to > ensure the data is on stable storage and won't be lost when a > crash/reboot occurs. > > The question is "Should fsync(2) be required to ensure a hole > punched by fspacectl(2) is not lost or should it be guaranteed > to not be lost when fspacectl(2) returns? > Since fspacectl(2) is FreeBSD specific and there is no standard, > it could be defined either way. > > So, what do you think? rick It think it should be just like write. An fsync should be required to ensure that the effects will be visible after a reboot.