From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796098775; b=d8itCGl19R3XdM2twDJaGouwjbiR/nW/PmaODp1PtuS5tDTjo1ugx+q8WK22F9yOwTv6 vs+HtxbG2VHrhS9mwK7Uan69p+7lyygMP7WnErI8FVPyOq3y2hoiMvOxaNYxaWzb1H4D/ fqLtlNyfIfa5YDuPUxlRjo37Cxnv7rUpokKS8DO3enqBNkoLhm/7pQuqGDRcSwFf1rjcd CEoNQoPs9mskcOK/Aq30gZpux/Y/BxxeknKMi+ZIsEL5SC8+FXGCrMALIqGu6gFLRe01u vxDgjHllk+D1KSHdgFlooRvlBxVtTQ+kQClYN6BENiEoLPr5RNH0Dwg/+Vy06HbrX2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796098775; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=IuVPT0NooWLEGuhknl+hI/ACwKjNPofr7O0ohOW5PGU=; b=hdeubqANo/WyDYtCQpFiRNLhtT6TPR8XjK5/vCw6JjybE1ldwMKnfo6RbPouys0FOx6n tY4TeqeRmt4ni3sIT7YBBDMnUStWOqs1VbbQI//16AcWRRIA5Jpy0zhiy62ixw3BRztxr WAmueMAT4TtWI2VVmaDhvALvWRYqUJAdFLuVcgNisVuUHqgMO04lx53cx5XKPUbN2xziy GyTZ3f6Cpsf5ZoEkNmOnFI1l1IrseicMwNI2E03g2X1btrkx9Mo/M7RVw8BPBYY5F0BtD QZfpS2aBgiFK0J84/Fi889FbESFlAIG4olyHpD55Zei9E9YXI0pLM2CFBYozNyJRpOw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=FDG7dpwa; arc=none smtp.remote-ip=209.85.214.180 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F81C606A320 for ; Tue, 1 Dec 2026 04:19:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0F81C606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=FDG7dpwa Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-2f04244c3d0so87252325ad.3 for ; Mon, 30 Nov 2026 20:19:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796098774; x=1796703574; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=IuVPT0NooWLEGuhknl+hI/ACwKjNPofr7O0ohOW5PGU=; b=FDG7dpwaYfOLo2Bxz19v8rMvipJVWw3xXBaXvGPMpO8ejdNg6wNz3ydEOk9pEIZ3Uy 1Wgrj/iv9mlPWu/lIwfDvVCMpifNpHRlGDmDBAlKli41c0OxThapJx7T0+kax6bXnuql rNdq6zc5kDlf6sLOgCx7sTSxM7hjRKd/+cbNAqbsgHbV7k5yYUjxewKHwj4wtBeNUcM3 MypePfC8+rYL0UzGAGlNiOosI1i3Fw71N2gHjAqJ0o9rcDQhqb27pSpSwDr73fBSL9CW 27r9x0z0fIuEok04kkjZIJ8CgkAgwDRqqhaGo00S3HwuDnngYBY5+RcLKFL5fKybOEiP iOLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796098774; x=1796703574; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=IuVPT0NooWLEGuhknl+hI/ACwKjNPofr7O0ohOW5PGU=; b=QtMDRncvLOrPyThmL8yfcJ7+UM24EUIaNJ6U71psUty4RT9Q61xxuwEENw16qUgENP wI3oHdcVuQvz8Ghxn+kAqtWnWcpXm0epjfEByFf4BuwqMB6w0libDloJwp3G0TQ0+iCu 3GLB/6APEd/Qo+yr9pNhv187B22Tvo15bzyKg/nXqTxqkdHsYWROZBw6uVKh2pQDtbQw VBuMsEmaevFuy/d3AKDeT5jdw5vYfIjIQwrBitFEv2HX5R8H7nAK+KmqWFuD8rXm3cCT /TfuPghy5vxasqSt5JLhXFtv/KNXTt+5T+tcovNubu2oeSOKwiM48Wy9GKKLMrT8rjKN T5pg== X-Forwarded-Encrypted: i=1; AL+hErH4GQk7EoCek89Lz/jD1bhtW4Mh78FzWQIcna4tA731SrSxOIlIBYbPhCliWO0Gplyy31yAR+HibynAQ2g=@vger.kernel.org X-Gm-Message-State: APuU4Z9dI3BFSjBPny7491Ddiw6R3THPTxKqhlg8cUpt+D01cottgct+ 7AQKpJ1qCIIhjUsZDWdm/30z+ngTz/QJS23C/RQVeuOs7+cPvokOpj4/ X-Gm-Gg: AZFdTZd9JyNT7dIz95gd9USZwAkd+DO9kuJ9d8wMKxDFoVsytCWphEelN18K+bSCQJ4 O6vvRu+Bm+gvpWu33JreE7RbY7FJj7wWLh7tsCGtFaH8GxWCXhFY+ta2S4KIb14YJzfh8/nfmXG zQuG6cQKHGqjMKuzaT+k3mcrX/tcdwg2wKomZ1ge+06707mAsSWbfGh2zyyGd/1IDC4dT/si3pv +ZoZbPn/hFOJqbvd4g4U82g38bdt6y6EpM5Fha2Sqp8kEJaMJM2MnVpBBpv4ebS9VXLnoZPjlte 6n4GjC85I5fZ0JyhPvm1w1COOgH1K/YhfetHj3qPEo+9eJAAJNThVEkiZfe7W4J9prnVnhSWXWz c2SDmLJiDdLIIi3xv1FROLRwGQ8uzL/1x0v6E8LdlA5Og0/fGgY28HkKExjqfWDH7hb0HXEUdF5 WKpXm4i3qIS2iEOWF8BMXktAhExcGTzNIZBK/3AkwZYYJPuLra41l6lnzUA4cFxqZbFo+V8HRIC zuPaAAn6fzdPuDHTXLOgHJxsCl/MkKUKEBEwyhfi2Vtaxjb2NWpq0Xb44WAIhvGHPwDpNL2Enxu Vo+h2JuDE8KtOj7cVA== X-Received: by 2002:a17:90b:17cb:b0:3b1:3598:f881 with SMTP id 98e67ed59e1d1-3b41cb20b9amr37110345a91.53.1796098774245; Mon, 30 Nov 2026 20:19:34 -0800 (PST) Received: from localhost ([27.122.242.71]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b53479b149sm21732030a91.6.2026.11.30.20.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 20:19:33 -0800 (PST) Date: Tue, 1 Dec 2026 13:19:31 +0900 From: Hyunchul Lee To: dd Cc: Hongling Zeng , linkinjeon@kernel.org, liubaolin12138@163.com, ntfs@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: Re: [PATCH 1/6] ntfs: mark the record dirtied by a resident write at iomap begin Message-ID: References: <20261125073547.154150-1-zenghongling@kylinos.cn> <20261125073547.154150-2-zenghongling@kylinos.cn> <3badf580.6efb.1a217323192.Coremail.zhongling0719@126.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3badf580.6efb.1a217323192.Coremail.zhongling0719@126.com> On Thu, Nov 26, 2026 at 05:31:35PM +0800, dd wrote: > > > > > At 2026-11-26 16:45:06, "Hyunchul Lee" wrote: > >Hi Hongling, > > > >> > >> + /* > >> + * The record holding a resident attribute can be an extent record. > >> + * Mark the record the lookup found dirty here, while the search > >> + * context still points at it. The writeout of the record cannot > >> + * overtake the inline copy: it is serialized by the mrec_lock held > >> + * until iomap_end. > >> + */ > >> + mark_mft_record_dirty(ctx->ntfs_ino); > >> + > > > >If the write fails before the data is copied into the resident > >attribute, the MFT record is still marked dirty and may be written back > >even if its contents have not changed. > > > > That can happen, but it is harmless. The mark only sets I_DIRTY_DATASYNC > on the base vfs inode (__mark_mft_record_dirty()), and the record is > written out by __ntfs_write_inode(), which takes the base mrec_lock > before touching any record. The write path holds that lock until > iomap_end, so the writeback cannot see the record mid-copy: in the > failed-write case it writes one record with unchanged contents, in a > write that is already failing. The base record already gets the same > treatment: ntfs_write_iomap_end_resident() marks it dirty regardless of > how much was copied. > > Deferring the mark to iomap_end would have to carry the inode of the > record there: begin releases the search context before returning, and > iomap_end only sees the base inode. > > Thanks for the review. What I am concerned about is the writeback of an unchanged extent record on the failure path. mark_mft_record_dirty() sets NI_Dirty before any data has been copied. I also think carrying the extent record inode is not difficult. iomap_begin() can store it in iomap->private. > > -- > Hongling > >> a = ctx->attr; > >> /* The total length of the attribute value. */ > >> attr_len = le32_to_cpu(a->data.resident.value_length); > >> -- > >> 2.25.1 > >> > > > >-- > >Thanks, > >Hyunchul -- Thanks, Hyunchul